X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Frg_tom.c;h=ed398399f97e285028c4a706e928d838267393a5;hb=de6a435729e3cad9d4a66329080b8206a64f452c;hp=82cca80955be35de0df495ad62c7a01723e78476;hpb=5d74fef7c9fe6b65a965ceac6bfe812872dab323;p=o-du%2Fl2.git diff --git a/src/5gnrmac/rg_tom.c b/src/5gnrmac/rg_tom.c index 82cca8095..ed398399f 100755 --- a/src/5gnrmac/rg_tom.c +++ b/src/5gnrmac/rg_tom.c @@ -28,9 +28,6 @@ **********************************************************************/ -static const char* RLOG_MODULE_NAME="MAC"; -static int RLOG_FILE_ID=237; -static int RLOG_MODULE_ID=4096; /** @file rg_tom.c @brief This module does processing related to handling of lower interface APIs invoked by PHY towards MAC @@ -63,28 +60,28 @@ invoked by PHY towards MAC /* ADD Changes for Downlink UE Timing Optimization */ #ifndef LTEMAC_DLUE_TMGOPTMZ -PRIVATE S16 rgTOMUtlProcDlSf ARGS(( RgDlSf *dlSf, RgCellCb *cellCb, +static S16 rgTOMUtlProcDlSf ARGS(( RgDlSf *dlSf, RgCellCb *cellCb, RgErrInfo *err)); #else S16 rgTOMUtlProcDlSf ARGS((RgDlSf *dlSf, RgCellCb *cellCb, RgErrInfo *err)); #endif -PRIVATE S16 rgTOMProcCrntiCEInDatInd ARGS(( +static S16 rgTOMProcCrntiCEInDatInd ARGS(( RgMacPdu *pdu, RgUeCb *prevUeCb, RgCellCb *cellCb, TfuDatInfo *datInfo, RgInfCeInfo *ceInfo, -U16 slot +uint16_t slot )); -PRIVATE S16 rgTOMProcCCCHSduInDatInd ARGS(( +static S16 rgTOMProcCCCHSduInDatInd ARGS(( RgMacPdu *pdu, RgUeCb *prevUeCb, RgCellCb *cellCb, TfuDatInfo *datInfo, RgInfCeInfo *ceInfo, -U16 slot +uint16_t slot )); S16 rgHndlFlowCntrl @@ -93,27 +90,27 @@ RgCellCb *cell, RgInfSfAlloc *sfInfo ); -EXTERN S16 RgUiRguFlowCntrlInd(Pst* pst, SuId suId, RguFlowCntrlInd *flowCntrlInd); +S16 RgUiRguFlowCntrlInd(Pst* pst, SuId suId, RguFlowCntrlInd *flowCntrlInd); #ifdef EMTC_ENABLE -EXTERN S16 rgEmtcHndl(RgCellCb *cell,RgInfSfAlloc *sfInfo); -EXTERN S16 rgTOMEmtcUtlFillDatReqPdus(TfuDatReqInfo *datInfo, RgDlSf *dlSf, RgCellCb *cell, RgErrInfo *err); -EXTERN Void rgTOMEmtcRlsSf(RgDlSf *dlSf); +S16 rgEmtcHndl(RgCellCb *cell,RgInfSfAlloc *sfInfo); +S16 rgTOMEmtcUtlFillDatReqPdus(TfuDatReqInfo *datInfo, RgDlSf *dlSf, RgCellCb *cell, RgErrInfo *err); +Void rgTOMEmtcRlsSf(RgDlSf *dlSf); #endif #ifdef LTE_L2_MEAS -PRIVATE Void rgTOML2MCompileActiveLCs ARGS +static Void rgTOML2MCompileActiveLCs ARGS (( RgCellCb *cellCb, RgUeCb *ueCb, RgMacPdu *pdu, RgInfCeInfo *ceInfo )); -PRIVATE S16 rgTOMUtlL2MStoreBufSz ARGS +static S16 rgTOMUtlL2MStoreBufSz ARGS (( RgUeCb *ueCb, RgInfCeInfo *ceInfo )); -PRIVATE S16 rgTomUtlPrepareL2MUlThrpInfo ARGS +static S16 rgTomUtlPrepareL2MUlThrpInfo ARGS (( RgCellCb *cellCb, RgUeCb *ueCb, @@ -126,7 +123,7 @@ PRIVATE S16 rgTomUtlPrepareL2MUlThrpInfo ARGS TB, which is not guaranteed if higher Range values are used */ /* Note: taking value 10 for BSR index 1 */ #ifndef MAC_5GTF_UPDATE -PRIVATE U32 rgLwrBsrTbl[64] = { +static uint32_t rgLwrBsrTbl[64] = { 0, 10, 10, 12, 14, 17, 19, 22, 26, 31, 36, 42, 49, 57, 67, 78, 91, 107, 125, 146, 171, 200, 234, 274, 321, @@ -138,7 +135,7 @@ PRIVATE U32 rgLwrBsrTbl[64] = { }; #else -PRIVATE U32 rgLwrBsrTbl[64] = { +static uint32_t rgLwrBsrTbl[64] = { 0,10,13,16,19,23,29,35,43,53,65,80,98,120,147,181,223,274,337,414, 509,625,769,945,1162,1429,1757,2161,2657,3267,4017,4940,6074,7469, 9185,11294,13888,17077,20999,25822,31752,39045,48012,59039,72598, @@ -156,9 +153,9 @@ PRIVATE U32 rgLwrBsrTbl[64] = { } /* global variables */ -U32 rgUlrate_tfu; +uint32_t rgUlrate_tfu; #ifdef EMTC_ENABLE -EXTERN U32 grgUlrate_tfu; +uint32_t grgUlrate_tfu; #endif /** @brief This function fills the PDSCH data of a downlink subframe @@ -181,45 +178,31 @@ EXTERN U32 grgUlrate_tfu; * -# ROK * -# RFAILED */ -#ifdef ANSI -PRIVATE S16 rgTOMUtlFillDatReqPdus -( - TfuDatReqInfo *datInfo, - RgDlSf *dlSf, - RgCellCb *cellCb, - RgErrInfo *err - ) -#else -PRIVATE S16 rgTOMUtlFillDatReqPdus(datInfo, dlSf, cellCb, err) - TfuDatReqInfo *datInfo; - RgDlSf *dlSf; - RgCellCb *cellCb; - RgErrInfo *err; -#endif +static S16 rgTOMUtlFillDatReqPdus (TfuDatReqInfo *datInfo,RgDlSf *dlSf,RgCellCb *cellCb, RgErrInfo *err) { S16 ret; TfuDatReqPduInfo *datReq=NULLP; - /* Moving node declaration to limited scope for optimization */ + /* Moving node declaration to limited scope for optimization */ RgDlHqProcCb *hqCb; - U8 idx; + uint8_t idx; Inst inst = cellCb->macInst - RG_INST_START; - /* first lets send the BCCH data down to PHY */ + /* first lets send the BCCH data down to PHY */ if (dlSf->bcch.tb != NULLP) { if ((ret = rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo), - &(datInfo->memCp))) != ROK) + &(datInfo->memCp))) != ROK) { - err->errCause = RGERR_TOM_MEM_EXHAUST; - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Memory Exhaustion "); - return (ret); + err->errCause = RGERR_TOM_MEM_EXHAUST; + DU_LOG("\nERROR --> MAC : Memory Exhaustion "); + return (ret); } #ifdef TFU_ALLOC_EVENT_NO_INIT #ifndef L2_OPTMZ datReq->mBuf[1] = 0; #else - datReq->tbInfo[0].lchInfo[0].mBuf[0]=NULLP; + datReq->tbInfo[0].lchInfo[0].mBuf[0]=NULLP; #endif #endif datReq->rnti = RG_SI_RNTI; @@ -255,11 +238,11 @@ PRIVATE S16 rgTOMUtlFillDatReqPdus(datInfo, dlSf, cellCb, err) if (dlSf->pcch.tb != NULLP) { if ((ret = rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo), - &(datInfo->memCp))) != ROK) + &(datInfo->memCp))) != ROK) { - err->errCause = RGERR_TOM_MEM_EXHAUST; - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Memory Exhaustion CRNTI:%d",datReq->rnti); - return (ret); + err->errCause = RGERR_TOM_MEM_EXHAUST; + DU_LOG("\nERROR --> MAC : Memory Exhaustion CRNTI:%d",datReq->rnti); + return (ret); } #ifdef TFU_ALLOC_EVENT_NO_INIT #ifndef L2_OPTMZ @@ -294,12 +277,12 @@ PRIVATE S16 rgTOMUtlFillDatReqPdus(datInfo, dlSf, cellCb, err) for(idx=0; idx < dlSf->numRaRsp; idx++) { if ((ret = rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo), - &(datInfo->memCp))) != ROK) + &(datInfo->memCp))) != ROK) { - err->errCause = RGERR_TOM_MEM_EXHAUST; - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Memory Exhaustion CRNTI:%d", - datReq->rnti); - return (ret); + err->errCause = RGERR_TOM_MEM_EXHAUST; + DU_LOG("\nERROR --> MAC : Memory Exhaustion CRNTI:%d", + datReq->rnti); + return (ret); } #ifdef TFU_ALLOC_EVENT_NO_INIT #ifndef L2_OPTMZ @@ -321,7 +304,7 @@ PRIVATE S16 rgTOMUtlFillDatReqPdus(datInfo, dlSf, cellCb, err) #endif datReq->tbInfo[0].numLch = 1; datReq->tbInfo[0].lchInfo[0].numPdu = 1; - // prc_trace_format_string(0x40,3,"UE Id=(%d) tbSz=(%d)",datReq->rnti, datReq->tbInfo[0].tbSize); + // prc_trace_format_string(0x40,3,"UE Id=(%d) tbSz=(%d)",datReq->rnti, datReq->tbInfo[0].tbSize); #endif cmLListAdd2Tail(&datInfo->pdus, &(datReq->lnk)); datReq->lnk.node = (PTR)datReq; @@ -338,15 +321,14 @@ PRIVATE S16 rgTOMUtlFillDatReqPdus(datInfo, dlSf, cellCb, err) CmLList *node; while (dlSf->tbs.first) { - node = dlSf->tbs.first; - hqCb = (RgDlHqProcCb*)node->node; - if ((ret = rgDHMSndDatReq (cellCb, dlSf, datInfo, hqCb, err)) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId, - "DHM unable to fill DATA request"); - err->errType = RGERR_TOM_TTIIND; - continue; - } + node = dlSf->tbs.first; + hqCb = (RgDlHqProcCb*)node->node; + if ((ret = rgDHMSndDatReq (cellCb, dlSf, datInfo, hqCb, err)) != ROK) + { + DU_LOG("\nERROR --> MAC : DHM unable to fill DATA request"); + err->errType = RGERR_TOM_TTIIND; + continue; + } } /* end of while */ } @@ -371,33 +353,9 @@ PRIVATE S16 rgTOMUtlFillDatReqPdus(datInfo, dlSf, cellCb, err) */ /* ADD Changes for Downlink UE Timing Optimization */ #ifndef LTEMAC_DLUE_TMGOPTMZ -#ifdef ANSI -PRIVATE S16 rgTOMUtlProcDlSf -( - RgDlSf *dlSf, - RgCellCb *cellCb, - RgErrInfo *err - ) -#else -PRIVATE S16 rgTOMUtlProcDlSf (dlSf, cellCb, err) - RgDlSf *dlSf; - RgCellCb *cellCb; - RgErrInfo *err; -#endif +static S16 rgTOMUtlProcDlSf(RgDlSf *dlSf,RgCellCb *cellCb,RgErrInfo *err) #else -#ifdef ANSI -S16 rgTOMUtlProcDlSf -( - RgDlSf *dlSf, - RgCellCb *cellCb, - RgErrInfo *err - ) -#else -S16 rgTOMUtlProcDlSf (dlSf, cellCb, err) - RgDlSf *dlSf; - RgCellCb *cellCb; - RgErrInfo *err; -#endif +S16 rgTOMUtlProcDlSf(RgDlSf *dlSf,RgCellCb *cellCb,RgErrInfo *err) #endif { S16 ret; @@ -407,9 +365,9 @@ S16 rgTOMUtlProcDlSf (dlSf, cellCb, err) /* Fill Data Request Info from scheduler to PHY */ if ((ret = rgAllocEventMem(inst,(Ptr *)&datInfo, - sizeof(TfuDatReqInfo))) != ROK) + sizeof(TfuDatReqInfo))) != ROK) { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to Allocate TfuDatReqInfo"); + DU_LOG("\nERROR --> MAC : Unable to Allocate TfuDatReqInfo"); return (ret); } else @@ -423,7 +381,7 @@ S16 rgTOMUtlProcDlSf (dlSf, cellCb, err) datInfo->cellId = cellCb->cellId; if((0 == (datInfo->timingInfo.sfn % 30)) && (0 == datInfo->timingInfo.slot)) { - //printf("5GTF_CHECK rgTOMUtlProcDlSf dat (%d : %d)\n", datInfo->timingInfo.sfn, datInfo->timingInfo.slot); + //DU_LOG("5GTF_CHECK rgTOMUtlProcDlSf dat (%d : %d)\n", datInfo->timingInfo.sfn, datInfo->timingInfo.slot); } #ifdef TFU_ALLOC_EVENT_NO_INIT datInfo->bchDat.pres = 0; @@ -432,43 +390,43 @@ S16 rgTOMUtlProcDlSf (dlSf, cellCb, err) /* Fill BCH data */ if (dlSf->bch.tb != NULLP) { - datInfo->bchDat.pres = PRSNT_NODEF; - datInfo->bchDat.val = dlSf->bch.tb; - dlSf->bch.tb = NULLP; + datInfo->bchDat.pres = PRSNT_NODEF; + datInfo->bchDat.val = dlSf->bch.tb; + dlSf->bch.tb = NULLP; } #ifdef EMTC_ENABLE /* Fill the DLSCH PDUs of BCCH, PCCH and Dedicated Channels */ if ((ret = rgTOMEmtcUtlFillDatReqPdus(datInfo, dlSf, cellCb, err)) != ROK) { - RG_FREE_MEM(datInfo); - return (ret); + RG_FREE_MEM(datInfo); + return (ret); } #endif /* Fill the DLSCH PDUs of BCCH, PCCH and Dedicated Channels */ if ((ret = rgTOMUtlFillDatReqPdus(datInfo, dlSf, cellCb, err)) != ROK) { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to send data for cell"); - RG_FREE_MEM(datInfo); - return (ret); + DU_LOG("\nERROR --> MAC : Unable to send data for cell"); + RG_FREE_MEM(datInfo); + return (ret); } if((datInfo->pdus.count) || (datInfo->bchDat.pres == TRUE)) { - /* sending the data to Phy */ - if (rgLIMTfuDatReq(inst,datInfo) != ROK) - { - RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to send data info for cell"); - } + /* sending the data to Phy */ + //if (rgLIMTfuDatReq(inst,datInfo) != ROK) + { + DU_LOG("\nERROR --> MAC : Unable to send data info for cell"); + } } else { - /* Nothing to send: free the allocated datInfo */ - RG_FREE_MEM(datInfo); + /* Nothing to send: free the allocated datInfo */ + RG_FREE_MEM(datInfo); } } return ROK; } /* end of */ -U32 rgMacGT; +uint32_t rgMacGT; /** @brief This function allocates the RgMacPdu that will be populated by DEMUX * with the SubHeaders list and the values of the Control elements. @@ -485,22 +443,12 @@ U32 rgMacGT; * -# ROK * -# RFAILED */ -#ifdef ANSI -PRIVATE S16 rgTOMUtlAllocPduEvnt -( -Inst inst, - RgMacPdu **pdu - ) -#else -PRIVATE S16 rgTOMUtlAllocPduEvnt (inst,pdu) -Inst inst; - RgMacPdu **pdu; -#endif +static S16 rgTOMUtlAllocPduEvnt (Inst inst,RgMacPdu **pdu) { Mem evntMem; RgUstaDgn dgn; /* Alarm diagnostics structure */ - VOLATILE U32 startTime=0; + volatile uint32_t startTime=0; evntMem.region = rgCb[inst].rgInit.region; @@ -517,8 +465,8 @@ Inst inst; { rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM); rgLMMStaInd(inst,LCM_CATEGORY_RESOURCE, LCM_EVENT_DMEM_ALLOC_FAIL, - LCM_CAUSE_MEM_ALLOC_FAIL, &dgn); - RLOG0(L_ERROR,"Allocation of DUX event failed"); + LCM_CAUSE_MEM_ALLOC_FAIL, &dgn); + DU_LOG("\nERROR --> MAC : Allocation of DUX event failed"); return RFAILED; } @@ -543,17 +491,7 @@ Inst inst; * @param [in] Bool *error * @return */ -#ifdef ANSI -PRIVATE Void rgTOMUtlFreePduEvnt -( - RgMacPdu *pdu, - Bool error - ) -#else -PRIVATE Void rgTOMUtlFreePduEvnt (pdu, error) - RgMacPdu *pdu; - Bool error; -#endif +static Void rgTOMUtlFreePduEvnt( RgMacPdu *pdu,Bool error) { RgMacSdu *sdu; @@ -568,13 +506,13 @@ PRIVATE Void rgTOMUtlFreePduEvnt (pdu, error) node = pdu->sduLst.first; while (node) { - sdu = (RgMacSdu*)node->node; - RG_FREE_MSG(sdu->mBuf); - node = node->next; + sdu = (RgMacSdu*)node->node; + RG_FREE_MSG(sdu->mBuf); + node = node->next; } } RG_FREE_MEM(pdu); - RETVOID; + return; } /* end of rgTOMUtlFreePduEvnt */ /** @brief This function allocates the RgMacPdu that will be populated by DEMUX @@ -592,22 +530,12 @@ PRIVATE Void rgTOMUtlFreePduEvnt (pdu, error) * -# ROK * -# RFAILED */ -#ifdef ANSI -PRIVATE S16 rgTOMInfAllocPduEvnt -( -Inst inst, -RgInfSfDatInd **sfInfo - ) -#else -PRIVATE S16 rgTOMInfAllocPduEvnt (inst,sfInfo) -Inst inst; -RgInfSfDatInd **sfInfo; -#endif +static S16 rgTOMInfAllocPduEvnt (Inst inst,RgInfSfDatInd **sfInfo) { Mem evntMem; RgUstaDgn dgn; /* Alarm diagnostics structure */ - VOLATILE U32 startTime=0; + volatile uint32_t startTime=0; evntMem.region = rgCb[inst].rgInit.region; @@ -623,8 +551,8 @@ RgInfSfDatInd **sfInfo; { rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM); rgLMMStaInd(inst,LCM_CATEGORY_RESOURCE, LCM_EVENT_DMEM_ALLOC_FAIL, - LCM_CAUSE_MEM_ALLOC_FAIL, &dgn); - RLOG0(L_ERROR,"Allocation failed"); + LCM_CAUSE_MEM_ALLOC_FAIL, &dgn); + DU_LOG("\nERROR --> MAC : Allocation failed"); return RFAILED; } @@ -648,19 +576,11 @@ RgInfSfDatInd **sfInfo; * @param [in] Bool *error * @return */ -#ifdef ANSI -PRIVATE Void rgTOMInfFreePduEvnt -( -RgInfSfDatInd *sfInfo - ) -#else -PRIVATE Void rgTOMInfFreePduEvnt (sfInfo) -RgInfSfDatInd *sfInfo; -#endif +static Void rgTOMInfFreePduEvnt(RgInfSfDatInd *sfInfo) { RG_FREE_MEM(sfInfo); - RETVOID; + return; } /* end of rgTOMUtlFreePduEvnt */ #ifdef LTE_L2_MEAS @@ -681,23 +601,11 @@ RgInfSfDatInd *sfInfo; * @param [out] RgRguDedDatInd *dDatInd * @return */ -#ifdef ANSI -PRIVATE S16 rgTomUtlPrepareL2MUlThrpInfo -( - RgCellCb *cellCb, - RgUeCb *ueCb, - RgRguDedDatInd *dDatInd - ) -#else -PRIVATE S16 rgTomUtlPrepareL2MUlThrpInfo(cellCb,ueCb,dDatInd) - RgCellCb *cellCb; - RgUeCb *ueCb; - RgRguDedDatInd *dDatInd; -#endif +static S16 rgTomUtlPrepareL2MUlThrpInfo(RgCellCb *cellCb,RgUeCb *ueCb,RgRguDedDatInd *dDatInd) { - U8 lcId; - U8 lcgId; - U8 loop; + uint8_t lcId; + uint8_t lcgId; + uint8_t loop; dDatInd->burstInd = RGU_L2M_UL_BURST_END; for(loop=0;loopnumLch;loop++) @@ -705,13 +613,13 @@ PRIVATE S16 rgTomUtlPrepareL2MUlThrpInfo(cellCb,ueCb,dDatInd) lcId=dDatInd->lchData[loop].lcId; if (lcId) { - lcgId = ueCb->ul.lcCb[lcId - 1].lcgId; - if(ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs > 0) - { - dDatInd->burstInd = RGU_L2M_UL_BURST_START; - break; - } - } + lcgId = ueCb->ul.lcCb[lcId - 1].lcgId; + if(ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs > 0) + { + dDatInd->burstInd = RGU_L2M_UL_BURST_START; + break; + } + } } return ROK; @@ -740,57 +648,36 @@ PRIVATE S16 rgTomUtlPrepareL2MUlThrpInfo(cellCb,ueCb,dDatInd) * @param [in] RgUeCb *ueCb * @param [in] CmLteRnti rnti * @param [in] RgMacPdu *pdu - * @param [out] U32 *lcgBytes + * @param [out] uint32_t *lcgBytes * * @return S16 * -# ROK * -# RFAILED */ - RgUeCb *glblueCb4; - RgUeCb *glblueCb5; +RgUeCb *glblueCb4; +RgUeCb *glblueCb5; #ifdef LTEMAC_SPS -#ifdef ANSI -PRIVATE S16 rgTOMUtlProcMsg + static S16 rgTOMUtlProcMsg ( RgCellCb *cellCb, RgUeCb *ueCb, RgMacPdu *pdu, Bool isSpsRnti, Bool *spsToBeActvtd, - U16 *sduSize, - U16 slot, - U32 *lcgBytes + uint16_t *sduSize, + uint16_t slot, + uint32_t *lcgBytes ) -#else -PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, isSpsRnti,spsToBeActvtd,sduSize, slot, lcgBytes) - RgCellCb *cellCb; - RgUeCb *ueCb; - RgMacPdu *pdu; - Bool isSpsRnti; - Bool *spsToBeActvtd; - U16 *sduSize; - U16 slot; - U32 *lcgBytes; -#endif #else /* LTEMAC_SPS */ -#ifdef ANSI -PRIVATE S16 rgTOMUtlProcMsg + static S16 rgTOMUtlProcMsg ( RgCellCb *cellCb, RgUeCb *ueCb, RgMacPdu *pdu, - U16 slot, - U32 *lcgBytes + uint16_t slot, + uint32_t *lcgBytes ) -#else -PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes) - RgCellCb *cellCb; - RgUeCb *ueCb; - RgMacPdu *pdu; - U16 slot; - U32 *lcgByes; -#endif #endif { Inst inst = cellCb->macInst - RG_INST_START; @@ -803,28 +690,28 @@ PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes) MsgLen cpySz; #ifdef LTEMAC_SPS Pst schPst1; -// RgInfSpsRelInfo relInfo; + // RgInfSpsRelInfo relInfo; #endif #ifdef LTE_L2_MEAS - U8 idx1; - U8 idx2; - RgUlSf *ulSf; - U16 totalBytesRcvd = 0; - U16 sduLen[RGU_MAX_LC] = {0}; - U8 qciVal[RGU_MAX_LC] = {0}; - U8 numPrb = 0; + uint8_t idx1; + uint8_t idx2; + RgUlSf *ulSf; + uint16_t totalBytesRcvd = 0; + uint16_t sduLen[RGU_MAX_LC] = {0}; + uint8_t qciVal[RGU_MAX_LC] = {0}; + uint8_t numPrb = 0; #endif - U8 lcgId; - MsgLen bufSz; + uint8_t lcgId; + MsgLen bufSz; - /* Moved outside of LTE_L2_MEAS + /* Moved outside of LTE_L2_MEAS * scope as this pointer will now be used to * check for valid Logical Channel ID - */ + */ RgUlLcCb *ulLcCb; - + cDatInd = NULLP; dDatInd = NULLP; #ifdef LTE_L2_MEAS @@ -835,58 +722,58 @@ PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes) #ifdef SS_RBUF Void *elem = NULLP; #endif - + ulLcCb = NULLP; - + #ifndef LTE_L2_MEAS - UNUSED(slot); + UNUSED(slot); #endif if(pdu->sduLst.first) { sdu = (RgMacSdu*)(pdu->sduLst.first->node); - glblueCb4 = ueCb; + glblueCb4 = ueCb; if ((sdu->lcId == RG_CCCH_LCID)) { - /* code for common channel dat indications */ - if ((ret = rgAllocShrablSBuf (inst,(Data**)&cDatInd, sizeof(RgRguCmnDatInd))) != ROK) - { - return RFAILED; - } - cDatInd->cellId = cellCb->cellId; - cDatInd->rnti = ueCb->ueId; - /* rg001.101: Corrected lcId value for common data indication */ - cDatInd->lcId = cellCb->ulCcchId; - cDatInd->pdu = sdu->mBuf; - SFndLenMsg (sdu->mBuf, &ccchSz); - /* Fix : syed Contention resolution ID copy should consider only - * 6 bytes of information from sdu->mBuf. Incase of CCCH sdu for reest - * message/psuedo reest message, ccchSz can go beyond 6 and can corrupt - * other fields of ueCb. */ - if (ccchSz >= RG_CRES_LEN) - { - SCpyMsgFix (sdu->mBuf, (MsgLen)0, RG_CRES_LEN, ueCb->contResId.resId, - &cpySz); - } + /* code for common channel dat indications */ + if ((ret = rgAllocShrablSBuf (inst,(Data**)&cDatInd, sizeof(RgRguCmnDatInd))) != ROK) + { + return RFAILED; + } + cDatInd->cellId = cellCb->cellId; + cDatInd->rnti = ueCb->ueId; + /* rg001.101: Corrected lcId value for common data indication */ + cDatInd->lcId = cellCb->ulCcchId; + cDatInd->pdu = sdu->mBuf; + SFndLenMsg (sdu->mBuf, &ccchSz); + /* Fix : syed Contention resolution ID copy should consider only + * 6 bytes of information from sdu->mBuf. Incase of CCCH sdu for reest + * message/psuedo reest message, ccchSz can go beyond 6 and can corrupt + * other fields of ueCb. */ + if (ccchSz >= RG_CRES_LEN) + { + SCpyMsgFix (sdu->mBuf, (MsgLen)0, RG_CRES_LEN, ueCb->contResId.resId, + &cpySz); + } #ifdef XEON_SPECIFIC_CHANGES - CM_LOG_DEBUG(CM_LOG_ID_MAC, "CCCH SDU of size(%d) received for UE(%d) CRES[0x%x 0x%x 0x%x 0x%x 0x%x 0x%x] Time[%d %d]\n", ((S16)ccchSz), ueCb->ueId,ueCb->contResId.resId[0], ueCb->contResId.resId[1], ueCb->contResId.resId[2], ueCb->contResId.resId[3], ueCb->contResId.resId[4], ueCb->contResId.resId[5], cellCb->crntTime.sfn, cellCb->crntTime.slot); + CM_LOG_DEBUG(CM_LOG_ID_MAC, "CCCH SDU of size(%d) received for UE(%d) CRES[0x%x 0x%x 0x%x 0x%x 0x%x 0x%x] Time[%d %d]\n", ((S16)ccchSz), ueCb->ueId,ueCb->contResId.resId[0], ueCb->contResId.resId[1], ueCb->contResId.resId[2], ueCb->contResId.resId[3], ueCb->contResId.resId[4], ueCb->contResId.resId[5], cellCb->crntTime.sfn, cellCb->crntTime.slot); #endif - sdu->mBuf = NULLP; - rgUIMSndCmnDatInd(inst,cellCb->rguUlSap,cDatInd); - return ROK; + sdu->mBuf = NULLP; + rgUIMSndCmnDatInd(inst,cellCb->rguUlSap,cDatInd); + return ROK; } /* end of common channel processing */ #ifndef SS_RBUF if ((ret = rgAllocShrablSBuf (inst,(Data**)&dDatInd, sizeof(RgRguDedDatInd))) != ROK) { - return RFAILED; + return RFAILED; } #else - glblueCb5 = ueCb; + glblueCb5 = ueCb; elem = SRngGetWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC); if (NULLP == elem) { - return RFAILED; + return RFAILED; } dDatInd = (RgRguDedDatInd *)elem; memset(dDatInd, 0x00, sizeof(RgRguDedDatInd)); @@ -899,46 +786,46 @@ PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes) ulSf = &cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)]; if(ulSf->ueUlAllocInfo != NULLP) { - for(idx1 = 0; idx1 < ulSf->numUe; idx1++) - { - if(ulSf->ueUlAllocInfo[idx1].rnti == ueCb->ueId) - { - numPrb = ulSf->ueUlAllocInfo[idx1].numPrb; - break; - } - } + for(idx1 = 0; idx1 < ulSf->numUe; idx1++) + { + if(ulSf->ueUlAllocInfo[idx1].rnti == ueCb->ueId) + { + numPrb = ulSf->ueUlAllocInfo[idx1].numPrb; + break; + } + } } #endif node = pdu->sduLst.first; while (node) { sdu = (RgMacSdu*)node->node; - + ulLcCb = rgDBMGetUlDedLcCb (ueCb, sdu->lcId); - + if(ulLcCb == NULLP) { - RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId,"Unconfigured LCID:%d CRNTI:%d" - ,sdu->lcId,ueCb->ueId); - /* ccpu00128443: Fix for memory leak */ - /* Fix : syed Neccessary to set sdu->mBuf = NULLP */ - RG_FREE_MSG(sdu->mBuf); - node = node->next; - continue; + DU_LOG("\nERROR --> MAC : Unconfigured LCID:%d CRNTI:%d" + ,sdu->lcId,ueCb->ueId); + /* ccpu00128443: Fix for memory leak */ + /* Fix : syed Neccessary to set sdu->mBuf = NULLP */ + RG_FREE_MSG(sdu->mBuf); + node = node->next; + continue; } #ifdef RLC_STA_PROC_IN_MAC/* RLC Status PDU Processing */ { - extern S16 rlcProcDlStatusPdu(Pst *udxPst,SuId suId, - CmLteCellId cellId,CmLteRnti rnti,CmLteLcId lcId,Buffer *rlcSdu); - - if(ROK == rlcProcDlStatusPdu(&(cellCb->rguDlSap->sapCfg.sapPst), - cellCb->rguDlSap->sapCfg.suId, - cellCb->cellId,ueCb->ueId,sdu->lcId,sdu->mBuf)) - { - RG_FREE_MSG(sdu->mBuf); - node = node->next; - continue; - } + S16 rlcProcDlStatusPdu(Pst *udxPst,SuId suId, + CmLteCellId cellId,CmLteRnti rnti,CmLteLcId lcId,Buffer *rlcSdu); + + if(ROK == rlcProcDlStatusPdu(&(cellCb->rguDlSap->sapCfg.sapPst), + cellCb->rguDlSap->sapCfg.suId, + cellCb->cellId,ueCb->ueId,sdu->lcId,sdu->mBuf)) + { + RG_FREE_MSG(sdu->mBuf); + node = node->next; + continue; + } } #endif @@ -948,29 +835,28 @@ PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes) * of the freed memory */ if (dDatInd->numLch >= RGU_MAX_LC) { - if ((ret = rgUIMSndDedDatInd(inst,ueCb->rguUlSap,dDatInd)) != ROK) - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "Failed to send datIndication to RGU CRNTI:%d",ueCb->ueId); - return (ret); - } + if ((ret = rgUIMSndDedDatInd(inst,ueCb->rguUlSap,dDatInd)) != ROK) + { + DU_LOG("\nERROR --> MAC : Failed to send datIndication to RGU CRNTI:%d",ueCb->ueId); + return (ret); + } #ifndef SS_RBUF - if ((ret = rgAllocShrablSBuf (inst,(Data**)&dDatInd, sizeof(RgRguDedDatInd))) != ROK) - { - return RFAILED; - } + if ((ret = rgAllocShrablSBuf (inst,(Data**)&dDatInd, sizeof(RgRguDedDatInd))) != ROK) + { + return RFAILED; + } #else - elem = SRngGetWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC); - if (NULLP == elem) - { - return RFAILED; - } - dDatInd = (RgRguDedDatInd *)elem; - memset(dDatInd, 0x00, sizeof(RgRguDedDatInd)); + elem = SRngGetWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC); + if (NULLP == elem) + { + return RFAILED; + } + dDatInd = (RgRguDedDatInd *)elem; + memset(dDatInd, 0x00, sizeof(RgRguDedDatInd)); #endif - dDatInd->cellId = cellCb->cellId; - dDatInd->rnti = ueCb->ueId; - dDatInd->numLch = 0; + dDatInd->cellId = cellCb->cellId; + dDatInd->rnti = ueCb->ueId; + dDatInd->numLch = 0; } dDatInd->lchData[dDatInd->numLch].lcId = sdu->lcId; dDatInd->lchData[dDatInd->numLch].pdu.mBuf[dDatInd->lchData[dDatInd->numLch].pdu.numPdu] = sdu->mBuf; @@ -980,13 +866,13 @@ PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes) #ifdef LTE_L2_MEAS if(ulLcCb->measOn) { - ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs -= bufSz; + ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs -= bufSz; } #endif //if ((lcgBytes != NULLP) && (ueCb->ul.lcgArr[lcgId].isGbr == TRUE)) if (lcgBytes != NULLP) { - lcgBytes[lcgId] += bufSz; + lcgBytes[lcgId] += bufSz; } sdu->mBuf = NULLP; dDatInd->numLch++; @@ -995,31 +881,31 @@ PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes) /* KWORK_FIX: Modified the index from lcId to lcId-1 for handling lcId 10 properly */ if (ueCb->ul.spsLcId[sdu->lcId-1] == TRUE) { - ueCb->ul.spsDatRcvd++; + ueCb->ul.spsDatRcvd++; } - + if(isSpsRnti) { - /* Data rcvd on CRNTI*/ - /* Retrieve the LCG ID of the LCID*/ - /* SPS LCG has data whose size > SID Size */ - /* Activate SPS if data recvd on SPS LCID and size > SID Packet Size */ - if((ueCb->ul.spsLcId[sdu->lcId-1] == TRUE) && - (sdu->len > RG_SPS_SID_PACKET_SIZE)) - { - *spsToBeActvtd = TRUE; - *sduSize = sdu->len; - } + /* Data rcvd on CRNTI*/ + /* Retrieve the LCG ID of the LCID*/ + /* SPS LCG has data whose size > SID Size */ + /* Activate SPS if data recvd on SPS LCID and size > SID Packet Size */ + if((ueCb->ul.spsLcId[sdu->lcId-1] == TRUE) && + (sdu->len > RG_SPS_SID_PACKET_SIZE)) + { + *spsToBeActvtd = TRUE; + *sduSize = sdu->len; + } } - + #endif #ifdef LTE_L2_MEAS if(cellCb->qciArray[ulLcCb->qci].mask == TRUE) { - sduLen[ulLcCb->qci] = sdu->len; - totalBytesRcvd += sdu->len; - qciVal[ulLcCb->qci] = ulLcCb->qci; + sduLen[ulLcCb->qci] = sdu->len; + totalBytesRcvd += sdu->len; + qciVal[ulLcCb->qci] = ulLcCb->qci; } #endif node = node->next; @@ -1028,49 +914,49 @@ PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes) for(idx2 = 0; idx2 < RGU_MAX_LC; idx2++) { if((cellCb->qciArray[qciVal[idx2]].mask == TRUE) && - totalBytesRcvd > 0) + totalBytesRcvd > 0) { - cellCb->qciArray[qciVal[idx2]].prbCount += - ((numPrb * sduLen[idx2]) / totalBytesRcvd); + cellCb->qciArray[qciVal[idx2]].prbCount += + ((numPrb * sduLen[idx2]) / totalBytesRcvd); } - + /* RRM_RBC_X */ if(totalBytesRcvd > 0 && qciVal[idx2] > 0) { - RG_UPD_GBR_PRB(cellCb, qciVal[idx2], ((numPrb * sduLen[idx2])/totalBytesRcvd)); + RG_UPD_GBR_PRB(cellCb, qciVal[idx2], ((numPrb * sduLen[idx2])/totalBytesRcvd)); } /* RRM_RBC_Y */ } #endif -/*Added for explicit release - start*/ + /*Added for explicit release - start*/ #ifdef LTEMAC_SPS if(isSpsRnti && dDatInd && dDatInd->numLch) { if(ueCb->ul.spsDatRcvd != 0) { - ueCb->ul.explRelCntr = 0; - ueCb->ul.spsDatRcvd = 0; + ueCb->ul.explRelCntr = 0; + ueCb->ul.spsDatRcvd = 0; } else { - ueCb->ul.explRelCntr++; - if (ueCb->ul.explRelCntr == ueCb->ul.explRelCnt) - { - ueCb->ul.explRelCntr = 0; - /* Indicate scheduler for explicit release */ - memset(&schPst1, 0, sizeof(Pst)); - rgGetPstToInst(&schPst1,inst, cellCb->schInstMap.schInst); - //TODO: commented for compilation without SCH + ueCb->ul.explRelCntr++; + if (ueCb->ul.explRelCntr == ueCb->ul.explRelCnt) + { + ueCb->ul.explRelCntr = 0; + /* Indicate scheduler for explicit release */ + memset(&schPst1, 0, sizeof(Pst)); + rgGetPstToInst(&schPst1,inst, cellCb->schInstMap.schInst); + //TODO: commented for compilation without SCH #if 0 - relInfo.cellSapId = cellCb->schInstMap.cellSapId; - relInfo.cRnti = ueCb->ueId; - relInfo.isExplRel = TRUE; - /* Release indicator is called now through the matrix in the function below */ - //TODO: commented for compilation without SCH RgMacSchSpsRel( &schPst1, &relInfo ); -#endif - ueCb->ul.implRelCntr = 0; - } + relInfo.cellSapId = cellCb->schInstMap.cellSapId; + relInfo.cRnti = ueCb->ueId; + relInfo.isExplRel = TRUE; + /* Release indicator is called now through the matrix in the function below */ + //TODO: commented for compilation without SCH RgMacSchSpsRel( &schPst1, &relInfo ); +#endif + ueCb->ul.implRelCntr = 0; + } } } else @@ -1078,9 +964,9 @@ PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes) /* SPS_FIX */ if(ueCb->ul.spsDatRcvd != 0) { - //ueCb->ul.implRelCntr = 0; - ueCb->ul.explRelCntr = 0; - ueCb->ul.spsDatRcvd = 0; + //ueCb->ul.implRelCntr = 0; + ueCb->ul.explRelCntr = 0; + ueCb->ul.spsDatRcvd = 0; } } #endif @@ -1095,9 +981,8 @@ PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes) #endif if ((ret = rgUIMSndDedDatInd(inst,ueCb->rguUlSap,dDatInd)) != ROK) { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "Failed to send datIndication to RGU CRNTI:%d",ueCb->ueId); - return (ret); + DU_LOG("\nERROR --> MAC : Failed to send datIndication to RGU CRNTI:%d",ueCb->ueId); + return (ret); } } #ifndef SS_RBUF @@ -1126,52 +1011,31 @@ PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes) * @return */ #ifdef LTEMAC_SPS -#ifdef ANSI -PRIVATE S16 rgTOMUtlInsSchInfo + static S16 rgTOMUtlInsSchInfo ( -RgMacPdu *pdu, -RgInfSfDatInd *sfInfo, -RgInfCeInfo *ceInfo, -CmLteRnti rnti, -Bool spsToBeActvtd, -U16 sduSize, -U32 *lcgBytes -) -#else -PRIVATE S16 rgTOMUtlInsSchInfo (pdu, sfInfo, ceInfo, rnti,spsToBeActvtd,sduSize, lcgBytes) -RgMacPdu *pdu; -RgInfSfDatInd *sfInfo; -RgInfCeInfo *ceInfo; -CmLteRnti rnti; -Bool spsToBeActvtd; -U16 sduSize; -U32 *lcgBytes; -#endif - + RgMacPdu *pdu, + RgInfSfDatInd *sfInfo, + RgInfCeInfo *ceInfo, + CmLteRnti rnti, + Bool spsToBeActvtd, + uint16_t sduSize, + uint32_t *lcgBytes + ) #else -#ifdef ANSI -PRIVATE S16 rgTOMUtlInsSchInfo + static S16 rgTOMUtlInsSchInfo ( -RgMacPdu *pdu, -RgInfSfDatInd *sfInfo, -RgInfCeInfo *ceInfo, -CmLteRnti rnti, -U32 *lcgBytes -) -#else -PRIVATE S16 rgTOMUtlInsSchInfo (pdu, sfInfo, ceInfo, rnti, lcgBytes) -RgMacPdu *pdu; -RgInfSfDatInd *sfInfo; -RgInfCeInfo *ceInfo; -CmLteRnti rnti; -U32 *lcgBytes; -#endif + RgMacPdu *pdu, + RgInfSfDatInd *sfInfo, + RgInfCeInfo *ceInfo, + CmLteRnti rnti, + uint32_t *lcgBytes + ) #endif { S16 ret; RgInfUeDatInd *ueInfo; - U32 lcgId = 0; - U32 idx = 0; + uint32_t lcgId = 0; + uint32_t idx = 0; RG_TOM_INF_ALLOC(sfInfo, sizeof(RgInfUeDatInd), ueInfo, ret); @@ -1182,17 +1046,17 @@ U32 *lcgBytes; } ueInfo->rnti = rnti; - + ueInfo->ceInfo = *ceInfo; ueInfo->ueLstEnt.node = (PTR)ueInfo; for (lcgId = 1, idx = 0; lcgId < RGINF_MAX_LCG_PER_UE; lcgId++) { if (lcgBytes[lcgId] != 0) { - /* Only GBR bytes */ - ueInfo->lcgInfo[idx].lcgId = lcgId; - ueInfo->lcgInfo[idx++].bytesRcvd = lcgBytes[lcgId]; - lcgBytes[lcgId] = 0; + /* Only GBR bytes */ + ueInfo->lcgInfo[idx].lcgId = lcgId; + ueInfo->lcgInfo[idx++].bytesRcvd = lcgBytes[lcgId]; + lcgBytes[lcgId] = 0; } } cmLListAdd2Tail(&sfInfo->ueLst, &ueInfo->ueLstEnt); @@ -1238,17 +1102,7 @@ U32 *lcgBytes; * -# ROK * -# RFAILED **/ -#ifdef ANSI -S16 rgTOMDatInd -( -Inst inst, - TfuDatIndInfo *datInd - ) -#else -S16 rgTOMDatInd(inst,datInd) -Inst inst; - TfuDatIndInfo *datInd; -#endif +S16 rgTOMDatInd(Inst inst, TfuDatIndInfo *datInd) { S16 ret = ROK; RgErrInfo err; @@ -1262,15 +1116,15 @@ Inst inst; CmLList *node; TfuDatInfo *datInfo; RgLowSapCb *tfuSap; - U16 slot; + uint16_t slot; #ifdef LTEMAC_SPS Bool isSpsRnti=FALSE; Pst schPst1; - // RgInfSpsRelInfo relInfo; - Bool spsToBeActvtd = FALSE; - U16 sduSize = 0; + // RgInfSpsRelInfo relInfo; + Bool spsToBeActvtd = FALSE; + uint16_t sduSize = 0; #endif - U32 lcgBytes[RGINF_MAX_LCG_PER_UE]; + uint32_t lcgBytes[RGINF_MAX_LCG_PER_UE]; #ifdef STUB_TTI_HANDLING_5GTF @@ -1279,17 +1133,17 @@ Inst inst; { datInfo = (TfuDatInfo*)node->node; { - MsgLen len; - SFndLenMsg(datInfo->mBuf, &len); - rgUlrate_tfu += len; - if (rgUlrate_tfu > 100000) - { - printf("Sowmya:rgTOMDatInd datInfo->mBuf len =%d rgUlrate_tfu=%d",len,rgUlrate_tfu); - rgUlrate_tfu = 0; - } + MsgLen len; + SFndLenMsg(datInfo->mBuf, &len); + rgUlrate_tfu += len; + if (rgUlrate_tfu > 100000) + { + DU_LOG("\nINFO --> MAC : rgTOMDatInd datInfo->mBuf len =%d rgUlrate_tfu=%d",len,rgUlrate_tfu); + rgUlrate_tfu = 0; + } } } - return(RFAILED); + return(RFAILED); #endif memset(&lcgBytes, 0, sizeof(lcgBytes)); @@ -1298,10 +1152,10 @@ Inst inst; ueCb = NULLP; cellCb = rgCb[inst].cell; if((cellCb == NULLP) || - (cellCb->cellId != datInd->cellId)) + (cellCb->cellId != datInd->cellId)) { - - RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"Unable to get the cellCb for cell"); + + DU_LOG("\nERROR --> MAC : Unable to get the cellCb for cell"); return RFAILED; } /* Avoiding memset as all the fields are getting initialized further */ @@ -1309,7 +1163,7 @@ Inst inst; if (rgTOMInfAllocPduEvnt (inst,&sfInfo) != ROK) { err.errType = RGERR_TOM_DATIND; - RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"Unable to Allocate PDU for DUX cell"); + DU_LOG("\nERROR --> MAC : Unable to Allocate PDU for DUX cell"); node = datInd->datIndLst.first; return RFAILED; } @@ -1323,15 +1177,15 @@ Inst inst; { datInfo = (TfuDatInfo*)node->node; { - //extern U32 ulrate_tfu; - MsgLen len; - SFndLenMsg(datInfo->mBuf, &len); + //uint32_t ulrate_tfu; + MsgLen len; + SFndLenMsg(datInfo->mBuf, &len); #ifdef STUB_TTI_HANDLING_5GTF - // printf("Sowmya:rgTOMDatInd datInfo->mBuf len =%d",len); + // DU_LOG(":rgTOMDatInd datInfo->mBuf len =%d",len); #endif - rgUlrate_tfu += len; + rgUlrate_tfu += len; #ifdef EMTC_ENABLE - grgUlrate_tfu += len; + grgUlrate_tfu += len; #endif } #ifdef STUB_TTI_HANDLING_5GTF @@ -1346,22 +1200,22 @@ Inst inst; /* Lets allocate the event that needs to be passed to DUX */ if (rgTOMUtlAllocPduEvnt (inst,&pdu) != ROK) { - err.errType = RGERR_TOM_DATIND; - RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"Unable to Allocate PDU for DUX cell"); - rgTOMInfFreePduEvnt (sfInfo); - return RFAILED; + err.errType = RGERR_TOM_DATIND; + DU_LOG("\nERROR --> MAC : Unable to Allocate PDU for DUX cell"); + rgTOMInfFreePduEvnt (sfInfo); + return RFAILED; } if ((ret = rgDUXDemuxData (inst,pdu, &ceInfo, - &datInfo->mBuf, &err)) != ROK) + &datInfo->mBuf, &err)) != ROK) { - //exit(1); - /* Fix: sriky memory corruption precautions */ - rgTOMUtlFreePduEvnt (pdu, TRUE); - err.errType = RGERR_TOM_DATIND; - RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"DUX processing failed"); - tfuSap->sapSts.numPduDrop++; - continue; + //exit(1); + /* Fix: sriky memory corruption precautions */ + rgTOMUtlFreePduEvnt (pdu, TRUE); + err.errType = RGERR_TOM_DATIND; + DU_LOG("\nERROR --> MAC : DUX processing failed"); + tfuSap->sapSts.numPduDrop++; + continue; } /* It could be that a non-msg3 pdu contains a CRNTI Control element. We * should check for CRNTI CE and if it exists the UECb must exist, also an @@ -1371,110 +1225,109 @@ Inst inst; if (ceInfo.bitMask & RG_CCCH_SDU_PRSNT) { - ret = rgTOMProcCCCHSduInDatInd(pdu, prevUeCb, \ - cellCb, datInfo, &ceInfo, slot); - if (ret == RFAILED) - { - rgTOMUtlFreePduEvnt (pdu, TRUE); - err.errType = RGERR_TOM_DATIND; - tfuSap->sapSts.numPduDrop++; - continue; - } + ret = rgTOMProcCCCHSduInDatInd(pdu, prevUeCb, \ + cellCb, datInfo, &ceInfo, slot); + if (ret == RFAILED) + { + rgTOMUtlFreePduEvnt (pdu, TRUE); + err.errType = RGERR_TOM_DATIND; + tfuSap->sapSts.numPduDrop++; + continue; + } } /* end of Msg3 processing */ else if (ceInfo.bitMask & RG_CRNTI_CE_PRSNT) { - ret = rgTOMProcCrntiCEInDatInd(pdu, prevUeCb, \ - cellCb, datInfo, &ceInfo, slot); - if (ret == RFAILED) - { - rgTOMUtlFreePduEvnt (pdu, TRUE); - err.errType = RGERR_TOM_DATIND; - tfuSap->sapSts.numPduDrop++; - continue; - } + ret = rgTOMProcCrntiCEInDatInd(pdu, prevUeCb, \ + cellCb, datInfo, &ceInfo, slot); + if (ret == RFAILED) + { + rgTOMUtlFreePduEvnt (pdu, TRUE); + err.errType = RGERR_TOM_DATIND; + tfuSap->sapSts.numPduDrop++; + continue; + } } /* end of CRNTI based message */ else { - ueCb = rgDBMGetUeCb (cellCb, datInfo->rnti); - if (ueCb == NULLP) - { + ueCb = rgDBMGetUeCb (cellCb, datInfo->rnti); + if (ueCb == NULLP) + { #ifdef LTEMAC_SPS - /* Try getting the UE using SPS-RNTI. */ - ueCb = rgDBMGetSpsUeCb (cellCb, datInfo->rnti); - if (ueCb != NULLP) - { - isSpsRnti = TRUE; - /* Increment implrelCntr for an empty transmission */ - if (pdu->sduLst.count == 0) - { - ueCb->ul.implRelCntr++; - if (ueCb->ul.implRelCntr == ueCb->ul.implRelCnt) - { - /* Indicate scheduler for implicit release */ - memset(&schPst1, 0, sizeof(Pst)); - rgGetPstToInst(&schPst1,inst, cellCb->schInstMap.schInst); - - ueCb->ul.implRelCntr = 0; - ueCb->ul.explRelCntr = 0; + /* Try getting the UE using SPS-RNTI. */ + ueCb = rgDBMGetSpsUeCb (cellCb, datInfo->rnti); + if (ueCb != NULLP) + { + isSpsRnti = TRUE; + /* Increment implrelCntr for an empty transmission */ + if (pdu->sduLst.count == 0) + { + ueCb->ul.implRelCntr++; + if (ueCb->ul.implRelCntr == ueCb->ul.implRelCnt) + { + /* Indicate scheduler for implicit release */ + memset(&schPst1, 0, sizeof(Pst)); + rgGetPstToInst(&schPst1,inst, cellCb->schInstMap.schInst); + + ueCb->ul.implRelCntr = 0; + ueCb->ul.explRelCntr = 0; #if 0 - relInfo.cellSapId = cellCb->schInstMap.cellSapId; - relInfo.cRnti = ueCb->ueId; - relInfo.isExplRel= FALSE; - //TODO: commented for compilation without SCH RgMacSchSpsRel(&schPst1, &relInfo); + relInfo.cellSapId = cellCb->schInstMap.cellSapId; + relInfo.cRnti = ueCb->ueId; + relInfo.isExplRel= FALSE; + //TODO: commented for compilation without SCH RgMacSchSpsRel(&schPst1, &relInfo); #endif - } - } - else - { - /* Reset the implrelCntr */ - ueCb->ul.implRelCntr = 0; - } - } - else + } + } + else + { + /* Reset the implrelCntr */ + ueCb->ul.implRelCntr = 0; + } + } + else #endif - { - /* Perform failure if ueCb is still NULLP */ - rgTOMUtlFreePduEvnt (pdu, TRUE); - err.errType = RGERR_TOM_DATIND; - RLOG_ARG1(L_ERROR,DBG_CELLID,datInd->cellId,"RNTI:%d Unable to get the UE CB", - datInfo->rnti); - tfuSap->sapSts.numPduDrop++; - continue; - } - } + { + /* Perform failure if ueCb is still NULLP */ + rgTOMUtlFreePduEvnt (pdu, TRUE); + err.errType = RGERR_TOM_DATIND; + DU_LOG("\nERROR --> MAC : RNTI:%d Unable to get the UE CB", + datInfo->rnti); + tfuSap->sapSts.numPduDrop++; + continue; + } + } #ifdef LTE_L2_MEAS - rgTOMUtlL2MStoreBufSz(ueCb, &ceInfo); - rgTOML2MCompileActiveLCs (cellCb, ueCb, pdu, &ceInfo); + rgTOMUtlL2MStoreBufSz(ueCb, &ceInfo); + rgTOML2MCompileActiveLCs (cellCb, ueCb, pdu, &ceInfo); #endif #ifdef LTEMAC_SPS - if ((ret = rgTOMUtlProcMsg(cellCb, ueCb, pdu, isSpsRnti,&spsToBeActvtd,&sduSize, slot, (U32 *)&lcgBytes)) != ROK) + if ((ret = rgTOMUtlProcMsg(cellCb, ueCb, pdu, isSpsRnti,&spsToBeActvtd,&sduSize, slot, (uint32_t *)&lcgBytes)) != ROK) #else - if ((ret = rgTOMUtlProcMsg (cellCb, ueCb, pdu, slot, (U32 *)&lcgBytes)) != ROK) + if ((ret = rgTOMUtlProcMsg (cellCb, ueCb, pdu, slot, (uint32_t *)&lcgBytes)) != ROK) #endif /* LTEMAC_SPS */ - { - rgTOMUtlFreePduEvnt (pdu, TRUE); - err.errType = RGERR_TOM_DATIND; - RLOG_ARG1(L_ERROR,DBG_CELLID,datInd->cellId, - "Unable to handle Data Indication CRNTI:%d",ueCb->ueId); - tfuSap->sapSts.numPduDrop++; - continue; - } + { + rgTOMUtlFreePduEvnt (pdu, TRUE); + err.errType = RGERR_TOM_DATIND; + DU_LOG("\nERROR --> MAC : Unable to handle Data Indication CRNTI:%d",ueCb->ueId); + tfuSap->sapSts.numPduDrop++; + continue; + } } - + #ifdef LTEMAC_SPS - if(rgTOMUtlInsSchInfo(pdu, sfInfo, &ceInfo, datInfo->rnti,spsToBeActvtd,sduSize, (U32 *)&lcgBytes) != ROK) + if(rgTOMUtlInsSchInfo(pdu, sfInfo, &ceInfo, datInfo->rnti,spsToBeActvtd,sduSize, (uint32_t *)&lcgBytes) != ROK) #else - if(rgTOMUtlInsSchInfo(pdu, sfInfo, &ceInfo, datInfo->rnti, (U32 *)&lcgBytes) != ROK) + if(rgTOMUtlInsSchInfo(pdu, sfInfo, &ceInfo, datInfo->rnti, (uint32_t *)&lcgBytes) != ROK) #endif - - { - rgTOMInfFreePduEvnt (sfInfo); - rgTOMUtlFreePduEvnt (pdu, FALSE); - return RFAILED; - } + + { + rgTOMInfFreePduEvnt (sfInfo); + rgTOMUtlFreePduEvnt (pdu, FALSE); + return RFAILED; + } /* free up the PDU memory */ rgTOMUtlFreePduEvnt (pdu, FALSE); } @@ -1483,19 +1336,19 @@ Inst inst; if(cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)].ueUlAllocInfo != NULLP) { /*ccpu00117052 - MOD - Passing double for proper NULLP - assignment */ + assignment */ rgFreeSBuf(inst,(Data **)&(cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)].ueUlAllocInfo), - ((cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)].numUe) * sizeof(RgUeUlAlloc))); + ((cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)].numUe) * sizeof(RgUeUlAlloc))); } #endif /* RRM_RBC_X */ /* Update PRB used for all GBR QCIs to scheduler */ - memcpy( &sfInfo->qcisUlPrbCnt[0], - &cellCb->qcisUlPrbCnt[0], - (RGM_MAX_QCI_REPORTS * sizeof(U32))); - /* clear the cellCb ul prb value */ - memset(&cellCb->qcisUlPrbCnt[0], 0, - (RGM_MAX_QCI_REPORTS * sizeof(U32))); + memcpy( &sfInfo->qcisUlPrbCnt[0], + &cellCb->qcisUlPrbCnt[0], + (RGM_MAX_QCI_REPORTS * sizeof(uint32_t))); + /* clear the cellCb ul prb value */ + memset(&cellCb->qcisUlPrbCnt[0], 0, + (RGM_MAX_QCI_REPORTS * sizeof(uint32_t))); /* RRM_RBC_Y */ @@ -1532,25 +1385,17 @@ Inst inst; * -# ROK * -# RFAILED **/ -#ifdef ANSI -PRIVATE S16 rgHndlCmnChnl + static S16 rgHndlCmnChnl ( -RgCellCb *cell, -CmLteTimingInfo timingInfo, -RgInfCmnLcInfo *cmnLcInfo, -RgErrInfo *err -) -#else -PRIVATE S16 rgHndlCmnChnl(cell, timingInfo, cmnLcInfo, err) -RgCellCb *cell; -CmLteTimingInfo timingInfo; -RgInfCmnLcInfo *cmnLcInfo; -RgErrInfo *err; -#endif + RgCellCb *cell, + CmLteTimingInfo timingInfo, + RgInfCmnLcInfo *cmnLcInfo, + RgErrInfo *err + ) { - #if (ERRCLASS & ERRCLS_DEBUG) +#if (ERRCLASS & ERRCLS_DEBUG) RgPcchLcCb *pcch; - #endif +#endif #ifndef RGR_SI_SCH RgBcchDlschLcCb *bcch; #if (ERRCLASS & ERRCLS_DEBUG) @@ -1567,33 +1412,33 @@ RgErrInfo *err; if(cmnLcInfo->bitMask & RGINF_BCH_INFO) { #ifndef RGR_SI_SCH - #if (ERRCLASS & ERRCLS_DEBUG) +#if (ERRCLASS & ERRCLS_DEBUG) if(NULLP == (bch = rgDBMGetBcchOnBch(cell))) { - return RFAILED; + return RFAILED; } if(cmnLcInfo->bchInfo.lcId != bch->lcId) { - return RFAILED; + return RFAILED; } - #endif +#endif if (rgAllocShrablSBuf (inst,(Data**)&staInd, sizeof(RguCStaIndInfo)) != ROK) { - err->errCause = RGERR_TOM_MEM_EXHAUST; - return RFAILED; + err->errCause = RGERR_TOM_MEM_EXHAUST; + return RFAILED; } staInd->cellId = cell->cellId; staInd->rnti = RG_INVALID_RNTI; staInd->lcId = cmnLcInfo->bchInfo.lcId; staInd->transId = (timingInfo.sfn << 8) | (timingInfo.slot); -/* ADD Changes for Downlink UE Timing Optimization */ + /* ADD Changes for Downlink UE Timing Optimization */ #ifdef LTEMAC_DLUE_TMGOPTMZ dlSf->remDatReqCnt++; #endif if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK) { - return RFAILED; + return RFAILED; } #else /*Store the received BCH Data in the scheduled subframe*/ @@ -1603,35 +1448,35 @@ RgErrInfo *err; if(cmnLcInfo->bitMask & RGINF_PCCH_INFO) { - #if (ERRCLASS & ERRCLS_DEBUG) +#if (ERRCLASS & ERRCLS_DEBUG) if(NULLP == (pcch = rgDBMGetPcch(cell))) { - return RFAILED; + return RFAILED; } if(cmnLcInfo->pcchInfo.lcId != pcch->lcId) { - return RFAILED; + return RFAILED; } - #endif +#endif dlSf->pcch.pdcch.rnti = - cmnLcInfo->pcchInfo.rnti; + cmnLcInfo->pcchInfo.rnti; dlSf->pcch.pdcch.dci = - cmnLcInfo->pcchInfo.dciInfo; + cmnLcInfo->pcchInfo.dciInfo; #ifdef TFU_UPGRADE /* ccpu00132314-ADD-Fill the tx Pwr offset from scheduler */ dlSf->pcch.txPwrOffset = cmnLcInfo->pcchInfo.txPwrOffset; #endif if (rgAllocShrablSBuf (inst,(Data**)&staInd, sizeof(RguCStaIndInfo)) != ROK) { - err->errCause = RGERR_TOM_MEM_EXHAUST; - return RFAILED; + err->errCause = RGERR_TOM_MEM_EXHAUST; + return RFAILED; } staInd->cellId = cell->cellId; staInd->rnti = RG_INVALID_RNTI; staInd->lcId = cmnLcInfo->pcchInfo.lcId; staInd->transId = (timingInfo.sfn << 8) | (timingInfo.slot); -/* ADD Changes for Downlink UE Timing Optimization */ + /* ADD Changes for Downlink UE Timing Optimization */ #ifdef LTEMAC_DLUE_TMGOPTMZ dlSf->remDatReqCnt++; #endif @@ -1640,52 +1485,52 @@ RgErrInfo *err; */ if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK) { - return RFAILED; + return RFAILED; } } if(cmnLcInfo->bitMask & RGINF_BCCH_INFO) { dlSf->bcch.pdcch.rnti = - cmnLcInfo->bcchInfo.rnti; + cmnLcInfo->bcchInfo.rnti; dlSf->bcch.pdcch.dci = - cmnLcInfo->bcchInfo.dciInfo; + cmnLcInfo->bcchInfo.dciInfo; #ifdef TFU_UPGRADE /* ccpu00132314-ADD-Fill the tx Pwr offset from scheduler */ dlSf->bcch.txPwrOffset = cmnLcInfo->bcchInfo.txPwrOffset; #endif #ifndef RGR_SI_SCH if(NULLP == - (bcch=rgDBMGetBcchOnDlsch(cell,cmnLcInfo->bcchInfo.lcId))) + (bcch=rgDBMGetBcchOnDlsch(cell,cmnLcInfo->bcchInfo.lcId))) { - return RFAILED; + return RFAILED; } if(TRUE == cmnLcInfo->bcchInfo.sndStatInd) { - RG_FREE_MSG(bcch->tb); - if (rgAllocShrablSBuf (inst,(Data**)&staInd, - sizeof(RguCStaIndInfo)) != ROK) - { - err->errCause = RGERR_TOM_MEM_EXHAUST; - return RFAILED; - } - staInd->cellId = cell->cellId; - staInd->rnti = RG_INVALID_RNTI; - staInd->lcId = cmnLcInfo->bcchInfo.lcId; - staInd->transId = (timingInfo.sfn << 8) | (timingInfo.slot); -/* ADD Changes for Downlink UE Timing Optimization */ + RG_FREE_MSG(bcch->tb); + if (rgAllocShrablSBuf (inst,(Data**)&staInd, + sizeof(RguCStaIndInfo)) != ROK) + { + err->errCause = RGERR_TOM_MEM_EXHAUST; + return RFAILED; + } + staInd->cellId = cell->cellId; + staInd->rnti = RG_INVALID_RNTI; + staInd->lcId = cmnLcInfo->bcchInfo.lcId; + staInd->transId = (timingInfo.sfn << 8) | (timingInfo.slot); + /* ADD Changes for Downlink UE Timing Optimization */ #ifdef LTEMAC_DLUE_TMGOPTMZ - dlSf->remDatReqCnt++; + dlSf->remDatReqCnt++; #endif - if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK) - { - return RFAILED; - } + if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK) + { + return RFAILED; + } } else { - SCpyMsgMsg(bcch->tb, RG_GET_MEM_REGION(rgCb[inst]), - RG_GET_MEM_POOL(rgCb[inst]), &dlSf->bcch.tb); + SCpyMsgMsg(bcch->tb, RG_GET_MEM_REGION(rgCb[inst]), + RG_GET_MEM_POOL(rgCb[inst]), &dlSf->bcch.tb); } #else /*Store the received BCCH Data in the scheduled subframe*/ @@ -1723,21 +1568,13 @@ RgErrInfo *err; * -# ROK * -# RFAILED **/ -#ifdef ANSI -PRIVATE S16 rgHndlSchdUe + static S16 rgHndlSchdUe ( -RgCellCb *cell, -CmLteTimingInfo timingInfo, -RgInfUeInfo *ueInfo, -RgErrInfo *err -) -#else -PRIVATE S16 rgHndlSchdUe(cell, timingInfo, ueInfo, err) /* laa_ut_fix */ -RgCellCb *cell; -CmLteTimingInfo timingInfo; -RgInfUeInfo *ueInfo; -RgErrInfo *err; -#endif + RgCellCb *cell, + CmLteTimingInfo timingInfo, + RgInfUeInfo *ueInfo, + RgErrInfo *err + ) { @@ -1767,26 +1604,19 @@ RgErrInfo *err; * -# ROK * -# RFAILED **/ -#ifdef ANSI -PRIVATE S16 rgHndlUlUeInfo + static S16 rgHndlUlUeInfo ( -RgCellCb *cell, -CmLteTimingInfo timingInfo, -RgInfUlUeInfo *ueInfo -) -#else -PRIVATE S16 rgHndlUlUeInfo(cell, timingInfo, ueInfo) -RgCellCb *cell; -CmLteTimingInfo timingInfo; -RgInfUlUeInfo *ueInfo; -#endif + RgCellCb *cell, + CmLteTimingInfo timingInfo, + RgInfUlUeInfo *ueInfo + ) { Inst inst = cell->macInst - RG_INST_START; - U8 idx; + uint8_t idx; RgUlSf *ulSf; S16 ret; - + ulSf = &cell->ulSf[(timingInfo.slot % RGSCH_NUM_SUB_FRAMES)]; /* rg003.301-MOD- Corrected the purifier memory leak */ @@ -1794,8 +1624,8 @@ RgInfUlUeInfo *ueInfo; { if (ulSf->ueUlAllocInfo) { - rgFreeSBuf(inst,(Data **)&(ulSf->ueUlAllocInfo), - ulSf->numUe * sizeof(RgUeUlAlloc)); + rgFreeSBuf(inst,(Data **)&(ulSf->ueUlAllocInfo), + ulSf->numUe * sizeof(RgUeUlAlloc)); } } #ifdef XEON_SPECIFIC_CHANGES @@ -1805,12 +1635,12 @@ RgInfUlUeInfo *ueInfo; ulSf->numUe = ueInfo->numUes; if((ulSf->ueUlAllocInfo == NULLP) && (ueInfo->numUes > 0)) { - /* Allocate memory for ulAllocInfo */ - if((ret = rgAllocSBuf(inst,(Data**)&(cell->ulSf[(timingInfo.slot % RGSCH_NUM_SUB_FRAMES)]. - ueUlAllocInfo), ueInfo->numUes * sizeof(RgUeUlAlloc))) != ROK) - { - return (ret); - } + /* Allocate memory for ulAllocInfo */ + if((ret = rgAllocSBuf(inst,(Data**)&(cell->ulSf[(timingInfo.slot % RGSCH_NUM_SUB_FRAMES)]. + ueUlAllocInfo), ueInfo->numUes * sizeof(RgUeUlAlloc))) != ROK) + { + return (ret); + } } #ifdef XEON_SPECIFIC_CHANGES CM_MEAS_TIME((cell->crntTime.slot % RGSCH_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MEAS_ALLOC); @@ -1820,8 +1650,8 @@ RgInfUlUeInfo *ueInfo; { for(idx = 0; idx < ueInfo->numUes; idx++) { - ulSf->ueUlAllocInfo[idx].rnti = ueInfo->ulAllocInfo[idx].rnti; - ulSf->ueUlAllocInfo[idx].numPrb = ueInfo->ulAllocInfo[idx].numPrb; + ulSf->ueUlAllocInfo[idx].rnti = ueInfo->ulAllocInfo[idx].rnti; + ulSf->ueUlAllocInfo[idx].numPrb = ueInfo->ulAllocInfo[idx].numPrb; } } RGCPYTIMEINFO(timingInfo, ulSf->schdTime); @@ -1848,84 +1678,73 @@ RgInfUlUeInfo *ueInfo; * @return S16 * -# ROK **/ -#ifdef ANSI -Void rgTOMRlsSf -( -Inst inst, -RgDlSf *dlSf -) -#else -Void rgTOMRlsSf(dlSf) -Inst inst; -RgDlSf *dlSf; -#endif +Void rgTOMRlsSf(Inst inst,RgDlSf *dlSf) { - U8 idx; + uint8_t idx; if(dlSf->txDone == FALSE) { - RLOG0(L_ERROR, "SUBFRAME Not pushed to the PHY"); + DU_LOG("\nERROR --> MAC : SUBFRAME Not pushed to the PHY"); if (dlSf->bch.tb != NULLP) { - RG_FREE_MSG(dlSf->bch.tb); + RG_FREE_MSG(dlSf->bch.tb); } if (dlSf->bcch.tb != NULLP) { - RG_FREE_MSG(dlSf->bcch.tb); + RG_FREE_MSG(dlSf->bcch.tb); } if (dlSf->pcch.tb != NULLP) { - RG_FREE_MSG(dlSf->pcch.tb); + RG_FREE_MSG(dlSf->pcch.tb); } #ifdef EMTC_ENABLE rgTOMEmtcRlsSf(dlSf); #endif for(idx=0; idx < dlSf->numRaRsp; idx++) { - RG_FREE_MSG(dlSf->raRsp[idx].rar); + RG_FREE_MSG(dlSf->raRsp[idx].rar); } } -/* ADD Changes for Downlink UE Timing Optimization */ + /* ADD Changes for Downlink UE Timing Optimization */ #ifdef LTEMAC_DLUE_TMGOPTMZ dlSf->remDatReqCnt = 0; /* Fix[ccpu00126310]: Tracks Data Requests from RLC for both loosely and tight coupled RLC-MAC */ dlSf->statIndDone = FALSE; #endif - if (dlSf->tbs.count) - { - U8 i; + if (dlSf->tbs.count) + { + uint8_t i; CmLList *node; RgDlHqProcCb *hqP; - RGDBGERRNEW(inst, (rgPBuf(inst), - "Error Stale TBs in Subframes TBS list\n")); + DU_LOG("\nERROR --> MAC : Error Stale TBs in Subframes TBS list\n"); node = dlSf->tbs.first; - while(node) - { - hqP = (RgDlHqProcCb*)node->node; - node = node->next; - if (hqP) - { - for(i=0;i< RG_MAX_TB_PER_UE;i++) - { - if (hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf) - { - cmLListDelFrm(&dlSf->tbs, &(hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk)); - hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node = NULLP; - printf("\n rgTOMRlsSf:: hqP %p \n", (Void *)hqP); - } - hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf = NULLP; - } - } + while(node) + { + hqP = (RgDlHqProcCb*)node->node; + node = node->next; + if (hqP) + { + for(i=0;i< RG_MAX_TB_PER_UE;i++) + { + if (hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf) + { + cmLListDelFrm(&dlSf->tbs, &(hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk)); + hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node = NULLP; + DU_LOG("\nERROR --> MAC : rgTOMRlsSf:: hqP %p \n", (Void *)hqP); + } + hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf = NULLP; + } } - } - /*arjun: check if dlSf laaTb list has to be freed???*/ + } + } + /*arjun: check if dlSf laaTb list has to be freed???*/ cmLListInit(&dlSf->tbs); dlSf->txDone = FALSE; dlSf->numRaRsp = 0; - RETVOID; + return; } /** @@ -1945,43 +1764,33 @@ RgDlSf *dlSf; * @return S16 * -# ROK **/ -#ifdef ANSI -S16 rgHndlFlowCntrl -( -RgCellCb *cell, -RgInfSfAlloc *sfInfo -) -#else -S16 rgHndlFlowCntrl(cell, sfInfo) -RgCellCb *cell; -RgInfSfAlloc *sfInfo; -#endif +S16 rgHndlFlowCntrl(RgCellCb *cell,RgInfSfAlloc *sfInfo) { RguFlowCntrlInd *flowCntrlInd; Pst *pst; - U32 ueIdx; - U32 lcIdx; + uint32_t ueIdx; + uint32_t lcIdx; pst = &cell->rguDlSap->sapCfg.sapPst; /* flowCntrlInd is alloced in cell init time and will be re-used throughout */ flowCntrlInd = cell->flowCntrlInd; flowCntrlInd->cellId = sfInfo->cellId; flowCntrlInd->numUes = sfInfo->flowCntrlInfo.numUes; - + for (ueIdx = 0; ueIdx < sfInfo->flowCntrlInfo.numUes; ueIdx++) { flowCntrlInd->ueFlowCntrlInfo[ueIdx].ueId = sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].ueId; flowCntrlInd->ueFlowCntrlInfo[ueIdx].numLcs = sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].numLcs; - + for (lcIdx = 0; lcIdx < RGINF_MAX_NUM_DED_LC; lcIdx++) { - flowCntrlInd->ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].lcId = - sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].lcId; - flowCntrlInd->ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].pktAdmitCnt = - sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].pktAdmitCnt; - - flowCntrlInd->ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].maxBo4FlowCtrl = - sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].maxBo4FlowCtrl; + flowCntrlInd->ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].lcId = + sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].lcId; + flowCntrlInd->ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].pktAdmitCnt = + sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].pktAdmitCnt; + + flowCntrlInd->ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].maxBo4FlowCtrl = + sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].maxBo4FlowCtrl; } } RgUiRguFlowCntrlInd(pst, cell->rguDlSap->sapCfg.spId,flowCntrlInd); /* TODO: Rishi confirm if the suId and pst pointer is correct */ @@ -2013,22 +1822,12 @@ RgInfSfAlloc *sfInfo; * @return S16 * -# ROK **/ -#ifdef ANSI -S16 RgSchMacSfAllocReq -( -Pst *pst, -RgInfSfAlloc *sfInfo -) -#else -S16 RgSchMacSfAllocReq(pst, sfInfo) -Pst *pst; -RgInfSfAlloc *sfInfo; -#endif +S16 RgSchMacSfAllocReq(Pst *pst,RgInfSfAlloc *sfInfo) { RgCellCb *cell; RgDlSf *dlSf; RgErrInfo err; - VOLATILE U32 startTime=0; + volatile uint32_t startTime=0; Inst inst; @@ -2044,7 +1843,7 @@ RgInfSfAlloc *sfInfo; if((cell = rgCb[inst].cell) == NULLP) { - RLOG_ARG0(L_ERROR,DBG_CELLID,sfInfo->cellId, "No cellCb found with cell"); + DU_LOG("\nERROR --> MAC : No cellCb found with cell"); return RFAILED; } @@ -2060,10 +1859,10 @@ RgInfSfAlloc *sfInfo; /* Fix : syed Ignore Failure Returns and continue processing. * Incomplete processing results in state sync loss between MAC-SCH. */ #ifdef EMTC_ENABLE - if(TRUE == cell->emtcEnable) - { - rgEmtcHndl(cell, sfInfo); - } + if(TRUE == cell->emtcEnable) + { + rgEmtcHndl(cell, sfInfo); + } #endif rgHndlCmnChnl(cell, sfInfo->timingInfo, &sfInfo->cmnLcInfo, &err); @@ -2085,7 +1884,7 @@ RgInfSfAlloc *sfInfo; #ifdef LTE_L2_MEAS if(rgHndlUlUeInfo(cell, sfInfo->ulUeInfo.timingInfo, - &sfInfo->ulUeInfo) != ROK) + &sfInfo->ulUeInfo) != ROK) { return RFAILED; } @@ -2105,18 +1904,18 @@ RgInfSfAlloc *sfInfo; RLC-MAC */ if(!(dlSf->txDone) && #ifdef LTE_ADV - (TRUE == rgLaaChkAllRxTbs(dlSf)) && + (TRUE == rgLaaChkAllRxTbs(dlSf)) && #endif - (0 == dlSf->remDatReqCnt) && (dlSf->statIndDone) && - (RG_TIMEINFO_SAME(cell->crntTime, dlSf->schdTime))) + (0 == dlSf->remDatReqCnt) && (dlSf->statIndDone) && + (RG_TIMEINFO_SAME(cell->crntTime, dlSf->schdTime))) { /*This is the case of rettransmission, so no need * to wait for TTI Ind to push TFU Data Request. Send * it right away.*/ if (ROK != rgTOMUtlProcDlSf (dlSf, cell, &err)) { - RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to process downlink subframe for cell"); - err.errType = RGERR_ROM_DEDDATREQ; + DU_LOG("\nERROR --> MAC : Unable to process downlink subframe for cell"); + err.errType = RGERR_ROM_DEDDATREQ; } /* Mark this frame as sent */ dlSf->txDone = TRUE; @@ -2124,7 +1923,7 @@ RgInfSfAlloc *sfInfo; #endif if (sfInfo->flowCntrlInfo.numUes > 0) { - rgHndlFlowCntrl(cell,sfInfo); + rgHndlFlowCntrl(cell,sfInfo); } /*stoping Task*/ SStopTask(startTime, PID_MAC_SF_ALLOC_REQ); @@ -2159,25 +1958,15 @@ RgInfSfAlloc *sfInfo; * -# ROK * -# RFAILED **/ -#ifdef ANSI -PRIVATE S16 rgTOMProcCrntiCEInDatInd + static S16 rgTOMProcCrntiCEInDatInd ( -RgMacPdu *pdu, -RgUeCb *prevUeCb, -RgCellCb *cellCb, -TfuDatInfo *datInfo, -RgInfCeInfo *ceInfo, -U16 slot -) -#else -PRIVATE S16 rgTOMProcCrntiCEInDatInd( pdu, prevUeCb, cellCb, datInfo, ceInfo, slot) -RgMacPdu *pdu; -RgUeCb *prevUeCb; -RgCellCb *cellCb; -TfuDatInfo *datInfo; -RgInfCeInfo *ceInfo; -U16 slot; -#endif + RgMacPdu *pdu, + RgUeCb *prevUeCb, + RgCellCb *cellCb, + TfuDatInfo *datInfo, + RgInfCeInfo *ceInfo, + uint16_t slot + ) { RgUeCb *ueCb = NULLP; Inst inst = cellCb->macInst - RG_INST_START; @@ -2185,46 +1974,42 @@ U16 slot; #ifdef LTEMAC_SPS Bool spsToBeActvtd; - U16 sduSize; + uint16_t sduSize; #endif #ifndef LTE_L2_MEAS - UNUSED(slot); + UNUSED(slot); #endif ueCb = rgDBMGetUeCbFromRachLst (cellCb, datInfo->rnti); if (ueCb == NULLP) { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "RNTI:%d Received MSG3 with CRNTI,unable to find ueCb", ceInfo->ces.cRnti); - return RFAILED; + DU_LOG("\nERROR --> MAC : RNTI:%d Received MSG3 with CRNTI,unable to find ueCb", ceInfo->ces.cRnti); + return RFAILED; } prevUeCb = rgDBMGetUeCb (cellCb, ceInfo->ces.cRnti); if (prevUeCb == NULLP) { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "RNTI:%d Received MSG3 with CRNTI,unable to find ueCb", ceInfo->ces.cRnti); - return RFAILED; + DU_LOG("\nERROR --> MAC : RNTI:%d Received MSG3 with CRNTI,unable to find ueCb", ceInfo->ces.cRnti); + return RFAILED; } - RLOG_ARG2(L_DEBUG,DBG_CELLID,cellCb->cellId, - "CRNTI CE(%d) received through tmpCrnti(%d)", - ceInfo->ces.cRnti, datInfo->rnti); + DU_LOG("\nERROR --> MAC : CRNTI CE(%d) received through tmpCrnti(%d)", + ceInfo->ces.cRnti, datInfo->rnti); rgDBMDelUeCbFromRachLst(cellCb, ueCb); rgRAMFreeUeCb(inst,ueCb); ueCb = prevUeCb; #ifdef LTEMAC_SPS if ((rgTOMUtlProcMsg(cellCb, ueCb, pdu, FALSE,&spsToBeActvtd,&sduSize, slot, NULLP)) != ROK) #else - if ((rgTOMUtlProcMsg (cellCb, ueCb, pdu, slot, NULLP)) != ROK) + if ((rgTOMUtlProcMsg (cellCb, ueCb, pdu, slot, NULLP)) != ROK) #endif /* LTEMAC_SPS */ - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "RNTI:%d Processing for MSG3 failed",datInfo->rnti); - return RFAILED; - } + { + DU_LOG("\nERROR --> MAC : RNTI:%d Processing for MSG3 failed",datInfo->rnti); + return RFAILED; + } return ROK; } /** @@ -2260,83 +2045,70 @@ U16 slot; * -# ROK * -# RFAILED **/ -#ifdef ANSI -PRIVATE S16 rgTOMProcCCCHSduInDatInd + static S16 rgTOMProcCCCHSduInDatInd ( -RgMacPdu *pdu, -RgUeCb *prevUeCb, -RgCellCb *cellCb, -TfuDatInfo *datInfo, -RgInfCeInfo *ceInfo, -U16 slot -) -#else -PRIVATE S16 rgTOMProcCCCHSduInDatInd( pdu, prevUeCb, cellCb, datInfo, ceInfo, slot) -RgMacPdu *pdu; -RgUeCb *prevUeCb; -RgCellCb *cellCb; -TfuDatInfo *datInfo; -RgInfCeInfo *ceInfo; -U16 slot; -#endif + RgMacPdu *pdu, + RgUeCb *prevUeCb, + RgCellCb *cellCb, + TfuDatInfo *datInfo, + RgInfCeInfo *ceInfo, + uint16_t slot + ) { RgUeCb *ueCb = NULLP; Inst inst = cellCb->macInst - RG_INST_START; #ifdef LTEMAC_SPS Bool spsToBeActvtd; - U16 sduSize; + uint16_t sduSize; #endif #ifndef LTE_L2_MEAS - UNUSED(slot); + UNUSED(slot); #endif if (ceInfo->bitMask & RG_CRNTI_CE_PRSNT) { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "CRNTI:%d Received MSG3 with CCCH",ceInfo->ces.cRnti); - return RFAILED; + DU_LOG("\nERROR --> MAC : CRNTI:%d Received MSG3 with CCCH",ceInfo->ces.cRnti); + return RFAILED; } - + ueCb = rgDBMGetUeCbFromRachLst (cellCb, datInfo->rnti); - + if (ueCb == NULLP) { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId, - "RNTI:%d Processing for MSG3 failed", datInfo->rnti); - return RFAILED; + DU_LOG("\nERROR --> MAC : RNTI:%d Processing for MSG3 failed", datInfo->rnti); + return RFAILED; } /* Fix: syed Drop any duplicate Msg3(CCCH Sdu) */ if (ueCb->dl.hqEnt.numHqProcs) { /* HqE is already initialized by a previuos Msg3 */ - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"RNTI:%d Processing for MSG3 failed. Duplicate " - "MSG3 received. Dropping", datInfo->rnti); - return RFAILED; + DU_LOG("\nERROR --> MAC : RNTI:%d Processing for MSG3 failed. Duplicate " + "MSG3 received. Dropping", datInfo->rnti); + return RFAILED; } - + if(rgDHMHqEntInit(inst,&ueCb->dl.hqEnt, - cellCb->maxDlHqProcPerUe) != ROK) + cellCb->maxDlHqProcPerUe) != ROK) { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"RNTI:%d Harq Initialization failed ", - datInfo->rnti); - return RFAILED; + DU_LOG("\nERROR --> MAC : RNTI:%d Harq Initialization failed ", + datInfo->rnti); + return RFAILED; } - RLOG_ARG1(L_DEBUG,DBG_CELLID,cellCb->cellId, - "CCCH SDU received through tmpCrnti(%d)",datInfo->rnti); + DU_LOG("\nDEBUG --> MAC : CCCH SDU received through tmpCrnti(%d)",datInfo->rnti); #ifdef LTEMAC_SPS if ((rgTOMUtlProcMsg(cellCb, ueCb, pdu, FALSE,&spsToBeActvtd,&sduSize, slot, NULLP)) != ROK) #else - if ((rgTOMUtlProcMsg (cellCb, ueCb, pdu, slot, NULLP)) != ROK) + if ((rgTOMUtlProcMsg (cellCb, ueCb, pdu, slot, NULLP)) != ROK) #endif /* LTEMAC_SPS */ - { - RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"RNTI:%d Processing for MSG3 failed", - datInfo->rnti); - return RFAILED; - } + { + DU_LOG("\nERROR --> MAC : RNTI:%d Processing for MSG3 failed", + datInfo->rnti); + return RFAILED; + } return ROK; } @@ -2358,20 +2130,10 @@ U16 slot; * @return S16 */ -#ifdef ANSI -PRIVATE S16 rgTOMUtlL2MStoreBufSz -( - RgUeCb *ueCb, - RgInfCeInfo *ceInfo - ) -#else -PRIVATE S16 rgTOMUtlL2MStoreBufSz (ueCb, ceInfo) - RgUeCb *ueCb; - RgInfCeInfo *ceInfo; -#endif +static S16 rgTOMUtlL2MStoreBufSz( RgUeCb *ueCb, RgInfCeInfo *ceInfo ) { - U8 lcgId; - U8 bsr; + uint8_t lcgId; + uint8_t bsr; if(ceInfo->bitMask & RG_TRUNC_BSR_CE_PRSNT) { @@ -2409,21 +2171,7 @@ PRIVATE S16 rgTOMUtlL2MStoreBufSz (ueCb, ceInfo) * -# ROK * -# RFAILED */ -#ifdef ANSI -PRIVATE Void rgTOML2MCompileActiveLCs -( - RgCellCb *cellCb, - RgUeCb *ueCb, - RgMacPdu *pdu, - RgInfCeInfo *ceInfo - ) -#else -PRIVATE Void rgTOML2MCompileActiveLCs(cellCb, ueCb, pdu, ceInfo) - RgCellCb *cellCb; - RgUeCb *ueCb; - RgMacPdu *pdu; - RgInfCeInfo *ceInfo; -#endif +static Void rgTOML2MCompileActiveLCs(RgCellCb *cellCb,RgUeCb *ueCb,RgMacPdu *pdu,RgInfCeInfo *ceInfo) { CmLList *node; RgMacSdu *sdu; @@ -2434,14 +2182,14 @@ PRIVATE Void rgTOML2MCompileActiveLCs(cellCb, ueCb, pdu, ceInfo) while (node) { sdu = (RgMacSdu*)node->node; - + if ((ulLcCb = rgDBMGetUlDedLcCb(ueCb, sdu->lcId)), ulLcCb != NULLP) { - if (ulLcCb->lcgId != 0) - { - ceInfo->bitMask |= RG_ACTIVE_LC_PRSNT; - ceInfo->ulActLCs[ulLcCb->lcId - 1] = TRUE; - } + if (ulLcCb->lcgId != 0) + { + ceInfo->bitMask |= RG_ACTIVE_LC_PRSNT; + ceInfo->ulActLCs[ulLcCb->lcId - 1] = TRUE; + } } node = node->next; } @@ -2452,6 +2200,6 @@ PRIVATE Void rgTOML2MCompileActiveLCs(cellCb, ueCb, pdu, ceInfo) #endif /********************************************************************** - - End of file -**********************************************************************/ + + End of file + **********************************************************************/