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 ****************/
102 * @brief Layer Manager Control request handler.
106 * Function : RgMiLrgSchCntrlReq
108 * This function handles the control
109 * request received from the Layer Manager.
110 * -# Based on cntrl->hdr.elmId.elmnt, cntrl->t.cntrl.action
111 * and cntrl->t.cntrl.subAction, it performs the appropriate control action
112 * of SAP (enable/disable) and layer shutdown.
113 * -# Invokes the RgMiLrgSchCntrlCfm to send back the confirmation to LM.
115 * @param[in] Pst *pst, the post structure
116 * @param[in] RgMngmt *cntrl, the control parameter's structure
121 PUBLIC S16 RgMiLrgSchCntrlReq
123 Pst *pst, /* post structure */
124 RgMngmt *cntrl /* control structure */
127 PUBLIC S16 RgMiLrgSchCntrlReq(pst, cntrl)
128 Pst *pst; /* post structure */
129 RgMngmt *cntrl; /* control structure */
132 S16 ret = ROK; /* return value */
136 Inst inst = (pst->dstInst - SCH_INST_START); /* Scheduler instance Id */
137 TRC3(RgMiLrgSchCntrlReq)
140 /* Fill the post structure for sending the confirmation */
141 SchFillCfmPst(pst, &cfmPst, cntrl);
143 /* Initialize the cfg cfm structure
144 if (SGetSBuf(cfmPst.region, cfmPst.pool, (Data **)&cfm, sizeof(RgMngmt))
147 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Memory Unavailable for Confirmation");
148 SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt));
151 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
158 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
159 cfm.t.cntrl.action = cntrl->t.cntrl.action;
160 cfm.t.cntrl.subAction = cntrl->t.cntrl.subAction;
162 /* Check if General Config Done*/
163 if(rgSchCb[inst].rgSchInit.cfgDone != TRUE)
165 cfm.cfm.status = LCM_PRIM_NOK;
166 cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
167 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
168 RgMiLrgSchCntrlCfm(&cfmPst, &cfm);
169 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Gen Cfg not done.");
170 /* SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */
174 /* General Config done, process the Control request */
175 switch(cntrl->hdr.elmId.elmnt)
178 rgSCHLmmGenCntrl(cntrl, &cfm, &cfmPst);
182 rgSCHLmmSapCntrl(cntrl, &cfm, &cfmPst);
185 cfm.cfm.status = LCM_PRIM_NOK;
186 cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL;
187 RgMiLrgSchCntrlCfm(&cfmPst, &cfm);
188 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "invalid elmnt=%d",
189 cntrl->hdr.elmId.elmnt);
192 /* SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */
194 }/*-- RgMiLrgSchCntrlReq --*/
198 * @brief Layer Manager L2 Measurement request handler.
202 * Function : RgMiLrgSchL2MeasReq
204 * This function handles the control
205 * measurement request received from the Layer Manager.
207 * @param[in] Pst *pst, the post structure
208 * @param[in] LrgSchMeasReqInfo *measInfo, measurement request info
213 PUBLIC S16 RgMiLrgSchL2MeasReq
215 Pst *pst, /* post structure */
216 LrgSchMeasReqInfo *measInfo /* Meas Req Info */
219 PUBLIC S16 RgMiLrgSchL2MeasReq(pst, measInfo)
220 Pst *pst; /* post structure */
221 LrgSchMeasReqInfo *measInfo; /* Meas Req Info */
228 RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
229 #if (ERRCLASS & ERRCLS_ADD_RES)
233 RgSchL2MeasCb *measCb = NULLP;
235 Inst inst = (pst->dstInst - SCH_INST_START); /* Scheduler instance Id */
241 TRC3(RgMiLrgSchL2MeasReq)
244 /* Find the cellCb using cellId in measInfo. Iterate through all cells
245 * in rgrsapCb in RgschCb */
247 for (idx = 0; idx < instCb->numSaps; idx++)
249 if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
251 /* got the cell break the loop */
252 cell = instCb->rgrSap[idx].cell;
256 /* If no cellCb return Err with Invalid Cell Id */
259 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
260 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_CELLID);
261 rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE);
262 RLOG_ARG2(L_ERROR,DBG_INSTID,inst,
263 "Meas req Failed.Invalid Cell Id errType(%d) errCause(%d)",
264 err.errType, err.errCause);
267 /* Validate for Meas Types */
268 if ( (ret = rgSCHUtlValidateMeasReq(cell, measInfo, &err)) != ROK)
270 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
271 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_MEASTYPE);
272 rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE);
273 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
274 "Meas req Failed.Invalid Measurement Type"
275 "errCasue(%d) errType(%d)", err.errType, err.errCause);
278 /* Iterate through all meas requests in l2mList in cellCb */
279 #if (ERRCLASS & ERRCLS_ADD_RES)
280 lnk = cell->l2mList.first;
283 /* Get the MeasCb : RgSchL2MeasCb */
284 measCb = (RgSchL2MeasCb *)lnk->node;
286 if (measCb->measReq.hdr.transId == measInfo->hdr.transId)
288 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
289 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_DUP_TRANSID);
290 rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE);
291 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
292 "Meas req Failed.Dublicate TransId"
293 "errType(%d) errCause(%d)", err.errType, err.errCause);
298 /* Call L2M Function to store Meas req */
299 ret = rgSchL2mMeasReq(cell, measInfo, err);
302 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
303 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_L2MEAS_FAILED);
304 rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE);
305 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
306 "Meas req Failed.errType(%d) errCause(%d)",
307 err.errType, err.errCause);
311 } /* -- RRgMiLrgSchL2MeasReq-- */
314 * @brief Layer Manager L2 Measurement Stop request handler.
318 * Function : RgMiLrgSchL2MeasStopReq
320 * This function handles the control
321 * measurement stop request received from the Layer Manager.
323 * @param[in] Pst *pst, the post structure
324 * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info
329 PUBLIC S16 RgMiLrgSchL2MeasStopReq
331 Pst *pst, /* post structure */
332 LrgSchMeasStopReqInfo *measInfo /* Meas Req Info */
335 PUBLIC S16 RgMiLrgSchL2MeasStopReq(pst, measInfo)
336 Pst *pst; /* post structure */
337 LrgSchMeasStopReqInfo *measInfo; /* Meas Req Info */
341 RgSchCellCb *cell = NULLP;
342 RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
343 CmLList *node = NULLP;
344 RgSchL2MeasCb *measCb = NULLP;
345 LrgSchMeasCfmInfo measCfm;
349 TRC3(RgMiLrgSchL2MeasStopReq)
352 for (idx = 0; idx < instCb->numSaps; idx++)
354 if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
356 /* got the cell break the loop */
357 cell = instCb->rgrSap[idx].cell;
363 RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId,
364 "Stop req Failed.Invalid Cell Id ");
367 cmMemset((U8 *)&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
368 node = cell->l2mList.first;
371 measCb = (RgSchL2MeasCb *)(node)->node;
374 cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
375 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,
376 sizeof(RgSchL2MeasCb));
379 if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
381 RgInfL2MeasStopReq measStopReq;
383 cmMemset((U8 *)&measStopReq, 0, sizeof(RgInfL2MeasStopReq));
384 measStopReq.transId = measInfo->hdr.transId;
385 measStopReq.measType = measInfo->measType;
386 /* measReq.timePrd = measInfo->timePrd; */
387 measStopReq.cellId = measInfo->cellId;
388 rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst);
389 RgSchMacL2MeasStop(&pstMac,&measStopReq);
393 RgMiLrgSchL2MeasStopCfm(&(rgSchCb[cell->instIdx].rgSchInit.lmPst),
397 }/*RgMiLrgSchL2MeasStopReq*/
399 * @brief Layer Manager L2 Measurement request handler.
400 * for Send l2 measurement req
403 * Function : RgMiLrgSchL2MeasSendReq
405 * This function handles the control
406 * measurement send request received from the Layer Manager.
408 * @param[in] Pst *pst, the post structure
409 * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info
414 PUBLIC S16 RgMiLrgSchL2MeasSendReq
416 Pst *pst, /* post structure */
417 LrgSchMeasSndReqInfo *measInfo /* Meas Req Info */
420 PUBLIC S16 RgMiLrgSchL2MeasSendReq(pst, measInfo)
421 Pst *pst; /* post structure */
422 LrgSchMeasSndReqInfo *measInfo; /* Meas Req Info */
427 RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
430 TRC3(RgMiLrgSchL2MeasSendReq)
435 for (idx = 0; idx < instCb->numSaps; idx++)
437 if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
439 /* got the cell break the loop */
440 cell = instCb->rgrSap[idx].cell;
446 RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId,
447 "Send req Failed.Invalid Cell Id");
451 if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
453 RgInfL2MeasSndReq measSndReq;
455 cmMemset((U8 *)&measSndReq, 0, sizeof(RgInfL2MeasSndReq));
456 measSndReq.transId = measInfo->hdr.transId;
457 measSndReq.measType = measInfo->measType;
458 measSndReq.timePrd = measInfo->timePrd;
459 measSndReq.cellId = measInfo->cellId;
460 rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst);
461 RgSchMacL2MeasSend(&pstMac, &measSndReq);
465 cell->sndL2Meas = TRUE;
469 }/*RgMiLrgSchL2MeasSendReq*/
470 #endif /* LTE_L2_MEAS */
475 /************* RGR Interface ****************/
477 * @brief API for bind request from RRM towards MAC.
481 * Function: RgUiRgrBndReq
483 * This API is invoked by RRM towards MAC to bind RGR SAP.
484 * These API validates the Pst, spId, suId and sends the bind confirm to
488 * @param[in] Pst *pst
489 * @param[in] SuId suId
490 * @param[in] SpId spId
496 PUBLIC S16 RgUiRgrBndReq
503 PUBLIC S16 RgUiRgrBndReq(pst, suId, spId)
510 Pst tmpPst; /* Temporary Post Structure */
511 Inst instId = pst->dstInst-SCH_INST_START;
512 RgUstaDgn dgn; /* Alarm diagnostics structure */
517 tmpPst.prior = pst->prior;
518 tmpPst.route = pst->route;
519 tmpPst.selector = pst->selector;
520 tmpPst.region = rgSchCb[instId].rgSchInit.region;
521 tmpPst.pool = rgSchCb[instId].rgSchInit.pool;
522 tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId;
523 tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent;
524 tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + SCH_INST_START;
525 tmpPst.event = EVTNONE;
526 tmpPst.dstProcId = pst->srcProcId;
527 tmpPst.dstEnt = pst->srcEnt;
528 tmpPst.dstInst = pst->srcInst;
530 if(spId < rgSchCb[instId].numSaps)
532 /* Check the state of the SAP */
533 switch (rgSchCb[instId].rgrSap[spId].sapSta.sapState)
535 /* This case might not be needed if SAP not configured then it will go
536 * to else of above if condition */
537 case LRG_UNBND: /* SAP is not bound */
538 RLOG0(L_DEBUG,"SAP Not yet bound");
539 rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_BND;
540 rgSchCb[instId].rgrSap[spId].sapCfg.suId = suId;
541 /* Send Bind Confirm with status as SUCCESS */
542 ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK);
543 /*Indicate to Layer manager */
544 rgSCHUtlFillDgnParams(instId, &dgn, LRG_USTA_DGNVAL_MEM);
545 ret = rgSCHLmmStaInd(instId, LCM_CATEGORY_INTERFACE,
546 LRG_EVENT_RGRSAP_ENB, LCM_CAUSE_UNKNOWN, &dgn);
548 case LRG_BND: /* SAP is already bound*/
549 RLOG0(L_DEBUG,"SAP is already bound");
550 ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK);
552 default: /* Should Never Enter here */
553 #if (ERRCLASS & ERRCLS_ADD_RES)
554 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001,
555 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
556 "Invalid SAP State:RgUiRrgBndReq failed\n");
558 ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_NOK);
564 #if (ERRCLASS & ERRCLS_ADD_RES)
565 /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state
566 to spId to avoid seg fault due to invalid sapID */
567 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002,
568 (ErrVal)spId, "Invalid SAP Id:RgUiRrgBndReq failed\n");
570 ret = RgUiRgrBndCfm(&tmpPst, suId, CM_BND_NOK);
573 } /* RgUiRgrBndReq */
576 * @brief API for unbind request from RRM towards MAC.
580 * Function: RgUiRgrUbndReq
582 * This API is invoked by RRM towards MAC to unbind RGR SAP.
583 * These API validates the Pst, spId, suId and transfers the unbind request
584 * specific information to corresponding ownership module (GOM) API.
587 * @param[in] Pst *pst
588 * @param[in] SuId suId
589 * @param[in] Reason reason
595 PUBLIC S16 RgUiRgrUbndReq
602 PUBLIC S16 RgUiRgrUbndReq(pst, spId, reason)
608 Inst instId = pst->dstInst-SCH_INST_START;
612 /* SAP Id validation */
613 if (spId < rgSchCb[instId].numSaps)
615 switch(rgSchCb[instId].rgrSap[spId].sapSta.sapState)
617 case LRG_BND: /* SAP is already bound*/
618 RLOG0(L_DEBUG,"SAP is already bound");
619 /* setting SAP state to UN BOUND */
620 rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_UNBND;
623 #if (ERRCLASS & ERRCLS_ADD_RES)
624 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003,
625 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
626 "Invalid SAP State: RgUiRgrUbndReq failed\n");
633 #if (ERRCLASS & ERRCLS_ADD_RES)
634 RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004,
635 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
636 "Invalid SAP Id:RgUiRgrUbndReq failed\n");
641 } /* RgUiRgrUbndReq */
645 * @brief API for SI configuration request from RRM towards MAC.
649 * Function: RgUiRgrSiCfgReq
651 * This API is invoked by RRM towards MAC to configure SI at MAC.
652 * These API validates the Pst, spId, suId and transfers the
653 * config request specific information to corresponding ownership
657 * @param[in] Pst *pst
658 * @param[in] SpId spId
659 * @param[in] RgrCfgTransId transId
660 * @param[in] RgrSiCfgReqInfo *cfgReqInfo
666 PUBLIC S16 RgUiRgrSiCfgReq
670 RgrCfgTransId transId,
671 RgrSiCfgReqInfo *cfgReqInfo
674 PUBLIC S16 RgUiRgrSiCfgReq(pst, spId, transId, cfgReqInfo)
677 RgrCfgTransId transId;
678 RgrSiCfgReqInfo *cfgReqInfo;
682 U8 cfmStatus = RGR_CFG_CFM_NOK;
683 U8 prntTrans[RGR_CFG_TRANSID_SIZE+1];
684 Inst instId = pst->dstInst-SCH_INST_START;
686 TRC2(RgUiRgrSiCfgReq);
688 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
689 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
692 if (cfgReqInfo == NULLP)
694 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
696 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
700 if (spId < rgSchCb[instId].numSaps)
702 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
704 #if (ERRCLASS & ERRCLS_ADD_RES)
705 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007,
706 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
707 "Invalid SAP State: RgUiRgrSiCfgReq failed\n");
709 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
710 (Size)sizeof(*cfgReqInfo));
711 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
717 #if (ERRCLASS & ERRCLS_ADD_RES)
718 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008,
719 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
720 "Invalid SAP Id:RgUiRgrSiCfgReq failed\n");
722 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
723 (Size)sizeof(*cfgReqInfo));
724 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
728 /* Handle configuration */
730 if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
732 ret = rgSCHGomEmtcHndlSiCfg(pst->region, pst->pool,
733 &rgSchCb[instId], spId, transId,
738 ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
739 &rgSchCb[instId], spId, transId,
743 ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
744 &rgSchCb[instId], spId, transId,
749 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"RgUiRgrSiCfgReq:"
750 "Configuration Request Handling Failed");
755 } /* RgUiRgrSiCfgReq */
759 * @brief API for Warning SI configuration request from RRM towards MAC.
763 * Function: RgUiRgrWarningSiCfgReq
765 * This API is invoked by RRM towards MAC to configure SI at MAC.
766 * These API validates the Pst, spId, suId and transfers the
767 * config request specific information to corresponding ownership
771 * @param[in] Pst *pst
772 * @param[in] SpId spId
773 * @param[in] RgrCfgTransId transId
774 * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
780 PUBLIC S16 RgUiRgrWarningSiCfgReq
784 RgrCfgTransId transId,
785 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
788 PUBLIC S16 RgUiRgrWarningSiCfgReq(pst, spId, transId, warningSiCfgReqInfo)
791 RgrCfgTransId transId;
792 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo;
795 Inst instId = pst->dstInst-SCH_INST_START;
797 U8 cfmStatus = RGR_CFG_CFM_NOK;
798 U8 prntTrans[RGR_CFG_TRANSID_SIZE+1];
800 TRC2(RgUiRgrWarningSiCfgReq);
802 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
803 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
807 if (warningSiCfgReqInfo == NULLP)
809 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
811 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, 0, transId, cfmStatus);
815 if (spId < rgSchCb[instId].numSaps)
817 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
819 #if (ERRCLASS & ERRCLS_ADD_RES)
820 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG023,
821 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
822 "Invalid SAP State: warningSiCfgReqInfo failed\n");
824 rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool,
825 &warningSiCfgReqInfo->siPduLst);
826 SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
827 sizeof(RgrWarningSiCfgReqInfo));
828 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId,
835 #if (ERRCLASS & ERRCLS_ADD_RES)
836 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG024,
837 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
838 "Invalid SAP Id:warningSiCfgReqInfo failed\n");
840 rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool,
841 &warningSiCfgReqInfo->siPduLst);
842 SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
843 sizeof(RgrWarningSiCfgReqInfo));
844 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId,
849 /* Handle configuration */
851 if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
853 ret = rgSCHGomEmtcHndlWarningSiCfg(pst->region, pst->pool,
854 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
858 ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
859 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
862 ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
863 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
867 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,
868 "Configuration Request Handling Failed");
877 * @brief API for Warning SI Stop request from RRM towards MAC.
881 * Function: RgUiRgrWarningSiStopReq
883 * This API is invoked by RRM towards MAC to Stop warning SI at MAC.
884 * These API validates the Pst, spId, suId and transfers the
885 * stop request specific information to corresponding ownership
889 * @param[in] Pst *pst
890 * @param[in] SpId spId
891 * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
897 PUBLIC S16 RgUiRgrWarningSiStopReq
901 RgrCfgTransId transId,
905 PUBLIC S16 RgUiRgrWarningSiStopReq(pst,spId, transId, siId)
908 RgrCfgTransId transId;
912 Inst instId = pst->dstInst-SCH_INST_START;
914 TRC3(RgUiRgrWarningSiStopReq)
918 if (spId < rgSchCb[instId].numSaps)
920 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
922 #if (ERRCLASS & ERRCLS_ADD_RES)
923 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG025,
924 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
925 "Invalid SAP State: RgUiRgrWarningSiStopReq failed\n");
932 #if (ERRCLASS & ERRCLS_ADD_RES)
933 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG026,
934 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
935 "Invalid SAP Id:RgUiRgrWarningSiStopReq failed\n");
940 rgSCHGomHndlWarningSiStopReq(pst->region, pst->pool,
941 &rgSchCb[instId], siId, transId, spId);
945 #endif /*RGR_SI_SCH */
947 /* LTE_ADV_FLAG_REMOVED_START */
950 * @brief API for LOAD INF request from RRM towards MAC.
954 * Function: RgUiRgrLoadInfReq
956 * This API is invoked by RRM towards MAC to configure LOAD INF Parameters at MAC.
957 * These API validates the Pst, spId, suId and transfers the
958 * LOAD INF request to corresponding ownership
962 * @param[in] Pst *pst
963 * @param[in] SpId spId
964 * @param[in] RgrCfgTransId transId
965 * @param[in] RgrLoadInfReqInfo *loadInfReq
971 PUBLIC S16 RgUiRgrLoadInfReq
975 RgrCfgTransId transId,
976 RgrLoadInfReqInfo *loadInfReq
979 PUBLIC S16 RgUiRgrLoadInfReq(pst, spId, transId, loadInfReq)
982 RgrCfgTransId transId;
983 RgrLoadInfReqInfo *loadInfReq;
987 U8 prntTrans[RGR_CFG_TRANSID_SIZE+1];
988 Inst instId = pst->dstInst-SCH_INST_START;
990 TRC2(RgUiRgrLoadInfReq);
992 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
993 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
996 if (loadInfReq == NULLP)
998 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
1003 if (spId < rgSchCb[instId].numSaps)
1005 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
1007 #if (ERRCLASS & ERRCLS_ADD_RES)
1008 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007,
1009 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
1010 "Invalid SAP State: RgUiRgrLoadInfReq failed\n");
1012 SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq,
1013 (Size)sizeof(*loadInfReq));
1019 #if (ERRCLASS & ERRCLS_ADD_RES)
1020 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008,
1021 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
1022 "Invalid SAP Id:RgUiRgrLoadInfReq failed\n");
1024 SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq,
1025 (Size)sizeof(*loadInfReq));
1029 /* Handle configuration */
1030 ret = rgSCHGomHndlLoadInf(pst->region, pst->pool,
1031 &rgSchCb[(pst->dstInst - SCH_INST_START)], spId, transId,
1035 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,
1036 "Configuration Request Handling Failed");
1041 } /* RgUiRgrLoadInfReq */
1042 /* LTE_ADV_FLAG_REMOVED_END */
1044 /************** MAC SCH Interface **************/
1046 * @brief Function for updating dedicated channel BO at scheduler from MAC.
1050 * Function : rgMacSchDedBoUpdtReq
1052 * This function shall be invoked whenever MAC gets staRsp from RLC
1053 * Scheduler shall update BO in its dedicated logical channel control block.
1055 * @param[in] Pst* pst
1056 * @param[in] S16 cellSapId
1057 * @param[in] RgInfDedBoRpt *boRpt
1062 PUBLIC S16 RgMacSchDedBoUpdtReq
1065 RgInfDedBoRpt *boRpt
1068 PUBLIC S16 RgMacSchDedBoUpdtReq(pst, boRpt)
1070 RgInfDedBoRpt *boRpt;
1080 Inst inst = (pst->dstInst - SCH_INST_START);
1081 S16 cellSapId = boRpt->cellSapId;
1083 TRC3(RgMacSchDedBoUpdtReq)
1085 RLOG_ARG2(L_DEBUG,DBG_CELLID,boRpt->cellId,"rgMacSchDedBoUpdtReq():"
1086 " boRpt->rnti = %u boRpt->lcId = %u",boRpt->rnti, boRpt->lcId);
1088 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1089 * it doesnt exist */
1090 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1093 if (cell->cellId != boRpt->cellId)
1095 /* Handle Cell fetch failure */
1096 RGSCHLOGERROR(inst, ERRCLS_INT_PAR,ERG009,(ErrVal)boRpt->cellId,
1097 "rgMacSchDedBoUpdtReq(): Invalid cell Id");
1102 /* Update Bo in the given logical channel of the UE */
1103 if ((ue = rgSCHDbmGetUeCb(cell, boRpt->rnti)) != NULLP)
1106 /* Honor BO Reports only from PCELL */
1108 if (cell != ue->cell)
1113 if ((dlLc = rgSCHDbmGetDlDedLcCb(ue, boRpt->lcId)) != NULLP)
1116 if(dlLc->lcType == CM_LTE_LCH_DTCH)
1118 if((dlLc->bo == 0) &&(boRpt->bo != 0))
1121 if(!(ue->qciActiveLCs[dlLc->qciCb->qci]))
1123 dlLc->qciCb->dlUeCount++;
1125 ue->qciActiveLCs[dlLc->qciCb->qci]++;
1127 else if((dlLc->bo != 0) && (boRpt->bo == 0) && (dlLc->qciCb->dlUeCount))
1129 /* UE is inactive */
1130 if (ue->qciActiveLCs[dlLc->qciCb->qci])
1132 ue->qciActiveLCs[dlLc->qciCb->qci]--;
1133 if (!(ue->qciActiveLCs[dlLc->qciCb->qci]))
1135 dlLc->qciCb->dlUeCount--;
1142 dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell);
1143 if (boRpt->bo > dlLc->bo)
1145 dlUe->boReported += (boRpt->bo - dlLc->bo);
1149 if (boRpt->bo > dlLc->bo)
1151 ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlBo += ((boRpt->bo - dlLc->bo)<<3);
1154 /* RLC provides cumulative BO for each LC.
1155 * Reduce the left out unscheduled bo from total bo and
1156 * update the new BO to the total bo */
1157 if(ue->totalBo >= dlLc->bo)
1159 ue->totalBo -= dlLc->bo;
1163 ue->totalBo = 0; /* this case should not arise
1164 * Resetting for safety */
1167 ue->totalBo += boRpt->bo;
1168 dlLc->bo = boRpt->bo;
1169 dlLc->oldestSduArrTime = boRpt->oldestSduArrTime;
1170 dlLc->staPduBo = boRpt->staPduBo;
1172 dlLc->setMaxUlPrio = boRpt->setMaxUlPrio;
1173 dlLc->setMaxDlPrio = boRpt->setMaxDlPrio;
1174 /* Update the scheduler */
1175 rgSCHUtlDlDedBoUpd(cell, ue, dlLc);
1181 } /* end of rgMacSchDedBoUpdtReq */
1185 * @brief Function for updating common channel BO at scheduler from MAC.
1189 * Function : RgMacSchCmnBoUpdtReq
1191 * This function shall be invoked whenever MAC gets staRsp from RLC
1192 * Scheduler shall update BO in its common logical channel control block.
1194 * @param[in] Pst* pst
1195 * @param[in] S16 cellSapId
1196 * @param[in] RgInfCmnBoRpt *boRpt
1201 PUBLIC S16 RgMacSchCmnBoUpdtReq
1204 RgInfCmnBoRpt *boRpt
1207 PUBLIC S16 RgMacSchCmnBoUpdtReq(pst, boRpt)
1209 RgInfCmnBoRpt *boRpt;
1213 Inst inst = (pst->dstInst - SCH_INST_START);
1214 S16 cellSapId = boRpt->cellSapId;
1216 TRC3(RgMacSchCmnBoUpdtReq)
1218 /* No need to chk for cell being NULL as MAC would not have found instance if
1219 * it doesnt exist */
1220 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1221 if (cell->cellId != boRpt->cellId)
1223 RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():"
1224 "Invalid boRpt cell Id:%d",boRpt->cellId);
1228 /* handle status response on CCCH */
1229 if(boRpt->lcId == cell->dlCcchId)
1231 RLOG_ARG0(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():"
1232 " BO update for CCCH");
1233 rgSCHUtlHndlCcchBoUpdt(cell, boRpt);
1237 rgSCHUtlHndlBcchPcchBoUpdt(cell, boRpt);
1241 } /* end of RgMacSchCmnBoUpdtReq */
1242 /*Fix: start: Inform UE delete to scheduler*/
1244 * @brief This API is used to send data indication to Scheduler instance from MAC.
1248 * Function : rgMacSchUeDelInd
1250 * This function shall be invoked whenever MAC gets Ue delete request.
1253 * @param[in] Pst* pst
1254 * @param[in] RgInfUeDelInd *ueDelInd
1259 PUBLIC S16 RgMacSchUeDelInd
1262 RgInfUeDelInd *ueDelInd
1265 PUBLIC S16 RgMacSchUeDelInd(pst, ueDelInd)
1267 RgInfUeDelInd *ueDelInd;
1271 Inst inst = (pst->dstInst - SCH_INST_START);
1272 S16 cellSapId = ueDelInd->cellSapId;
1274 RgSchRntiLnk *rntiLnk=NULL;
1276 TRC3(RgMacSchUeDelInd)
1278 if (rgSchCb[inst].rgrSap == NULLP || rgSchCb[inst].rgrSap[cellSapId].cell == NULLP)
1280 RLOG_ARG0(L_ERROR,DBG_CELLID,ueDelInd->cellId,"rgrSap or cell is not configured");
1283 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1285 if (cell->cellId != ueDelInd->cellId)
1287 /* Handle Cell fetch failure */
1288 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1289 "rgMacSchUeDelInd(): Invalid ueDelInd cell Id:%d",
1295 CM_LLIST_FIRST_NODE(&cell->rntiDb.rntiGuardPool, tmp);
1299 rntiLnk = (RgSchRntiLnk *)(tmp->node);
1300 if(rntiLnk->rnti == ueDelInd->rnti)
1302 cmLListDelFrm(&cell->rntiDb.rntiGuardPool, tmp);
1304 rgSCHDbmRlsRnti(cell, rntiLnk);
1305 RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
1306 "RNTI:%d Released from the Guard pool(%ld)",
1307 ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
1311 CM_LLIST_NEXT_NODE(&cell->rntiDb.rntiGuardPool, tmp);
1315 rgEmtcMacSchUeDelInd(cell,ueDelInd);
1320 /* Fix : syed HO UE does not have a valid ue->rntiLnk */
1321 RLOG_ARG2(L_INFO,DBG_CELLID,ueDelInd->cellId,"HO CRNTI:%d not present in the"
1322 "Guard Pool:%ld", ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
1326 } /* rgMacSchUeDelInd */
1327 /*Fix: end: Inform UE delete to scheduler*/
1329 * @brief This API is used to send data indication to Scheduler instance from MAC.
1333 * Function : rgMacSchSfRecpInd
1335 * This function shall be invoked whenever MAC gets datInd on TFU
1336 * Scheduler shall act on the CEs and data that are received as part of
1339 * @param[in] Pst* pst
1340 * @param[in] S16 cellSapId
1341 * @param[in] CmLteRnti rnti
1342 * @param[in] DatIndInfo *datInd
1347 PUBLIC S16 RgMacSchSfRecpInd
1350 RgInfSfDatInd *subfrmInfo
1353 PUBLIC S16 RgMacSchSfRecpInd(pst, subfrmInfo)
1355 RgInfSfDatInd *subfrmInfo;
1361 RgInfUeDatInd *datInd;
1363 Inst inst = (pst->dstInst - SCH_INST_START);
1367 S16 cellSapId = subfrmInfo->cellSapId;
1368 RgrUeStaIndInfo *ueStaInd;
1371 RgSchCmnUlUeSpsInfo *ulSpsUe ;
1379 U16 datIndActQci = 0;
1380 U16 combDatIndActQci = 0; /* Prev and Latest Dat Ind combined */
1381 U16 tempUeActQci = 0; /* UE specific Active QCIs */
1385 TRC3(RgMacSchSfRecpInd)
1387 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1388 * it doesnt exist */
1389 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1391 /* lnkLst assignment */
1392 lnkLst = &(subfrmInfo->ueLst);
1394 CM_LLIST_FIRST_NODE(lnkLst, tmp);
1396 while((NULLP != tmp) && ((RgInfUeDatInd *)tmp->node != NULLP))
1402 datInd = (RgInfUeDatInd *)tmp->node;
1403 rnti = datInd->rnti;
1405 /* We shall try and find
1406 * out the RaCb based on the following -
1407 * 1. If the incoming PDU contained a CCCH SDU i.e. this is message 3.
1408 * 2. If the incoming PDU contained a CRNTI control element, i.e. we should
1409 * have a ueCb also for this
1412 /* It could be that a non-msg3 pdu contains a CRNTI Control element. We
1413 * should check for CRNTI CE and if it exists the UECb must exist, also an
1414 * if the CRNTI in the CE and the one with which the message came in are
1415 * different we shall look for an raCb as well.
1417 if (datInd->ceInfo.bitMask & RGSCH_CRNTI_CE_PRSNT)
1419 /* SR_RACH_STATS : CRNTI CE*/
1422 if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
1424 RGSCH_FREE_MEM(subfrmInfo);
1425 err.errType = RGSCHERR_TOM_DATIND;
1426 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1427 "Received MSG3 with CRNTI:%d and also CCCH ",
1428 datInd->ceInfo.ces.cRnti);
1431 ue = rgSCHDbmGetUeCb (cell, datInd->ceInfo.ces.cRnti);
1434 /* SR_RACH_STATS : CRNTI CE UECB NOT FOUND*/
1435 rgNumCrntiCeCrntiNotFound++;
1436 /* ccpu00141318 - Removed condition for SPS rnti checking*/
1437 RGSCH_FREE_MEM(subfrmInfo);
1438 err.errType = RGSCHERR_TOM_DATIND;
1439 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Received MSG3 "
1440 "with CRNTI:%d unable to find ueCb",
1441 datInd->ceInfo.ces.cRnti);
1445 if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue,
1446 rnti, datInd, &err)) != ROK)
1448 RGSCH_FREE_MEM(subfrmInfo);
1449 err.errType = RGSCHERR_TOM_DATIND;
1450 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Processing for MSG3 failed for CRNTI:%d",
1456 rgSCHUtlHdlCrntiCE (cell, ue);
1458 ret = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&ueStaInd,
1459 sizeof(RgrUeStaIndInfo));
1462 ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD;
1465 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue);
1466 if(ulSpsUe->isUlSpsActv)
1468 ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD_IN_SPS_ACTIVE;
1469 ue->ul.ulSpsCfg.isLcSRMaskEnab = FALSE;
1472 ret = rgSCHUtlFillSndUeStaInd(cell, ue, ueStaInd);
1475 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1476 "Could not Send Ue Sta Ind UEID:%d",ue->ueId);
1479 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1481 } /* end of CRNTI based message */
1482 else if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
1484 /* SR_RACH_STATS : CCCH SDU */
1486 /* SR_RACH_STATS : CCCH SDU RACB NOT FOUND*/
1487 if (NULLP == rgSCHDbmGetRaCb (cell, rnti))
1489 rgNumCCCHSduCrntiNotFound++;
1492 if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue,
1493 rnti, datInd, &err)) != ROK)
1495 RGSCH_FREE_MEM(subfrmInfo);
1496 err.errType = RGSCHERR_TOM_DATIND;
1497 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Processing for MSG3 failed for CRNTI:%d",
1502 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1504 } /* end of Msg3 processing */
1508 ue = rgSCHDbmGetUeCb (cell, datInd->rnti);
1512 if((ue = rgSCHDbmGetSpsUeCb (cell, datInd->rnti)) == NULLP)
1515 RGSCH_FREE_MEM(subfrmInfo);
1516 err.errType = RGSCHERR_TOM_DATIND;
1517 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the UE CB for CRNTI:%d",
1525 /* The LCs for which data is received at MAC is provided to SCH.
1526 This information is used to estimate the Active LCs at UE
1527 since estimates based on only BSR is not accurate */
1528 if (datInd->ceInfo.bitMask & RGSCH_ACTIVE_LC_PRSNT)
1531 /* Compose a Bitmask with for the QCI's for which Data
1533 for (lcCount = 0; lcCount < RGINF_MAX_NUM_DED_LC; lcCount++)
1535 if ((datInd->ceInfo.ulActLCs[lcCount] == TRUE) && (TRUE == ue->ul.lcCb[lcCount].isValid))
1537 datIndActQci |= (1 << (ue->ul.lcCb[lcCount].qciCb->qci -1));
1540 if (ue->ulActiveLCs && ue->lastDatIndLCs)
1542 /* Combine previous Dat Ind and current Dat Ind to
1543 estimate active LCs at UE */
1544 combDatIndActQci = ue->lastDatIndLCs | datIndActQci;
1545 tempUeActQci = ue->ulActiveLCs;
1546 ue->ulActiveLCs = combDatIndActQci;
1547 diffBits = combDatIndActQci ^ tempUeActQci;
1553 if (0x1 & tempUeActQci)
1555 /* An active QCI has become inactive */
1556 cell->qciArray[qci].ulUeCount--;
1560 /* An Inactive QCI has become active */
1561 cell->qciArray[qci].ulUeCount++;
1568 ue->lastDatIndLCs = datIndActQci;
1572 #endif /* LTE_L2_MEAS */
1573 /* Just copy the timing information from the dat indication into the one
1574 * stored in the UE CB, will be later utilized to handle Timing advance
1577 if ((ret = rgSCHUtlUpdSch (subfrmInfo, cell, ue, datInd, &err)) != ROK)
1579 RGSCH_FREE_MEM(subfrmInfo);
1580 err.errType = RGSCHERR_TOM_DATIND;
1581 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to handle Data"
1582 " Indication for UEID:%d",ue->ueId);
1586 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1589 /* update the UL PRB usage for all GBR QCIs*/
1590 for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++)
1592 cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed += subfrmInfo->qcisUlPrbCnt[idx];
1596 /* chk if Sch needs to dealloc datInd after unpk */
1597 RGSCH_FREE_MEM(subfrmInfo);
1599 } /* rgMacSchSfRecpInd */
1603 * @brief Function to handle relInd from MAC for a UE
1607 * Function: RgMacSchSpsRelInd
1609 * Handler for processing relInd for UL SPS of a UE
1616 * @param[in] Pst *pst
1617 * @param[in] RgInfSpsRelInfo *relInfo
1623 PUBLIC S16 RgMacSchSpsRelInd
1626 RgInfSpsRelInfo *relInfo
1629 PUBLIC S16 RgMacSchSpsRelInd(pst, relInfo)
1631 RgInfSpsRelInfo *relInfo;
1636 Inst inst = (pst->dstInst - SCH_INST_START);
1638 TRC2(RgMacSchSpsRelInd);
1640 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1641 * it doesnt exist */
1642 cell = rgSchCb[inst].rgrSap[relInfo->cellSapId].cell;
1644 if ((ue = rgSCHDbmGetUeCb(cell, relInfo->cRnti)) == NULLP)
1646 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1647 "No Ue exists with CRNTI:%d",relInfo->cRnti);
1651 if ((rgSCHUtlSpsRelInd(cell, ue, relInfo->isExplRel)) != ROK)
1653 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1654 "RelInd processing for CRNTI:%d failed",relInfo->cRnti);
1658 } /* end of RgMacSchSpsRelInd */
1659 #endif /* LTEMAC_SPS */
1664 * @brief Function to handle L2MeasCfm from MAC
1668 * Function: RgMacSchL2MeasCfm
1670 * Handler for processing L2 measurement confirm
1677 * @param[in] Pst *pst
1678 * @param[in] RgInfL2MeasCfm *measCfm
1684 PUBLIC S16 RgMacSchL2MeasCfm
1687 RgInfL2MeasCfm *measCfm
1690 PUBLIC S16 RgMacSchL2MeasCfm(pst, measCfm)
1692 RgInfL2MeasCfm *measCfm;
1695 RgSchCellCb *cell = NULLP;
1696 Inst inst = (pst->dstInst - SCH_INST_START);
1698 RgSchL2MeasCb *measCb = NULLP;
1699 RgSchCb *instCb = &rgSchCb[inst];
1701 LrgSchMeasCfmInfo schMeasCfm;
1703 U8 idx1; /*LTE_L2_MEAS_PHASE2*/
1705 TRC2(RgMacSchL2MeasCfm);
1707 /* Find the cellCb using cellId in measInfo. Iterate through all cells
1708 * in rgrsapCb in RgschCb */
1709 for (idx = 0; idx < instCb->numSaps; idx++)
1711 if ( instCb->rgrSap[idx].cell->cellId == measCfm->cellId)
1713 /* got the cell break the loop */
1714 cell = instCb->rgrSap[idx].cell;
1718 /* If no cellCb return Err with Invalid Cell Id */
1721 RLOG_ARG0(L_ERROR,DBG_CELLID,measCfm->cellId,
1722 "Meas Cfm Failed.Invalid Cell Id");
1727 /* Iterate through all meas requests in l2mList in cellCb */
1728 lnk = cell->l2mList.first;
1731 /* Get the MeasCb : RgSchL2MeasCb */
1732 measCb = (RgSchL2MeasCb *)lnk->node;
1734 if (measCb->measReq.hdr.transId == measCfm->transId)
1739 if ( measCb == NULLP )
1741 RETVALUE( RFAILED );
1745 if(measCfm->cfm.status != LCM_PRIM_OK)
1747 for (idx = 0; idx < measCb->measReq.avgPrbQciUl.numQci; idx++)
1749 qciVal = measCb->measReq.avgPrbQciUl.qci[idx];
1750 cell->qciArray[qciVal].qci = 0;
1752 /* Delete this measCb, send the negative confirmation to
1754 cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
1755 /* ccpu00117052 - MOD - Passing double pointer
1756 for proper NULLP assignment*/
1757 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb, sizeof(RgSchL2MeasCb));
1758 cmMemset((U8 *)&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
1759 schMeasCfm.measType = measCfm->measType;
1760 schMeasCfm.cfm = measCfm->cfm;
1761 schMeasCfm.hdr.transId = measCfm->transId;
1762 schMeasCfm.cellId = measCfm->cellId;
1763 RgMiLrgSchL2MeasCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
1766 for(idx = 0; idx < measCfm->u.prbCfm.numQci; idx++)
1768 measCb->avgPrbQciUl.prbUsage[idx].prbUsage = measCfm->u.prbCfm.prbUsage[idx].prbUsage;
1769 measCb->avgPrbQciUl.prbUsage[idx].qciValue = measCfm->u.prbCfm.prbUsage[idx].qciValue;
1770 /*LTE_L2_MEAS_PHASE2*/
1771 qciVal1 = measCfm->u.prbCfm.prbUsage[idx].qciValue;
1772 for(idx1=0;idx1<measCb->measReq.avgPrbQciUl.numQci;idx1++)
1774 if(measCb->measReq.avgPrbQciUl.qci[idx1] == qciVal1)
1779 if(idx1 == measCb->measReq.avgPrbQciUl.numQci)
1781 measCb->measReq.avgPrbQciUl.qci[measCb->measReq.avgPrbQciUl.numQci++] = qciVal1;
1784 measCb->avgPrbQciUl.numQci = measCfm->u.prbCfm.numQci;
1785 measCb->cfmRcvd = TRUE;
1786 cell->sndL2Meas = TRUE;
1788 } /* end of RgMacSchL2MeasCfm */
1791 * @brief Function to handle L2MeasStopCfm from MAC
1795 * Function: RgMacSchL2MeasStopCfm
1797 * Handler for processing L2 measurement confirm
1804 * @param[in] Pst *pst
1805 * @param[in] RgInfL2MeasCfm *measCfm
1811 PUBLIC S16 RgMacSchL2MeasStopCfm
1814 RgInfL2MeasCfm *measCfm
1817 PUBLIC S16 RgMacSchL2MeasStopCfm(pst, measCfm)
1819 RgInfL2MeasCfm *measCfm;
1822 LrgSchMeasCfmInfo schMeasCfm;
1823 Inst inst = (pst->dstInst - SCH_INST_START);
1824 RgSchCb *instCb = &rgSchCb[inst];
1826 TRC2(RgMacSchL2MeasStopCfm);
1828 cmMemset((U8 *)&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
1829 schMeasCfm.measType = measCfm->measType;
1830 schMeasCfm.cfm = measCfm->cfm;
1831 schMeasCfm.hdr.transId = measCfm->transId;
1832 schMeasCfm.cellId = measCfm->cellId;
1833 RgMiLrgSchL2MeasStopCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
1838 /************** TFU Interface *************/
1841 * @brief Bind confirm API for TFU SAP on scheduler instance.
1845 * Function : RgLiTfuSchBndCfm
1847 * This API is invoked by PHY to confirm TFU SAP bind.
1850 * @param[in] Pst *pst
1851 * @param[in] SuId suId
1852 * @param[in] U8 status
1858 PUBLIC S16 RgLiTfuSchBndCfm
1865 PUBLIC S16 RgLiTfuSchBndCfm(pst, suId, status)
1872 RgSchLowSapCb *tfuSap;
1873 Inst instId = pst->dstInst - SCH_INST_START;
1875 TRC3(RgLiTfuSchBndCfm);
1878 if(suId >= rgSchCb[instId].numSaps)
1880 RLOG_ARG0(L_ERROR,DBG_INSTID,instId, "Incorrect SuId");
1883 /* Lets validate suId first */
1884 tfuSap = &(rgSchCb[instId].tfuSap[suId]);
1886 if (suId != tfuSap->sapCfg.suId)
1888 RLOG_ARG2(L_ERROR,DBG_INSTID,instId, "Incorrect SuId. Configured (%d)"
1889 "Recieved (%d)", tfuSap->sapCfg.suId, suId);
1892 ret = rgSCHLmmBndCfm (pst, suId, status);
1894 } /* RgLiTfuSchBndCfm */
1897 * @brief Random Access Request indication from PHY.
1901 * Function : RgLiTfuRaReqInd
1903 * This API is invoked by PHY to send Random Access Request to Scheduler.
1904 * This API contains information for Random Access Request including
1905 * raRnti, list of associated RAPIDs and related information.
1907 * @param[in] Pst *pst
1908 * @param[in] SuId suId
1909 * @param[in] TfuRaReqIndInfo *raReqInd
1915 PUBLIC S16 RgLiTfuRaReqInd
1919 TfuRaReqIndInfo *raReqInd
1922 PUBLIC S16 RgLiTfuRaReqInd(pst, suId, raReqInd)
1925 TfuRaReqIndInfo *raReqInd;
1929 Inst inst = pst->dstInst-SCH_INST_START;
1931 TRC3(RgLiTfuRaReqInd);
1933 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
1935 RLOG_ARG1(L_ERROR,DBG_INSTID,inst,"SAP Validation failed SuId(%d)", suId);
1936 /* Free up the memory for the request structure */
1937 RGSCH_FREE_MEM(raReqInd);
1941 if(raReqInd == NULLP)
1943 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"Invalid input pointer for raReqInd Failed");
1947 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
1949 RLOG_ARG0(L_ERROR,DBG_CELLID,raReqInd->cellId,"No cell exists");
1953 ret = rgSCHTomRaReqInd(rgSchCb[inst].tfuSap[suId].cell, raReqInd);
1954 /* Free up the memory for the request structure */
1955 RGSCH_FREE_MEM(raReqInd);
1956 /*SPutSBuf (pst->region, pst->pool, (Data *)raReqInd,
1957 sizeof(TfuRaReqIndInfo)); */
1959 } /* RgLiTfuRaReqInd */
1962 * @brief Uplink CQI indication from PHY.
1966 * Function : RgLiTfuUlCqiInd
1968 * This API is invoked by PHY to send Uplink CQI to Scheduler.
1969 * This API contains Uplink CQI information reported per UE.
1971 * @param[in] Pst *pst
1972 * @param[in] SuId suId
1973 * @param[in] TfuUlCqiIndInfo *ulCqiInd
1979 PUBLIC S16 RgLiTfuUlCqiInd
1983 TfuUlCqiIndInfo *ulCqiInd
1986 PUBLIC S16 RgLiTfuUlCqiInd(pst, suId, ulCqiInd)
1989 TfuUlCqiIndInfo *ulCqiInd;
1993 Inst inst = pst->dstInst-SCH_INST_START;
1995 TRC3(RgLiTfuUlCqiInd);
1997 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
1999 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2000 /* Free up the memory for the request structure */
2001 RGSCH_FREE_MEM(ulCqiInd);
2005 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2007 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2008 /* Free up the memory for the request structure */
2009 RGSCH_FREE_MEM(ulCqiInd);
2012 ret = rgSCHTomUlCqiInd (rgSchCb[inst].tfuSap[suId].cell, ulCqiInd);
2013 /* Free up the memory for the request structure */
2014 RGSCH_FREE_MEM(ulCqiInd);
2016 } /* RgLiTfuUlCqiInd */
2019 * @brief PUCCH power adjustment indication.
2023 * Function : RgLiTfuPucchDeltaPwrInd
2025 * This API is invoked by PHY to send PUCCH power adjustment
2028 * @param[in] Pst *pst
2029 * @param[in] SuId suId
2030 * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
2036 PUBLIC S16 RgLiTfuPucchDeltaPwrInd
2040 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
2043 PUBLIC S16 RgLiTfuPucchDeltaPwrInd(pst, suId, pucchDeltaPwr)
2046 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr;
2050 Inst inst = pst->dstInst-SCH_INST_START;
2052 TRC3(RgLiTfuPucchDeltaPwrInd);
2054 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2056 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2057 /* Free up the memory for the request structure */
2058 RGSCH_FREE_MEM(pucchDeltaPwr);
2062 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2064 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2067 ret = rgSCHTomPucchDeltaPwrInd (rgSchCb[inst].tfuSap[suId].cell, pucchDeltaPwr);
2068 /* Free up the memory for the request structure */
2069 RGSCH_FREE_MEM(pucchDeltaPwr);
2071 } /* RgLiTfuPucchDeltaPwrInd */
2075 * @brief HARQ ACK indication from PHY for Downlink transmissions.
2079 * Function : RgLiTfuHqInd
2081 * This API is invoked by PHY to send HARQ ACK information to Scheduler
2082 * on recieving HARQ ACK/NACK from UEs.
2083 * This API contains HARQ ACK information recieved by PHY for downlink
2086 * @param[in] Pst *pst
2087 * @param[in] SuId suId
2088 * @param[in] TfuHqIndInfo *harqAckInd
2094 PUBLIC S16 RgLiTfuHqInd
2098 TfuHqIndInfo *harqAckInd
2101 PUBLIC S16 RgLiTfuHqInd(pst, suId, harqAckInd)
2104 TfuHqIndInfo *harqAckInd;
2108 Inst inst = (pst->dstInst - SCH_INST_START);
2113 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2115 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2116 RGSCH_FREE_MEM(harqAckInd);
2120 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2122 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2127 /* Now call the TOM (Tfu ownership module) primitive to process further */
2128 ret = rgSCHTomHarqAckInd (rgSchCb[inst].tfuSap[suId].cell, harqAckInd);
2129 /* Free up the memory for the request structure */
2130 RGSCH_FREE_MEM(harqAckInd);
2132 } /* RgLiTfuHqInd */
2136 * @brief Scheduling request(SR) indication from PHY for an UE.
2140 * Function : RgLiTfuSrInd
2142 * This API is invoked by PHY to send Scheduling request information to
2143 * Scheduler on recieving SR from a list of UEs.
2144 * This API contains scheduling request information recieved by PHY for UEs.
2146 * @param[in] Pst *pst
2147 * @param[in] SuId suId
2148 * @param[in] TfuSrIndInfo *srInd
2154 PUBLIC S16 RgLiTfuSrInd
2161 PUBLIC S16 RgLiTfuSrInd(pst, suId, srInd)
2164 TfuSrIndInfo *srInd;
2168 Inst inst = pst->dstInst-SCH_INST_START;
2173 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2175 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"() SAP Validation failed");
2176 RGSCH_FREE_MEM(srInd);
2180 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2182 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"RgLiTfuSrInd()No cell exists");
2186 /* Now call the TOM (Tfu ownership module) primitive to process further */
2187 ret = rgSCHTomSrInd (rgSchCb[inst].tfuSap[suId].cell, srInd);
2188 /* Free up the memory for the request structure */
2189 RGSCH_FREE_MEM(srInd);
2191 } /* RgLiTfuSrInd */
2195 * @brief Downlink CQI indication from PHY for an UE.
2199 * Function : RgLiTfuDlCqiInd
2201 * This API is invoked by PHY to send Downlink CQI indication to Scheduler
2202 * on recieving downlink CQI from UE.
2203 * This API contains downlink CQI information recieved by PHY for an UE.
2205 * @param[in] Pst *pst
2206 * @param[in] SuId suId
2207 * @param[in] TfuDlCqiIndInfo *dlCqiInd
2213 PUBLIC S16 RgLiTfuDlCqiInd
2217 TfuDlCqiIndInfo *dlCqiInd
2220 PUBLIC S16 RgLiTfuDlCqiInd(pst, suId, dlCqiInd)
2223 TfuDlCqiIndInfo *dlCqiInd;
2227 Inst inst = pst->dstInst-SCH_INST_START;
2229 TRC3(RgLiTfuDlCqiInd);
2231 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2233 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed");
2234 /* Free up the memory for the request structure */
2235 RGSCH_FREE_MEM(dlCqiInd);
2239 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2241 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2244 ret = rgSCHTomDlCqiInd (rgSchCb[inst].tfuSap[suId].cell, dlCqiInd);
2245 /* Free up the memory for the request structure */
2246 RGSCH_FREE_MEM(dlCqiInd);
2248 } /* RgLiTfuDlCqiInd */
2252 * @brief Raw CQI indication from PHY for an UE.
2256 * Function : RgLiTfuRawCqiInd
2258 * This API is invoked by PHY to send Raw CQI indication to Scheduler
2259 * on receiving Raw CQI from UE.
2260 * This API contains Raw CQI information recieved by PHY for an UE.
2262 * @param[in] Pst *pst
2263 * @param[in] SuId suId
2264 * @param[in] TfuRawCqiIndInfo *rawCqiInd
2270 PUBLIC S16 RgLiTfuRawCqiInd
2274 TfuRawCqiIndInfo *rawCqiInd
2277 PUBLIC S16 RgLiTfuRawCqiInd(pst, suId, rawCqiInd)
2280 TfuRawCqiIndInfo *rawCqiInd;
2284 Inst inst = pst->dstInst-SCH_INST_START;
2286 TRC3(RgLiTfuRawCqiInd);
2289 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2291 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2292 /* Free up the memory for the request structure */
2293 RGSCH_FREE_MEM(rawCqiInd);
2297 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2299 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," No cell exists");
2303 ret = rgSCHTomRawCqiInd (rgSchCb[inst].tfuSap[suId].cell, rawCqiInd);
2304 /* Free up the memory for the request structure */
2305 RGSCH_FREE_MEM(rawCqiInd);
2307 } /* RgLiTfuRawCqiInd */
2310 * @brief SRS indication from PHY for an UE.
2314 * Function : RgLiTfuSrsInd
2316 * This API is invoked by PHY to send UL SRS indication to Scheduler
2317 * on receiving a SRS from UE.
2318 * This API contains SRS information recieved by PHY for an UE.
2320 * @param[in] Pst *pst
2321 * @param[in] SuId suId
2322 * @param[in] TfuSrsIndInfo *srsInd
2328 PUBLIC S16 RgLiTfuSrsInd
2332 TfuSrsIndInfo *srsInd
2335 PUBLIC S16 RgLiTfuSrsInd(pst, suId, srsInd)
2338 TfuSrsIndInfo *srsInd;
2342 Inst inst = pst->dstInst-SCH_INST_START;
2344 TRC3(RgLiTfuSrsInd);
2346 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2348 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed");
2349 /* Free up the memory for the request structure */
2350 RGSCH_FREE_MEM(srsInd);
2354 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2356 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2359 ret = rgSCHTomSrsInd (rgSchCb[inst].tfuSap[suId].cell, srsInd);
2360 /* Free up the memory for the request structure */
2361 RGSCH_FREE_MEM(srsInd);
2363 } /* RgLiTfuSrsInd */
2368 * @brief DOA indication from PHY for an UE.
2372 * Function : RgLiTfuDoaInd
2374 * This API is invoked by PHY to send Direction Of Arrival to Scheduler
2375 * on calculating DOA at PHYSICAL LAYER for an UE.
2376 * This API contains DOA information calculated by PHY for an UE.
2378 * @param[in] Pst *pst
2379 * @param[in] SuId suId
2380 * @param[in] TfuDoaIndInfo *doaInd
2386 PUBLIC S16 RgLiTfuDoaInd
2390 TfuDoaIndInfo *doaInd
2393 PUBLIC S16 RgLiTfuDoaInd(pst, suId, doaInd)
2396 TfuDoaIndInfo *doaInd;
2400 Inst inst = pst->dstInst-SCH_INST_START;
2402 TRC2(RgLiTfuDoaInd);
2404 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2406 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2407 /* Free up the memory for the request structure */
2408 RGSCH_FREE_MEM(doaInd);
2412 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2414 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2417 ret = rgSCHTomDoaInd (rgSchCb[inst].tfuSap[suId].cell, doaInd);
2418 /* Free up the memory for the request structure */
2419 RGSCH_FREE_MEM(doaInd);
2421 } /* RgLiTfuDlCqiInd */
2424 * @brief CRC indication from PHY.
2428 * Function : RgLiTfuCrcInd
2430 * This API is invoked by PHY to give CRC indication to scheduler.
2432 * @param[in] Pst *pst
2433 * @param[in] SuId suId
2434 * @param[in] TfuCrcIndInfo *crcInd
2440 PUBLIC S16 RgLiTfuCrcInd
2444 TfuCrcIndInfo *crcInd
2447 PUBLIC S16 RgLiTfuCrcInd (pst, suId, crcInd)
2450 TfuCrcIndInfo *crcInd;
2454 Inst inst = pst->dstInst-SCH_INST_START;
2456 TRC3(RgLiTfuCrcInd);
2457 #ifdef XEON_SPECIFIC_CHANGES
2458 struct timeval start6, end6;
2459 gettimeofday(&start6, NULL);
2462 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2464 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2465 RGSCH_FREE_MEM(crcInd);
2469 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2471 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2476 /* Now call the TOM (Tfu ownership module) primitive to process further */
2477 ret = rgSCHTomCrcInd(rgSchCb[inst].tfuSap[suId].cell, crcInd);
2478 /* Free up the memory for the request structure */
2479 RGSCH_FREE_MEM(crcInd);
2480 #ifdef XEON_SPECIFIC_CHANGES
2481 gettimeofday(&end6, NULL);
2484 } /* RgLiTfuCrcInd */
2487 * @brief Timing Advance indication from PHY.
2491 * Function : RgLiTfuTimingAdvInd
2493 * This API is invoked by PHY to indicate timing advance to Scheduler for
2496 * @param[in] Pst *pst
2497 * @param[in] SuId suId
2498 * @param[in] TfuTimingAdvIndInfo *timingAdvInd
2504 PUBLIC S16 RgLiTfuTimingAdvInd
2508 TfuTimingAdvIndInfo *timingAdvInd
2511 PUBLIC S16 RgLiTfuTimingAdvInd(pst, suId, timingAdvInd)
2514 TfuTimingAdvIndInfo *timingAdvInd;
2518 Inst inst = pst->dstInst-SCH_INST_START;
2520 TRC3(RgLiTfuTimingAdvInd);
2522 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2524 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2525 /* Free up the memory for the request structure */
2526 RGSCH_FREE_MEM(timingAdvInd);
2530 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2532 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2535 /* Now call the TOM (Tfu ownership module) primitive to process further */
2536 ret = rgSCHTomTimingAdvInd(rgSchCb[inst].tfuSap[suId].cell, timingAdvInd);
2537 /* Free up the memory for the request structure */
2538 RGSCH_FREE_MEM(timingAdvInd);
2540 } /* RgLiTfuTimingAdvInd */
2542 /************* RGM Interface ****************/
2544 * @brief API for bind request from RRM towards MAC.
2548 * Function: RgUiRgmBndReq
2550 * This API is invoked by RRM towards MAC to bind RGM SAP.
2551 * These API validates the Pst, spId, suId and sends the bind confirm to
2555 * @param[in] Pst *pst
2556 * @param[in] SuId suId
2557 * @param[in] SpId spId
2563 PUBLIC S16 RgUiRgmBndReq
2570 PUBLIC S16 RgUiRgmBndReq(pst, suId, spId)
2577 Pst tmpPst; /* Temporary Post Structure */
2578 Inst instId = pst->dstInst-SCH_INST_START;
2583 tmpPst.prior = pst->prior;
2584 tmpPst.route = pst->route;
2585 tmpPst.selector = pst->selector;
2586 tmpPst.region = rgSchCb[instId].rgSchInit.region;
2587 tmpPst.pool = rgSchCb[instId].rgSchInit.pool;
2589 tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId;
2590 tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent;
2591 tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + SCH_INST_START;
2593 tmpPst.event = EVTNONE;
2595 tmpPst.dstProcId = pst->srcProcId;
2596 tmpPst.dstEnt = pst->srcEnt;
2597 tmpPst.dstInst = pst->srcInst;
2599 /*TODO remove follo statement*/
2600 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
2602 if(spId < rgSchCb[instId].numSaps)
2604 /* Check the state of the SAP */
2605 switch (rgSchCb[instId].rgmSap[spId].sapSta.sapState)
2607 /* This case might not be needed if SAP not configured then it will go
2608 * to else of above if condition */
2609 case LRG_UNBND: /* SAP is not bound */
2610 RLOG0(L_DEBUG,"SAP is not yet bound");
2611 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_BND;
2612 rgSchCb[instId].rgmSap[spId].sapCfg.suId = suId;
2613 /* Send Bind Confirm with status as SUCCESS */
2614 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
2615 /*Indicate to Layer manager */
2617 case LRG_BND: /* SAP is already bound*/
2618 RLOG0(L_DEBUG,"SAP is already bound");
2619 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
2621 default: /* Should Never Enter here */
2622 #if (ERRCLASS & ERRCLS_ADD_RES)
2623 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001,
2624 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2625 "Invalid SAP State:RgUiRgmBndReq failed\n");
2627 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_NOK);
2633 #if (ERRCLASS & ERRCLS_ADD_RES)
2634 /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state
2635 to spId to avoid seg fault due to invalid sapID */
2636 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002,
2637 (ErrVal)spId, "Invalid SAP Id:RgUiRrmBndReq failed\n");
2639 ret = RgUiRgmBndCfm(&tmpPst, suId, CM_BND_NOK);
2642 } /* RgUiRgmBndReq */
2645 * @brief API for unbind request from RRM towards MAC.
2649 * Function: RgUiRgmUbndReq
2651 * This API is invoked by RRM towards MAC to unbind RGM SAP.
2652 * These API validates the Pst, spId, suId and transfers the unbind request
2653 * specific information to corresponding ownership module (GOM) API.
2656 * @param[in] Pst *pst
2657 * @param[in] SuId suId
2658 * @param[in] Reason reason
2664 PUBLIC S16 RgUiRgmUbndReq
2671 PUBLIC S16 RgUiRgmUbndReq(pst, spId, reason)
2677 Inst instId = pst->dstInst-SCH_INST_START;
2678 TRC3(RgUiRgmUbndReq)
2681 /* SAP Id validation */
2682 if (spId < rgSchCb[instId].numSaps)
2684 switch(rgSchCb[instId].rgmSap[spId].sapSta.sapState)
2686 case LRG_BND: /* SAP is already bound*/
2687 /* setting SAP state to UN BOUND */
2688 RLOG0(L_DEBUG,"SAP is already bound");
2689 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
2692 #if (ERRCLASS & ERRCLS_ADD_RES)
2693 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003,
2694 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2695 "Invalid SAP State: RgUiRgmUbndReq failed\n");
2702 #if (ERRCLASS & ERRCLS_ADD_RES)
2703 RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004,
2704 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2705 "Invalid SAP Id:RgUiRgmUbndReq failed\n");
2710 } /* RgUiRgmUbndReq */
2714 * @brief API for start or stop PRB reporting from RRM towards MAC.
2718 * Function: RgUiRgmCfgPrbRprt
2720 * This API is invoked by RRM towards MAC to start or stop calculating
2721 * Average PRB usage in downlink and uplink. The average PRB usage will
2722 * be reported to RRM based on confiured periodicity.
2725 * @param[in] Pst *pst
2726 * @param[in] SuId suId
2727 * @param[in] SpId spId
2733 PUBLIC S16 RgUiRgmCfgPrbRprt
2737 RgmPrbRprtCfg *prbRprtCfg
2740 PUBLIC S16 RgUiRgmCfgPrbRprt(pst, spId, prbRprtCfg)
2743 RgmPrbRprtCfg *prbRprtCfg;
2748 RgSchPrbUsage *prbUsage;
2749 Inst inst = (pst->dstInst - SCH_INST_START);
2751 TRC2(RgUiRgmCfgPrbRprt);
2752 cell = rgSchCb[inst].rgmSap[spId].cell;
2753 prbUsage = &cell->prbUsage;
2754 prbUsage->prbRprtEnabld = prbRprtCfg->bConfigType;
2755 prbUsage->rprtPeriod = prbRprtCfg->usPrbAvgPeriodicty;
2756 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, prbUsage->startTime, 1);
2758 /* clear the qciPrbRpts for all GBR QCIs */
2759 cmMemset((U8*)&prbUsage->qciPrbRpts[0], 0,
2760 (RGM_MAX_QCI_REPORTS * sizeof(RgSchQciPrbUsage)));
2762 RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
2763 "RgUiRgmCfgPrbRprt config type %d with the report period %d",
2764 prbUsage->prbRprtEnabld,prbUsage->rprtPeriod);
2766 /* ccpu00134393 : mem leak fix */
2767 SPutSBuf(pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
2772 * @brief ERROR INDICATION from PHY for the i failed unlicensed Scell transmission.
2776 * Function : RgLiTfuErrInd
2778 * This API is invoked by PHY to send ERROR INDICATION to scheduler
2779 * Currently invoked in the cases when the Unlicensed SCell transmission
2781 * This API contains the Cell and subframe information for which the
2782 * transmission failed.
2784 * @param[in] Pst *pst
2785 * @param[in] SuId suId
2786 * @param[in] TfuErrIndInfo *errIndInfo
2792 PUBLIC S16 RgLiTfuErrInd
2796 TfuErrIndInfo *errInd
2799 PUBLIC S16 RgLiTfuErrInd(pst, suId, errInd)
2802 TfuErrIndInfo *errInd;
2807 Inst inst = (pst->dstInst - SCH_INST_START);
2810 TRC3(RgLiTfuErrInd);
2813 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2816 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2820 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2822 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2828 /* Now call the TOM (Tfu ownership module) primitive to process further */
2829 ret = rgSCHLaaErrInd(rgSchCb[inst].tfuSap[suId].cell, errInd);
2832 } /* RgLiTfuErrInd */
2836 /**********************************************************************
2839 **********************************************************************/