-/***********************************************************
- *
- * Func : rgUpdtRguDedSts
- *
- * Desc : Utility Function to update rgu sap statistics for dedicated
- * DatReqs.
- *
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes:
- *
- * File : rg_utl.c
- *
- **********************************************************/
-#ifdef ANSI
-Void rgUpdtRguDedSts
-(
-Inst inst,
-RgUpSapCb *rguDlSap,
-U8 stsType, /* Statistics type to update */
-RgRguDedDatReq *datReq /* DatReq pointer */
-)
-#else
-Void rgUpdtRguDedSts(inst,rguDlSap,stsType, datReq)
-Inst inst;
-RgUpSapCb *rguDlSap;
-U8 stsType; /* Statistics type to update */
-RgRguDedDatReq *datReq; /* DatReq pointer */
-#endif
-{
- U8 idx1,idx2;
- U32 idx;
-
- switch(stsType)
- {
- case RG_RGU_SDU_RCVD:
- for(idx = 0; idx < datReq->nmbOfUeGrantPerTti; idx++)
- {
- RguDDatReqPerUe *datReqPerUe = &datReq->datReq[idx];
- for (idx1 = 0; idx1 < datReqPerUe->nmbOfTbs; idx1++)
- {
- for(idx2 = 0; idx2 < datReqPerUe->datReqTb[idx1].nmbLch; idx2++)
- {
- rguDlSap->sapSts.numPduRcvd +=
- datReqPerUe->datReqTb[idx1].lchData[idx2].pdu.numPdu;
- }
- }
- }
-
- break;
- case RG_RGU_SDU_DROP:
- for(idx = 0; idx < datReq->nmbOfUeGrantPerTti; idx++)
- {
- RguDDatReqPerUe *datReqPerUe = &datReq->datReq[idx];
- for (idx1 = 0; idx1 < datReqPerUe->nmbOfTbs; idx1++)
- {
- for(idx2 = 0; idx2 < datReqPerUe->datReqTb[idx1].nmbLch; idx2++)
- {
- rguDlSap->sapSts.numPduRcvd +=
- datReqPerUe->datReqTb[idx1].lchData[idx2].pdu.numPdu;
- rguDlSap->sapSts.numPduDrop +=
- datReqPerUe->datReqTb[idx1].lchData[idx2].pdu.numPdu;
- }
- }
- }
-
- break;
- }
-
- RETVOID;
-} /* rgUpdtRguDedSts */
-
-
-/***********************************************************
- *
- * Func : rgUpdtRguCmnSts
- *
- * Desc : Utility Function to update rgu sap statistics for common
- * DatReqs.
- *
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes:
- *
- * File : rg_utl.c
- *
- **********************************************************/
-#ifdef ANSI
-Void rgUpdtRguCmnSts
-(
-Inst inst,
-RgUpSapCb *rguDlSap,
-U8 stsType /* Statistics type to update */
-)
-#else
-Void rgUpdtRguCmnSts(inst,rguDlSap,stsType)
-Inst inst;
-RgUpSapCb *rguDlSap;
-U8 stsType; /* Statistics type to update */
-#endif
-{
-
- switch(stsType)
- {
- case RG_RGU_SDU_RCVD:
- rguDlSap->sapSts.numPduRcvd ++;
- break;
- case RG_RGU_SDU_DROP:
- rguDlSap->sapSts.numPduRcvd ++;
- rguDlSap->sapSts.numPduDrop ++;
- break;
- }
-
- RETVOID;
-} /* rgUpdtRguCmnSts */
-
-
-/***********************************************************
- *
- * Func : rgUpdtCellCnt
- *
- * Desc : Utility Function to update cell count. It gives number of active
- * cells
- *
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: This function should be called only after cell is added/deleted
- * from the globlal hashlist
- *
- * File : rg_utl.c
- *
- **********************************************************/
-#ifdef ANSI
-Void rgUpdtCellCnt
-(
-Inst inst,
-U8 updtType
-)
-#else
-Void rgUpdtCellCnt(inst,updtType)
-Inst inst;
-U8 updtType;
-#endif
-{
-
- switch (updtType)
- {
- case RG_CFG_ADD:
- rgCb[inst].genSts.numCellCfg++;
- break;
- case RG_CFG_DEL:
- rgCb[inst].genSts.numCellCfg--;
- break;
- default:
- break;
- }
-
- RETVOID;
-} /* rgUpdtCellCnt */
-
-
-/***********************************************************
- *
- * Func : rgUpdtUeCnt
- *
- * Desc : Utility Function to update ue count. It gives number of active
- * Ues.
- *
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: This function should be called only after ue is added/deleted
- * from the globlal hashlist
- *
- * File : rg_utl.c
- *
- **********************************************************/
-#ifdef ANSI
-Void rgUpdtUeCnt
-(
-Inst inst,
-U8 updtType
-)
-#else
-Void rgUpdtUeCnt (inst,updtType)
-Inst inst;
-U8 updtType;
-#endif
-{
- switch (updtType)
- {
- case RG_CFG_ADD:
- rgCb[inst].genSts.numUeCfg++;
- break;
- case RG_CFG_DEL:
- rgCb[inst].genSts.numUeCfg--;
- break;
- default:
- break;
- }
- RETVOID;
-} /* rgUpdtUeCnt */
-
-/*
-*
-* Fun: rgAllocEventMem
-*
-* Desc: This function allocates event memory
-*
-* Ret: ROK - on success
-* RFAILED - on failure
-*
-* Notes: None
-*
-* File: rg_utl.c
-*
-*/
-#ifdef ANSI
-S16 rgAllocEventMem
-(
-Inst inst,
-Ptr *memPtr,
-Size memSize
-)
-#else
-S16 rgAllocEventMem(inst,memPtr, memSize)
-Inst inst;
-Ptr *memPtr;
-Size memSize;
-#endif
-{
- Mem sMem;
- VOLATILE U32 startTime=0;
-
- sMem.region = rgCb[inst].rgInit.region;
- sMem.pool = rgCb[inst].rgInit.pool;
-
-#if (ERRCLASS & ERRCLS_DEBUG)
- if (memSize<= 0)
- {
- RGLOGERROR(inst,ERRCLS_INT_PAR, ERG031, memSize,
- "rgAllocEventMem(): memSize invalid\n");
- return (RFAILED);
- }
-#endif /* ERRCLASS & ERRCLS_DEBUG */
-
-
- /*starting Task*/
- SStartTask(&startTime, PID_MACUTL_CMALLCEVT);
-
-#ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */
- MS_BUF_ADD_ALLOC_CALLER();
-#endif /* */
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- if(ROK != cmAllocEvntNoInit(memSize, TFU_MAX_MEMBLK_SIZE, &sMem, memPtr))
-#else
- if(ROK != cmAllocEvnt(memSize, TFU_MAX_MEMBLK_SIZE, &sMem, memPtr))
-#endif /* */
- {
- RLOG0(L_ERROR,"cmAllocEvnt Failed");
- return RFAILED;
- }
-
- /*stoping Task*/
- SStopTask(startTime, PID_MACUTL_CMALLCEVT);
-
- return ROK;
-} /* end of rgAllocEventMem*/
-
-/*
-*
-* Fun: rgGetEventMem
-*
-* Desc: This function allocates event memory
-*
-* Ret: ROK - on success
-* RFAILED - on failure
-*
-* Notes: None
-*
-* File: rg_utl.c
-*
-*/
-#ifdef ANSI
-S16 rgGetEventMem
-(
-Inst inst,
-Ptr *ptr,
-Size len,
-Ptr memCp
-)
-#else
-S16 rgGetEventMem(inst,ptr, len, memCp)
-Inst inst;
-Ptr *ptr;
-Size len;
-Ptr memCp;
-#endif
-{
- S16 ret;
-
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- ret = cmGetMemNoInit(memCp, len, (Ptr *)ptr);
-#else
- ret = cmGetMem(memCp, len, (Ptr *)ptr);
-#endif /* */
- return (ret);
-} /* end of rgGetEventMem*/
-
-/***********************************************************
- *
- * Func : rgGetPstToInst
- *
- * Desc : Utility Function to get the pst structure to post a message to
- * scheduler instance
- *
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: This function should be called while sending a msg from
- * MAC to a scheduler instance
- *
- * File : rg_utl.c
- *
- **********************************************************/
-#ifdef ANSI
-Void rgGetPstToInst
-(
-Pst *pst,
-Inst srcInst,
-Inst dstInst
-)
-#else
-Void rgGetPstToInst (pst, srcInst, dstInst)
-Pst *pst;
-Inst srcInst;
-Inst dstInst;
-#endif
-{
-
- pst->srcEnt = rgCb[srcInst].rgInit.ent;
- pst->srcInst = rgCb[srcInst].rgInit.inst;
- pst->srcProcId = rgCb[srcInst].rgInit.procId;
- pst->region = rgCb[srcInst].rgInit.region;
- pst->pool = rgCb[srcInst].rgInit.pool;
-
- pst->dstProcId = rgCb[dstInst].rgInit.procId;
- pst->dstEnt = rgCb[dstInst].rgInit.ent;
- pst->dstInst = dstInst;
- pst->selector = 0;
- pst->prior = PRIOR0;
- pst->intfVer = 0;
- pst->route = RTESPEC;
-
- RETVOID;
-} /* end of rgGetPstToInst */
-
-/***********************************************************
- *
- * Func : RgSchMacLcgRegReq
- *
- * Desc : Utility Function to register the set of GBR LCG.
- * Invoked at the time of LCG configuration/Reconfiguration at Schedular.
- *
- * Processing Steps:
- * - Fetch the ueCb using the crnti given in lcInfo
- * - Store the if LCG is GBR or not.
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: This function should be called at the time of LCG
- * configuration/Reconfiguration at Schedular.
- *
- *
- * File : rg_utl.c
- *
- **********************************************************/
-#ifdef ANSI
-S16 RgSchMacLcgRegReq
-(
-Pst *pst,
-RgInfLcgRegReq *lcgRegReq
-)
-#else
-S16 RgSchMacLcgRegReq (pst, lcgRegReq)
-Pst *pst;
-RgInfLcgRegReq *lcgRegReq;
-#endif
-{
- Inst inst;
- RgCellCb *cell = NULLP;
- RgUeCb *ue;
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- cell = rgCb[inst].cell;
- /* Fetch the cell and then the UE */
- if((cell == NULLP) ||
- (cell->cellId != lcgRegReq->cellId))
- {
-
- RLOG_ARG0(L_ERROR,DBG_CELLID,lcgRegReq->cellId,"Cell does not exist ");
- return RFAILED;
- }
-
- if ((ue = rgDBMGetUeCb(cell, lcgRegReq->crnti)) == NULLP)
- {
- RLOG_ARG1(L_ERROR, DBG_CELLID,cell->cellId,"CRNTI:%d does not exist",
- lcgRegReq->crnti);
- return RFAILED;
- }
- ue->ul.lcgArr[lcgRegReq->lcgId].isGbr = lcgRegReq->isGbr;
-
- return ROK;
-} /* end of RgSchMacLcgRegReq */
-
-#ifdef LTEMAC_SPS
-
-/***********************************************************
- *
- * Func : RgSchMacUlSpsResetReq
- *
- * Desc : Utility Function to reset SPS params for a UE
- *
- * Processing Steps:
- * - Fetch the ueCb using the crnti
- * - reset implRelCnt and explRelCnt
- *
- * Ret : ROK
- * RFAILED
- *
- * File : rg_utl.c
- *
- **********************************************************/
-#ifdef ANSI
-S16 RgSchMacUlSpsResetReq
-(
-Pst *pst,
-RgInfUlSpsReset *ulSpsResetInfo
-)
-#else
-S16 RgSchMacUlSpsResetReq (pst, lcInfo)
-Pst *pst;
-RgInfUlSpsReset *ulSpsResetInfo;
-#endif
-{
- Inst inst;
- RgCellCb *cell = NULLP;
- RgUeCb *ue;
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- cell = rgCb[inst].cell;
- /* Fetch the cell and then the UE */
- if((cell == NULLP)||
- (cell->cellId != ulSpsResetInfo->cellId))
- {
-
- RLOG_ARG0(L_ERROR, DBG_CELLID,ulSpsResetInfo->cellId,"Cell does not exist ");
- return RFAILED;
- }
-
- if ((ue = rgDBMGetUeCb(cell, ulSpsResetInfo->crnti)) == NULLP)
- {
- RLOG_ARG1(L_ERROR, DBG_CELLID,cell->cellId,"CRNTI:%d does not exist",
- ulSpsResetInfo->crnti);
- return RFAILED;
- }
-
- ue->ul.implRelCntr = 0;
- ue->ul.explRelCntr = 0;
-
- return ROK;
-} /* end of RgSchMacUlSpsResetReq */
-
-
-
-
-/***********************************************************
- *
- * Func : RgSchMacSpsLcRegReq
- *
- * Desc : Utility Function to register the set of uplink SPS logical
- * channels for a SPS UE.
- * Invoked at the time of activation of a UE for UL-SPS.
- * Whenever there is data on these LCs MAC shall inform scheduler
- *
- * Processing Steps:
- * - Fetch the ueCb using the crnti given in lcInfo
- * - Store the sps-rnti and set the bits corresponding to the
- * logical channel ids in ueUlCb->spsLcMask.
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: This function should be called at the time UL SPS is activated
- * for a UE at scheduler
- *
- *
- * File : rg_utl.c
- *
- **********************************************************/
-#ifdef ANSI
-S16 RgSchMacSpsLcRegReq
-(
-Pst *pst,
-RgInfSpsLcInfo *lcInfo
-)
-#else
-S16 RgSchMacSpsLcRegReq (pst, lcInfo)
-Pst *pst;
-RgInfSpsLcInfo *lcInfo;
-#endif
-{
- Inst inst;
- RgCellCb *cell= NULLP;
- RgUeCb *ue;
- U8 idx;
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- cell = rgCb[inst].cell;
- /* Fetch the cell and then the UE */
- if((cell == NULLP) ||
- (cell->cellId != lcInfo->cellId))
- {
-
- RLOG_ARG0(L_ERROR,DBG_CELLID,lcInfo->cellId, "Cell does not exist ");
- return RFAILED;
- }
-
- if ((ue = rgDBMGetUeCb(cell, lcInfo->crnti)) == NULLP)
- {
- RLOG_ARG1(L_ERROR, DBG_CELLID,cell->cellId,"CRNTI:%d does not exist",
- lcInfo->crnti);
- return RFAILED;
- }
-
- /* Store the sps-rnti and SPS LC information in the UE */
- ue->spsRnti = lcInfo->spsRnti;
- for (idx=0; idx < lcInfo->spsLcCnt; idx++)
- {
- /* KWORK_FIX: Modified the index from lcId to lcId-1 for handling lcId 10 properly */
- ue->ul.spsLcId[(lcInfo->spsLcId[idx])-1] = TRUE;
- }
- ue->ul.implRelCnt = lcInfo->implRelCnt;
- ue->ul.explRelCnt = ue->ul.implRelCnt + 1; /*(lcInfo->implRelCnt * lcInfo->spsPrd);*/
-
- /* Insert the UE into SPS UE List */
- if (rgDBMInsSpsUeCb(cell, ue) == RFAILED)
- {
- RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
- "Ue insertion into SPS list failed SPS CRNTI:%d", ue->spsRnti);
- return RFAILED;
- }
-
- return ROK;
-} /* end of RgSchMacSpsLcRegReq */
-
-
-/***********************************************************
- *
- * Func : RgSchMacSpsLcDeregReq
- *
- * Desc : Utility Function to deregister the set of uplink SPS
- * logical channels for a UE.
- * Invoked at the time of release of UL-SPS for an activated UE.
- *
- * Processing Steps:
- * - Fetch the ueCb using the crnti given
- * - Reset the bits corresponding to the logical channel ids in
- * ueUlCb->spsLcMask.
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: This function should be called at the time UL SPS is released
- * for a UE at scheduler
- *
- *
- * File : rg_utl.c
- *
- **********************************************************/
-#ifdef ANSI
-S16 RgSchMacSpsLcDeregReq
-(
-Pst *pst,
-CmLteCellId cellId,
-CmLteRnti crnti
-)
-#else
-S16 RgSchMacSpsLcDeregReq (pst, cellId, crnti)
-Pst *pst;
-CmLteCellId cellId;
-CmLteRnti crnti;
-#endif
-{
- Inst inst;
- RgCellCb *cell = NULLP;
- RgUeCb *ue;
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- cell = rgCb[inst].cell;
- /* Fetch the cell and then the UE */
- if((cell == NULLP) ||
- (cell->cellId != cellId))
- {
-
- RLOG_ARG0(L_ERROR,DBG_CELLID,cellId, "Cell does not exist ");
- return RFAILED;
- }
-
- if ((ue = rgDBMGetUeCb(cell, crnti)) == NULLP)
- {
- RLOG_ARG1(L_ERROR, DBG_CELLID,cellId,"CRNTI:%d Ue does not exist", crnti);
- return RFAILED;
- }
-
- /* No need to reset the SPS LC Ids as they will not be looked at*/
-
- /* Delete UE from the SPS UE List */
- rgDBMDelSpsUeCb(cell, ue);
-
- return ROK;
-} /* end of RgSchMacSpsLcDeregReq */
-
-#endif /* LTEMAC_SPS */
-
-/**
- * @brief Function for handling CRNTI change request
- * received from scheduler to MAC.
- *
- * @details
- *
- * Function : rgUtlHndlCrntiChng
- *
- * - Delete old UE from the list.
- * - Update the new rnti and re-insert the UE in the list.
- *
- *
- * @param[in] Inst inst
- * @param[in] RgCellCb *cell,
- * @param[in] CmLteRnti rnti,
- * @param[in] CmLteRnti newRnti
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-#ifdef ANSI
-PRIVATE S16 rgUtlHndlCrntiChng
-(
-Inst inst,
-RgCellCb *cell,
-CmLteRnti rnti,
-CmLteRnti newRnti
-)
-#else
-PRIVATE S16 rgUtlHndlCrntiChng(inst,cell, rnti, newRnti)
-Inst inst;
-RgCellCb *cell;
-CmLteRnti rnti;
-CmLteRnti newRnti;
-#endif
-{
- RgUeCb *ue = NULLP;
- RgUeCb *newUe = NULLP;
-
- ue = rgDBMGetUeCb(cell, rnti);
- newUe = rgDBMGetUeCbFromRachLst(cell, newRnti);
- if ((ue == NULLP) || (newUe == NULLP))
- {
- RLOG_ARG4(L_ERROR,DBG_CELLID,cell->cellId,
- "RNTI:%d Failed to get UECB[%lu:%lu] or NEW RNTI:%d",
- rnti, ((PTR)ue), ((PTR)newUe), newRnti);
- return RFAILED;
- }
-#ifdef XEON_SPECIFIC_CHANGES
- CM_LOG_DEBUG(CM_LOG_ID_MAC, "MAC:UE[%d] id changed to %d\n", rnti, newRnti);
-#endif
- rgDBMDelUeCb(cell, ue);
-
- ue->ueId = newRnti;
-
- memcpy(&(ue->contResId), &(newUe->contResId),
- sizeof(newUe->contResId));
- /* Fix : syed MSG4 might be RETXing need to store the
- * HARQ context. */
- rgDHMFreeUe(inst,&ue->dl.hqEnt);
- ue->dl.hqEnt = newUe->dl.hqEnt;
-
- rgDBMInsUeCb(cell, ue);
-
- rgDBMDelUeCbFromRachLst(cell, newUe);
- rgFreeSBuf(inst,(Data **)&newUe, sizeof(*newUe));
-
- return ROK;
-} /* end of rgUtlHndlCrntiChng */
-
-#ifdef LTE_ADV
-/**
- * @brief Function for handling UE release for SCELL
- * triggered from SCH to MAC.
- *
- * @details
- *
- * Function : rgDelUeFrmAllSCell
- *
- * - This Function should be invoked by PCell of UE
- * - Remove the UE context from SCELL corresponding to rnti.
- *
- * @param[in] Inst *macInst,
- * @param[in] RgUeCb *ue
- * @return ROK is SUCCESS
- **/
-#ifdef ANSI
-S16 rgDelUeFrmAllSCell
-(
-RgCellCb *cell,
-RgUeCb *ue
-)
-#else
-S16 rgDelUeFrmAllSCell(cell, ue)
-RgCellCb *cell;
-RgUeCb *ue;
-#endif
-{
- Inst inst = cell->macInst - RG_INST_START;
- U8 idx = 0;
- Inst sCellInstIdx;
- Pst dstInstPst;
- RgPrgUeSCellDelInfo ueSCellDelInfo;
-
- /* To Delete the SCells if exisits for that UE */
- for(idx = 0; idx < RG_MAX_SCELL_PER_UE ; idx++)
- {
- if(TRUE == ue->sCelInfo[idx].isSCellAdded)
- {
- sCellInstIdx = ue->sCelInfo[idx].macInst - RG_INST_START;
-
- rgGetPstToInst(&dstInstPst, inst, sCellInstIdx);
- ueSCellDelInfo.ueId = ue->ueId;
- ueSCellDelInfo.sCellId = ue->sCelInfo[idx].sCellId;
-
- /* Filling same ueId in newRnti so that SMAC will check if newRnti
- *and old UeId is same that means its a UeSCell delete request*/
- ueSCellDelInfo.newRnti = ue->ueId;
-
- RgPrgPMacSMacUeSCellDel(&dstInstPst, &ueSCellDelInfo);
- ue->sCelInfo[idx].isSCellAdded = FALSE;
- } /* loop of if */
- } /* loop of for */
-
- return ROK;
-} /* rgDelUeFrmAllSCell */
-
-/**
- * @brief Function to validate AddSCellCfg.
- *
- * @details
- *
- * Function : rgUtlVltdAddSCellCfg
- *
- *
- * @param[in] ueSCellCb secondary cell CB for validation
- * @param[in] cell cell control block
- * @param[in] inst instance number to fetch rgCb instance
- * @return S16
- * -# ROK
- **/
-#ifdef ANSI
-S16 rgUtlVltdAddSCellCfg
-(
- RgPrgUeSCellCfgInfo *ueSCellCb,
- RgCellCb *cell,
- Inst inst
-)
-#else
-S16 rgUtlVltdAddSCellCfg(ueSCellCb, cell, inst)
- RgPrgUeSCellCfgInfo *ueSCellCb;
- RgCellCb *cell;
- Inst inst;
-#endif
-{
- S16 ret = ROK;
-
- /* To Validate the CellID presence */
- if((cell == NULLP) ||
- (cell->cellId != ueSCellCb->cellId))
- {
- RGDBGERRNEW(inst, (rgPBuf(inst),
- "[%d]Sec Cell does not exit %d\n",
- ueSCellCb->ueId, ueSCellCb->cellId));
- ret = RFAILED;
- }
-#ifdef TENB_MULT_CELL_SUPPRT
- if((ueSCellCb->rguDlSapId > rgCb[inst].numRguSaps) ||
- (ueSCellCb->rguUlSapId > rgCb[inst].numRguSaps))
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "Invald Sap Id: DL %d UL %d for ueId %d failed\n",
- ueSCellCb->rguDlSapId,
- ueSCellCb->rguUlSapId,
- ueSCellCb->cellId));
- ret = RFAILED;
- }
-#endif
- return (ret);
-} /* rgUtlVltdAddSCellCfg */
-
-/**
- * @brief Function to build CrntiChangeReq and send to all SMACs.
- *
- * @details
- *
- * Function : rgUtlSndCrntiChngReq2AllSMacs
- *
- * - This Function should be invoked by PCell of UE
- * - It sends RgPrgPMacSMacUeSCellDelReq to all SMACs with newRnti sent
- * by SCH. SMAC will check if newRnti is not equal to old UeId then it
- * do only UeId change else it will delete the UeScell context
- *
- * @param[in] cell Cell CB to get Ue control block
- * @param[in] rnti Ue Identifier used to fill in UeId Change req
- * @param[in] newRnti UE new identifier, to be used in UeId Change req
- * @return S16
- * -# ROK
- **/
-#ifdef ANSI
-PRIVATE S16 rgUtlSndCrntiChngReq2AllSMacs
-(
-RgCellCb *cell,
-CmLteRnti rnti,
-CmLteRnti newRnti
-)
-#else
-PRIVATE S16 rgUtlSndCrntiChngReq2AllSMacs(cell, rnti, newRnti)
-RgCellCb *cell;
-CmLteRnti rnti;
-CmLteRnti newRnti;
-#endif
-{
- Inst inst = cell->macInst - RG_INST_START;
- Inst sCellInstIdx;
- Pst dstInstPst;
- RgPrgUeSCellDelInfo ueIdChngReq;
- RgUeCb *ue;
- U8 idx;
-#ifdef L2_OPTMZ
-TfuDelDatReqInfo delDatReq;
-#endif
-
- /* use newRnti to get UeCb in PMac because rnti is already changed in PMac*/
- ue = rgDBMGetUeCb(cell, newRnti);
- if (ue == NULLP)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst),"[%d]RNTI:Failed to get ueCb \
- newRnti=%d\n", rnti, newRnti));
- return RFAILED;
- }
- /* For all added SCells, prepare and send ueIdChngReq */
- for(idx = 0; idx < RG_MAX_SCELL_PER_UE ; idx++)
- {
- if(TRUE == ue->sCelInfo[idx].isSCellAdded)
- {
- sCellInstIdx = ue->sCelInfo[idx].macInst - RG_INST_START;
-
- rgGetPstToInst(&dstInstPst, inst, sCellInstIdx);
- /* fill old rnti*/
- ueIdChngReq.ueId = rnti;
- ueIdChngReq.sCellId = ue->sCelInfo[idx].sCellId;
-
- /* Filling newRnti so that SMAC can check if old ueId and new UeId
- *(newRnti) is different then its a UeId change request from PMAC.
- * RgPrgPMacSMacUeSCellDelReq is being reused for UeId change req
- * from PMAC to SMAC*/
- ueIdChngReq.newRnti = newRnti;
-
- /* Re-using UeSCellDelReq API for UeId change*/
- RgPrgPMacSMacUeSCellDel(&dstInstPst, &ueIdChngReq);
-#ifdef L2_OPTMZ
- /* Sending delDatReq to CL to clear the Pdus for old UeId present in CL*/
- delDatReq.cellId = ueIdChngReq.sCellId;
- delDatReq.ueId = ueIdChngReq.ueId;
- rgLIMTfuDelDatReq(sCellInstIdx, &delDatReq);
-#endif
-
- } /* loop of if */
- } /* loop of for */
-
- return ROK;
-} /* rgUtlSndCrntiChngReq2AllSMacs */
-
-#endif /* LTE_ADV */
-
-/**
- * @brief Function for handling CRNTI Context release
- * triggered from SCH to MAC.
- *
- * @details
- *
- * Function : rgUtlHndlCrntiRls
- *
- * - Remove the UE context from MAC corresponding to rnti.
- *
- *
- * @param[in] RgCellCb *cell,
- * @param[in] CmLteRnti rnti
- * @return Void
- **/
-#ifdef ANSI
-PRIVATE Void rgUtlHndlCrntiRls
-(
-RgCellCb *cell,
-RgInfRlsRnti *rlsRnti
-)
-#else
-PRIVATE Void rgUtlHndlCrntiRls(cell, rlsRnti)
-RgCellCb *cell;
-CmLteRnti *rlsRnti;
-#endif
-{
- Inst inst = cell->macInst - RG_INST_START;
- RgUeCb *ue = NULLP;
-#ifdef LTEMAC_SPS
- RgUeCb *spsUeCb = NULLP;
-#endif
-
- if ((ue = rgDBMGetUeCb(cell, rlsRnti->rnti)) == NULLP)
- {
- /* Check in RachLst */
- if((ue=rgDBMGetUeCbFromRachLst (cell, rlsRnti->rnti)) != NULLP)
- {
- /* Delete Ue from the UE list */
- rgDBMDelUeCbFromRachLst(cell, ue);
-
- /* Free Ue */
- rgRAMFreeUeCb(inst,ue);
- }
- else
- {
- RLOG_ARG1(L_WARNING,DBG_CELLID,cell->cellId,
- "RNTI:%d No ueCb found in RachLst",rlsRnti->rnti);
- }
- }
- else
- {
-#ifdef LTE_ADV
- if(FALSE == rlsRnti->isUeSCellDel)
- {
- rgDelUeFrmAllSCell(cell, ue);
- }
-#endif /* LTE_ADV */
-
- /* Delete Ue from the UE list */
- rgDBMDelUeCb(cell, ue);
-#ifdef LTEMAC_SPS
- spsUeCb = rgDBMGetSpsUeCb (cell, ue->spsRnti);
- if (spsUeCb)
- {
- rgDBMDelSpsUeCb(cell, spsUeCb);
- }
-#endif
-
- /* Free Ue */
- rgCFGFreeUeCb(cell, ue);
- /* MS_REMOVE : syed Check in RachLst */
- {
- if((ue=rgDBMGetUeCbFromRachLst (cell, rlsRnti->rnti)) != NULLP)
- {
- RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
- "RNTI:%d STALE UE is still present", rlsRnti->rnti);
- }
- }
- }
-
- RETVOID;
-} /* end of rgUtlHndlCrntiRls */
-
-/**
- * @brief Function for handling RaResp request received from scheduler to MAC.
- *
- * @details
- *
- * Function : RgSchMacRlsRntiReq
- *
- * This function shall be invoked whenever scheduler is done with the
- * allocations of random access responses for a subframe.
- * This shall invoke RAM to create ueCbs for all the rapIds allocated and
- * shall invoke MUX to create RAR PDUs for raRntis allocated.
- *
- *
- * @param[in] CmLteCellId cellId,
- * @param[in] CmLteTimingInfo timingInfo,
- * @param[in] RaRespInfo *rarInfo
- * @return S16
- * -# ROK
- **/
-#ifdef ANSI
-S16 RgSchMacRlsRntiReq
-(
-Pst *pst,
-RgInfRlsRnti *rlsRnti
-)
-#else
-S16 RgSchMacRlsRntiReq(pst, rlsRnti)
-Pst *pst;
-RgInfRlsRnti *rlsRnti;
-#endif
-{
-// Pst schPst;
-// RgInfUeDelInd ueDelInd;
- Inst macInst;
- RgCellCb *cell;
-#ifdef L2_OPTMZ
-TfuDelDatReqInfo delDatReq;
-#endif
-
- RG_IS_INST_VALID(pst->dstInst);
- macInst = pst->dstInst - RG_INST_START;
- cell = rgCb[macInst].cell;
-
- if(NULLP == rlsRnti)
- {
- return RFAILED;
- }
-
- if((cell == NULLP) ||
- (cell->cellId != rlsRnti->cellId))
- {
-
- RLOG_ARG1(L_ERROR,DBG_CELLID,rlsRnti->cellId,
- "No cellCb found with cellId for RNTI:%d",
- rlsRnti->rnti);
- return RFAILED;
- }
- /* Fix : syed Clearing UE context when SCH indicates to do so
- * UE DEL from CRG interface is now dummy. */
- if (rlsRnti->ueIdChng)
- {
- /* Fix : syed ueId change as part of reestablishment.
- * Now SCH to trigger this. CRG ueRecfg for ueId change
- * is dummy */
- if (rgUtlHndlCrntiChng(macInst,cell, rlsRnti->rnti, rlsRnti->newRnti) != ROK)
- {
- RLOG_ARG2(L_ERROR,DBG_CELLID,rlsRnti->cellId,
- "CRNTI change failed for RNTI:%d new RNTI:%d",
- rlsRnti->rnti,rlsRnti->newRnti);
- return RFAILED;
- }
-
-#ifdef LTE_ADV
- /*PMAC_Reest: Prepare CrntiChngReq and then send to all SMACs to change
- *rnti in all Scells
- */
- if(rgUtlSndCrntiChngReq2AllSMacs(cell, rlsRnti->rnti, rlsRnti->newRnti) != ROK)
- {
- /* TODO: do we need to send DelInd to SCH in failure case*/
- return RFAILED;
- }
-#endif
-#ifdef L2_OPTMZ
- /* Sending delDatReq to CL to clear the Pdus for old UeId present in CL*/
- delDatReq.cellId = cell->cellId;
- delDatReq.ueId = rlsRnti->rnti;
- rgLIMTfuDelDatReq(macInst, &delDatReq);
-#endif
- }
- else
- {
- rgUtlHndlCrntiRls(cell, rlsRnti);
- }
- /* Fix : syed Send delete confirmation to SCH */
- /* Send RgMacSchUeDelInd to SCH only if it is Rnti release to PMAC.
- * Basically dont send DelInd to SCH incase of Ue SCell Del*/
-#ifdef LTE_ADV
- if(FALSE == rlsRnti->isUeSCellDel)
-#endif
- {
- //TODO: commented for compilation without SCH
-#if 0
- ueDelInd.cellSapId = cell->schInstMap.cellSapId;
- ueDelInd.cellId = rlsRnti->cellId;
- ueDelInd.rnti = rlsRnti->rnti;
- rgGetPstToInst(&schPst,macInst, cell->schInstMap.schInst);
- RgMacSchUeDel(&schPst, &ueDelInd);
-#endif
- }
-
- return ROK;
-} /* end of RgSchMacRlsRntiReq */
-
-#ifdef L2_OPTMZ
-#ifdef ANSI
-Bool RgUtlIsTbMuxed
-(
- TfuDatReqTbInfo *tb
-)
-#else
-Bool RgUtlIsTbMuxed()
- TfuDatReqTbInfo *tb
-#endif
-{
- MsgLen len = 0;
- SFndLenMsg(tb->macHdr, &len);
- return (len?TRUE : FALSE);
-}
-#endif
-