From: lal.harshita Date: Wed, 10 Feb 2021 12:10:39 +0000 (+0530) Subject: RLC DL AMD PDU changes [Issue-ID: ODUHIGH-290] X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=438594773b3c93b5bbe8d1cb1d16626a02238b8b;p=o-du%2Fl2.git RLC DL AMD PDU changes [Issue-ID: ODUHIGH-290] Change-Id: Ic9700c2bae4e0f0997ddaf3fc5b62bac8532f682 Signed-off-by: lal.harshita --- diff --git a/src/5gnrmac/mac_msg_hdl.c b/src/5gnrmac/mac_msg_hdl.c index 7966445a4..e227e8df7 100644 --- a/src/5gnrmac/mac_msg_hdl.c +++ b/src/5gnrmac/mac_msg_hdl.c @@ -210,13 +210,13 @@ uint8_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd) * ****************************************************************/ uint8_t MacProcRlcDlData(Pst* pstInfo, RlcData *dlData) { - uint8_t pduIdx =0; - uint8_t lcIdx = 0; - uint8_t *txPdu =NULLP; - uint16_t tbSize =0; - MacDlData macDlData; - MacDlSlot *currDlSlot = NULLP; - DlRlcBoInfo dlBoInfo; + uint8_t pduIdx =0; + uint8_t lcIdx = 0; + uint8_t *txPdu =NULLP; + uint16_t tbSize =0; + MacDlData macDlData; + MacDlSlot *currDlSlot = NULLP; + DlRlcBoInfo dlBoInfo; memset(&macDlData , 0, sizeof(MacDlData)); DU_LOG("\nDEBUG --> MAC: Received DL data for sfn=%d slot=%d numPdu= %d", \ diff --git a/src/5gnrrlc/kw.h b/src/5gnrrlc/kw.h index ac1e620a3..4ef9c79b7 100755 --- a/src/5gnrrlc/kw.h +++ b/src/5gnrrlc/kw.h @@ -547,7 +547,6 @@ #define RLC_POLL_SET 0x40 /* 01000000 */ #define RLC_POLL_UNSET 0xbf /* 10111111 */ -#define RLC_AM_WIN_SZ 512 #define RLC_MAX_NACK_CNT 100 /*RLC_MAX_CNTRL_FIELDS (Maximum size of Status Pdu) * = MAX_NACK_CNT * sizeof(NACK_SN,E1,E2,E3,soStart,soEnd, nackRange) diff --git a/src/5gnrrlc/kw_amm_dl.c b/src/5gnrrlc/kw_amm_dl.c index 1bc8ef544..fd745946d 100755 --- a/src/5gnrrlc/kw_amm_dl.c +++ b/src/5gnrrlc/kw_amm_dl.c @@ -1632,7 +1632,6 @@ static void rlcAssembleSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *rlcDatReq) rlcUtlGetCurrTime(&curTime); amDl->sduQ.crnt = &sdu->lstEnt; /* Eliminate fixed header size */ - /*5GNR: value of RLC_AM_PDU_FIXED_HDRSZ will be 2 or 3 depending on SN Size*/ if(amDl->snLen == RLC_AM_CFG_12BIT_SN_LEN) { fixedHdrSz = RLC_AM_PDU_12BIT_SN_HDRSZ; @@ -1653,7 +1652,6 @@ static void rlcAssembleSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *rlcDatReq) if ((sdu->mode.am.isSegmented == FALSE) && (rbCb->discTmrInt > 0) && \ (rbCb->rlcId.rbType == CM_LTE_DRB)) { - //leftAmSdus[rbCb->qci]--; timeDiff = RLC_TIME_DIFF(curTime,sdu->arrTime); if (timeDiff > rbCb->discTmrInt) { @@ -1705,15 +1703,11 @@ static void rlcAssembleSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *rlcDatReq) #ifdef LTE_L2_MEAS newIdx = FALSE; #endif - /** kw003.201 - Check for window stall when you are - * creating a new PDU - */ + /** Check for window stall when you are creating a new PDU */ if (RLC_AM_IS_TRANS_WIN_STALLED(amDl)) { - //int *a = NULLP; DU_LOG("\nINFO --> RLC_DL : Window stalled \n"); gRlcStats.amRlcStats.numRlcAmCellWinStall++; - //*a = 10; break; } @@ -1725,15 +1719,11 @@ static void rlcAssembleSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *rlcDatReq) hdrEstmt += 2; } /* Eliminate MAC header */ - /* ccpu00135743 : Fix for MAC Hdr size calculation */ - /*5GNR: value of mac hdr length field changed to 8/16bits */ pduSz = RLC_MIN(macGrntSz, (sdu->sduSz + hdrEstmt)); hdrEstmt += (pduSz < 255) ? RLC_MAC_HDR_SZ2 : RLC_MAC_HDR_SZ3; macGrntSz -= hdrEstmt; - /* kw005.201 Check for PDU Size is large enough. - * Fix for ccpu00118973 - * */ + /* Check for PDU Size is large enough */ if(macGrntSz <= 0) { break; @@ -1790,6 +1780,12 @@ static void rlcAssembleSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *rlcDatReq) pduInfo->amHdr.sn = amDl->txNext; + /* No Segmentation scenario : + * If SDU size is less than or equal to the requested PDU size + * - Allocate memory and copy SDU into it. + * -# Update BO + * -# Remove SDU from the Queue. + */ if (macGrntSz >= sdu->sduSz) { pdu = sdu->mBuf; @@ -1803,11 +1799,7 @@ static void rlcAssembleSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *rlcDatReq) pduInfo->amHdr.so = sdu->actSz - sdu->sduSz; sdu->mode.am.isSegmented = FALSE; - gRlcStats.amRlcStats.numRlcAmCellSduTx++; - //DU_LOG("\nINFO --> RLC_DL : 5GNRLOG: last segment of lcId %d SduId %u So %u macGrntSz\ - %u sduActSz %u sdu->sduSz %u\n", - // rbCb->lch.lChId, sdu->mode.am.sduId, pduInfo->amHdr.so, macGrntSz, sdu->actSz, sdu->sduSz); } else { @@ -1817,8 +1809,6 @@ static void rlcAssembleSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *rlcDatReq) /* Create PDU with hdr and data */ rlcAmmCreatePdu(gCb,rbCb, amHdr, pduInfo, pdu); - //DU_LOG("\nINFO --> Segmentation not required case: numPdu %d pdu %p \n",rlcDatReq->pduInfo.numPdu, pdu); - #ifdef LTE_L2_MEAS_RLC rlcUtlUpdSduSnMap(rbCb, sdu, rlcDatReq, TRUE); #endif /* LTE_L2_MEAS */ @@ -1841,7 +1831,6 @@ static void rlcAssembleSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *rlcDatReq) rlcUtlUpdateOutStandingSduLst(dlIpThPut, *sduIdx, sdu->actSz, sdu->mode.am.sduId, newIdx); /* Update the arrival time for each SDU */ - /* ccpu00143043 */ if ( lchInfo.numSdus < RLC_L2MEAS_SDUIDX) { lchInfo.sduInfo[lchInfo.numSdus].arvlTime = sdu->arrTime; @@ -1860,7 +1849,6 @@ static void rlcAssembleSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *rlcDatReq) Buffer *remSeg = NULLP; - //DU_LOG("\nINFO --> SDU segmentation case: numPdu %d pdu %p \n", rlcDatReq->pduInfo.numPdu, pdu); #ifdef LTE_L2_MEAS if(RLC_MEAS_IS_DL_IP_MEAS_ON_FOR_RB(gCb,rbCb) || RLC_MEAS_IS_DL_DELAY_MEAS_ON_FOR_RB(gCb,rbCb) || @@ -1905,10 +1893,6 @@ static void rlcAssembleSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *rlcDatReq) pduInfo->amHdr.sn = sdu->mode.am.sn; pduInfo->amHdr.si = RLC_SI_MID_SEG; /* binary 11 */ pduInfo->amHdr.so = sdu->actSz - sdu->sduSz; - - //DU_LOG("\nINFO --> RLC_DL : 5GNRLOG: mid segment of lcId %d SduId %u So %u macGrntSz %u sduActSz\ - %u sdu->sduSz %u\n", - // rbCb->lch.lChId, sdu->mode.am.sduId, txBuf->amHdr.so, macGrntSz, sdu->actSz, sdu->sduSz); } else { @@ -1918,9 +1902,6 @@ static void rlcAssembleSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *rlcDatReq) sdu->mode.am.sn = pduInfo->amHdr.sn; pduInfo->amHdr.so = 0; - //DU_LOG("\nINFO --> RLC_DL : 5GNRLOG: First segment of lcId %d SduId %u So\ - %u macGrntSz %u sduActSz %u sdu->sduSz %u\n", - // rbCb->lch.lChId, sdu->mode.am.sduId, txBuf->amHdr.so, macGrntSz, sdu->actSz, sdu->sduSz); } amHdr = &pduInfo->amHdr; @@ -2132,12 +2113,9 @@ RlcDlPduInfo *pduInfo, Buffer *pdu) /* Update sn */ amHdr->sn = amDl->txNext; - /*5GNR RLC_DL : Increment txNext only if no segmentation of it is a last segment */ if((!amHdr->si) || (amHdr->si == RLC_SI_LAST_SEG)) { - //DU_LOG("\nINFO --> RLC_DL : 5GNRLOG: no segment/last seg SDU with lcId %d Sn %u txNext %u So %u\n", - // rbCb->lch.lChId, amHdr->sn, amDl->txNext, amHdr->so); amDl->txNext = (amDl->txNext + 1) & amDl->snModMask; } diff --git a/src/5gnrrlc/kw_cfg_dl.c b/src/5gnrrlc/kw_cfg_dl.c index 4e58f68c6..8c9da76d5 100755 --- a/src/5gnrrlc/kw_cfg_dl.c +++ b/src/5gnrrlc/kw_cfg_dl.c @@ -47,6 +47,7 @@ static int RLOG_FILE_ID=191; /* header (.h) include files */ #include "common_def.h" +#include "math.h" #include "lkw.h" /* LKW defines */ #include "ckw.h" /* CKW defines */ #include "kwu.h" /* KWU defines */ @@ -66,6 +67,7 @@ static int RLOG_FILE_ID=191; #include "kw.x" #include "kw_udx.x" #include "kw_dl.x" +#include "du_app_rlc_inf.h" #define RLC_MODULE RLC_DBGMASK_CFG /*Added for adding new Ue in onging L2 Meas*/ @@ -301,6 +303,7 @@ static S16 rlcAddToDlL2Meas(RlcCb *gCb, RlcDlRbCb *rlcRbCb,uint8_t cellId,uint8_ return ROK; }/*rlcAddToDlL2Meas*/ #endif /*LTE_L2_MEAS*/ + /** * @brief @@ -365,8 +368,9 @@ static S16 rlcCfgFillDlRbCb(RlcCb *gCb,RlcDlRbCb *rbCb,RlcDlUeCb *ueCb,RlcEntCfg rbCb->lch.lChId = entCfg->lCh[0].lChId; rbCb->lch.lChType = entCfg->lCh[0].type; rbCb->dir = RLC_DIR_BOTH; + rbCb->m.amDl.pollPdu = entCfg->m.amInfo.dl.pollPdu; - rbCb->m.amDl.pollByte = entCfg->m.amInfo.dl.pollByte; + rbCb->m.amDl.pollByte = entCfg->m.amInfo.dl.pollByte; rbCb->m.amDl.maxRetx = entCfg->m.amInfo.dl.maxRetx; rbCb->m.amDl.pollRetxTmrInt = entCfg->m.amInfo.dl.pollRetxTmr; rbCb->m.amDl.snLen = entCfg->m.amInfo.dl.snLen; @@ -381,8 +385,6 @@ static S16 rlcCfgFillDlRbCb(RlcCb *gCb,RlcDlRbCb *rbCb,RlcDlUeCb *ueCb,RlcEntCfg } cmInitTimers(&(rbCb->m.amDl.pollRetxTmr), 1); - - ueCb->lCh[rbCb->lch.lChId - 1].dlRbCb = rbCb; #ifndef LTE_TDD diff --git a/src/5gnrrlc/kw_dl.x b/src/5gnrrlc/kw_dl.x index 2d9f80603..e4d1bc594 100755 --- a/src/5gnrrlc/kw_dl.x +++ b/src/5gnrrlc/kw_dl.x @@ -201,7 +201,7 @@ typedef struct rlcUmDl { CmLListCp sduQ; /*!< SDU queue for UM */ uint8_t snLen; /*!< Sequence number length */ - S32 bo; /*!< Buffer occupancy */ + int32_t bo; /*!< Buffer occupancy */ RlcSn txNext; /*!< TX_Next */ uint16_t modBitMask; /*!< Bitmask for modulus to wrap around vars*/ }RlcUmDl; @@ -335,13 +335,13 @@ typedef struct rlcAmDl RlcSdu *nxtTx; /*!< Next SDU to be transmitted */ CmTimer pollRetxTmr; /*!< T_poll_retransmit Timer */ uint16_t pollRetxTmrInt; /*!< Timer Interval */ - S16 pollPdu; /*!< Poll_PDU */ - S32 pollByte; /*!< Poll_Byte */ + int16_t pollPdu; /*!< Poll_PDU */ + int32_t pollByte; /*!< Poll_Byte */ uint8_t maxRetx; /*!< Max_Retx_Threshold */ - S32 cntrlBo; /*!< BO of control pdu */ - S32 retxBo; /*!< BO of Retransmission PDUs */ + int32_t cntrlBo; /*!< BO of control pdu */ + int32_t retxBo; /*!< BO of Retransmission PDUs */ uint32_t estHdrSz; /*!< Estimated header size for the BO */ - S32 bo; /*!< BO of new PDUs */ + int32_t bo; /*!< BO of new PDUs */ #ifndef LTE_TDD CmLListCp *txBufLst; /*!< Transmission buffer list of type RlcTx */ #else @@ -351,8 +351,8 @@ typedef struct rlcAmDl RlcRetx *nxtRetx; /*!< Next node to be retransmitted */ RlcSn txNext; /*!< 5GNR: TX_Next, in LTE VT(S) */ RlcSn txNextAck; /*!< 5GNR: TX_Next_Ack, in LTE VT(A)*/ - S16 pduWoPoll; /*!< PDU without poll bit counter */ - S32 byteWoPoll; /*!< Byte without poll bit counter */ + int16_t pduWoPoll; /*!< PDU without poll bit counter */ + int32_t byteWoPoll; /*!< Byte without poll bit counter */ RlcSn pollSn; /*!< Poll SN */ Buffer *mBuf; /*!< this can be removed later Stores the Control Pdu */ diff --git a/src/5gnrrlc/kw_lmm.c b/src/5gnrrlc/kw_lmm.c index b52f54205..5500bec46 100755 --- a/src/5gnrrlc/kw_lmm.c +++ b/src/5gnrrlc/kw_lmm.c @@ -247,10 +247,9 @@ static S16 rlcLmmGenCfg(RlcCb *gCb,RlcGenCfg *cfg) RLOG0(L_FATAL,"RLC DL Initialization failed"); return (LCM_REASON_MEM_NOAVAIL); } -#if 0 + /* Register the timer */ -/*Pradeep: changing the SRegTmrMt() to SRegTmr()*/ - if(SRegTmrMt(gCb->init.ent, gCb->init.inst, (uint16_t)cfg->timeRes, + if(ODU_REG_TMR_MT(gCb->init.ent, gCb->init.inst, (uint16_t)cfg->timeRes, rlcActvTmr) != ROK) { RLC_FREE(gCb,gCb->u.dlCb->udxDlSap, rlcUdxSapSize); @@ -260,7 +259,7 @@ static S16 rlcLmmGenCfg(RlcCb *gCb,RlcGenCfg *cfg) return (LCM_REASON_REGTMR_FAIL); } -#endif + /* initializations for background processing of freeing memory */ rlcUtlInitToBeFreed(gCb, &(gCb->u.dlCb->toBeFreed)); rlcUtlInitializeSelfPst(gCb); diff --git a/src/5gnrrlc/kw_utl_dl.c b/src/5gnrrlc/kw_utl_dl.c index 4dc952667..52276399c 100755 --- a/src/5gnrrlc/kw_utl_dl.c +++ b/src/5gnrrlc/kw_utl_dl.c @@ -301,12 +301,12 @@ uint8_t rlcSendDedLcDlData(Pst *post, SpId spId, RguDDatReqInfo *datReqInfo) dlData->numPdu++; }/* For per PDU */ - dlData->boStatus[dlData->numLc].cellId = datReqInfo->cellId; + dlData->boStatus[dlData->numLc].cellId = datReqInfo->cellId; GET_UE_IDX(datPerUe.rnti, dlData->boStatus[dlData->numLc].ueIdx); - dlData->boStatus[dlData->numLc].commCh = false; - dlData->boStatus[dlData->numLc].lcId = datPerLch.lcId; - dlData->boStatus[dlData->numLc].bo = datPerLch.boReport.bo + datPerLch.boReport.estRlcHdrSz; - dlData->numLc++; + dlData->boStatus[dlData->numLc].commCh = false; + dlData->boStatus[dlData->numLc].lcId = datPerLch.lcId; + dlData->boStatus[dlData->numLc].bo = datPerLch.boReport.bo + datPerLch.boReport.estRlcHdrSz; + dlData->numLc++; }/* For Data per Lch */ }/* For Data per Tb */ diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index e1388a738..be2530a93 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -49,7 +49,6 @@ #define CRC_FAILED 0 #define CRC_PASSED 1 -#define RLC_HDR_SIZE 3 /* 3 bytes of RLC Header size */ #define MAC_HDR_SIZE 3 /* 3 bytes of MAC Header */ #define UL_GRANT_SIZE 224 diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 44864f00b..2c8a853ed 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -176,7 +176,7 @@ uint8_t schFillBoGrantDlSchedInfo(SchCellCb *cell, DlSchedInfo *dlSchedInfo, DlM /* calculation for BO includse RLC and MAC header size */ dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc].schBytes = \ - ueCb->dlInfo.dlLcCtxt[lcIdx].bo + RLC_HDR_SIZE + MAC_HDR_SIZE; + ueCb->dlInfo.dlLcCtxt[lcIdx].bo + MAC_HDR_SIZE; accumalatedSize += dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc].schBytes; dlMsgAlloc->numLc++; } diff --git a/src/cm/common_def.h b/src/cm/common_def.h index 4dd2abfa3..56a9bae5d 100644 --- a/src/cm/common_def.h +++ b/src/cm/common_def.h @@ -236,6 +236,7 @@ typedef struct tddCfg uint64_t gSlotCount; +uint64_t gDlDataRcvdCnt; /* Number of DL data received at EGTP */ void freqDomRscAllocType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain); void oduCpyFixBufToMsg(uint8_t *fixBuf, Buffer *mBuf, uint16_t len); diff --git a/src/cm/du_app_rlc_inf.h b/src/cm/du_app_rlc_inf.h index ce1901fe6..de1f18eed 100644 --- a/src/cm/du_app_rlc_inf.h +++ b/src/cm/du_app_rlc_inf.h @@ -96,7 +96,7 @@ typedef enum typedef enum { - AM_SIZE_12, + AM_SIZE_12 = 1, AM_SIZE_18 }SnLenAm; @@ -106,194 +106,6 @@ typedef enum UM_SIZE_12 }SnLenUm; -typedef enum -{ - POLL_RETX_TMR_5MS, - POLL_RETX_TMR_10MS, - POLL_RETX_TMR_15MS, - POLL_RETX_TMR_20MS, - POLL_RETX_TMR_25MS, - POLL_RETX_TMR_30MS, - POLL_RETX_TMR_35MS, - POLL_RETX_TMR_40MS, - POLL_RETX_TMR_45MS, - POLL_RETX_TMR_50MS, - POLL_RETX_TMR_55MS, - POLL_RETX_TMR_60MS, - POLL_RETX_TMR_65MS, - POLL_RETX_TMR_70MS, - POLL_RETX_TMR_75MS, - POLL_RETX_TMR_80MS, - POLL_RETX_TMR_85MS, - POLL_RETX_TMR_90MS, - POLL_RETX_TMR_95MS, - POLL_RETX_TMR_100MS, - POLL_RETX_TMR_105MS, - POLL_RETX_TMR_110MS, - POLL_RETX_TMR_115MS, - POLL_RETX_TMR_120MS, - POLL_RETX_TMR_125MS, - POLL_RETX_TMR_130MS, - POLL_RETX_TMR_135MS, - POLL_RETX_TMR_140MS, - POLL_RETX_TMR_145MS, - POLL_RETX_TMR_150MS, - POLL_RETX_TMR_155MS, - POLL_RETX_TMR_160MS, - POLL_RETX_TMR_165MS, - POLL_RETX_TMR_170MS, - POLL_RETX_TMR_175MS, - POLL_RETX_TMR_180MS, - POLL_RETX_TMR_185MS, - POLL_RETX_TMR_190MS, - POLL_RETX_TMR_195MS, - POLL_RETX_TMR_200MS, - POLL_RETX_TMR_205MS, - POLL_RETX_TMR_210MS, - POLL_RETX_TMR_215MS, - POLL_RETX_TMR_220MS, - POLL_RETX_TMR_225MS, - POLL_RETX_TMR_230MS, - POLL_RETX_TMR_235MS, - POLL_RETX_TMR_240MS, - POLL_RETX_TMR_245MS, - POLL_RETX_TMR_250MS, - POLL_RETX_TMR_300MS, - POLL_RETX_TMR_350MS, - POLL_RETX_TMR_400MS, - POLL_RETX_TMR_450MS, - POLL_RETX_TMR_500MS, - POLL_RETX_TMR_800MS, - POLL_RETX_TMR_1000MS, - POLL_RETX_TMR_2000MS, - POLL_RETX_TMR_4000MS, - POLL_RETX_TMR_SPARE5, - POLL_RETX_TMR_SPARE4, - POLL_RETX_TMR_SPARE3, - POLL_RETX_TMR_SPARE2, - POLL_RETX_TMR_SPARE1 - -}TpollReTxTmr; - -typedef enum -{ - POLL_PDU_TMR_4MS, - POLL_PDU_TMR_8MS, - POLL_PDU_TMR_16MS, - POLL_PDU_TMR_32MS, - POLL_PDU_TMR_64MS, - POLL_PDU_TMR_128MS, - POLL_PDU_TMR_256MS, - POLL_PDU_TMR_512MS, - POLL_PDU_TMR_1024MS, - POLL_PDU_TMR_2048MS, - POLL_PDU_TMR_4096MS, - POLL_PDU_TMR_6144MS, - POLL_PDU_TMR_8192MS, - POLL_PDU_TMR_12288MS, - POLL_PDU_TMR_16384MS, - POLL_PDU_TMR_20480MS, - POLL_PDU_TMR_24576MS, - POLL_PDU_TMR_28672MS, - POLL_PDU_TMR_32768MS, - POLL_PDU_TMR_40960MS, - POLL_PDU_TMR_49152MS, - POLL_PDU_TMR_57344MS, - POLL_PDU_TMR_65536MS, - POLL_PDU_TMR_INFINITY, - POLL_PDU_TMR_SPARE_8, - POLL_PDU_TMR_SPARE_7, - POLL_PDU_TMR_SPARE_6, - POLL_PDU_TMR_SPARE_5, - POLL_PDU_TMR_SPARE_4, - POLL_PDU_TMR_SPARE_3, - POLL_PDU_TMR_SPARE_2, - POLL_PDU_TMR_SPARE_1 - -}PollPdu; - -typedef enum -{ - POLL_BYTES_1KB, - POLL_BYTES_2KB, - POLL_BYTES_5KB, - POLL_BYTES_8KB, - POLL_BYTES_10KB, - POLL_BYTES_15KB, - POLL_BYTES_25KB, - POLL_BYTES_50KB, - POLL_BYTES_75KB, - POLL_BYTES_100KB, - POLL_BYTES_125KB, - POLL_BYTES_250KB, - POLL_BYTES_375KB, - POLL_BYTES_500KB, - POLL_BYTES_750KB, - POLL_BYTES_1000KB, - POLL_BYTES_1250KB, - POLL_BYTES_1500KB, - POLL_BYTES_2000KB, - POLL_BYTES_3000KB, - POLL_BYTES_4000KB, - POLL_BYTES_4500KB, - POLL_BYTES_5000KB, - POLL_BYTES_5500KB, - POLL_BYTES_6000KB, - POLL_BYTES_6500KB, - POLL_BYTES_7000KB, - POLL_BYTES_7500KB, - POLL_BYTES_8MB, - POLL_BYTES_9MB, - POLL_BYTES_10MB, - POLL_BYTES_11MB, - POLL_BYTES_12MB, - POLL_BYTES_13MB, - POLL_BYTES_14MB, - POLL_BYTES_15MB, - POLL_BYTES_16MB, - POLL_BYTES_17MB, - POLL_BYTES_18MB, - POLL_BYTES_20MB, - POLL_BYTES_25MB, - POLL_BYTES_30MB, - POLL_BYTES_40MB, - POLL_BYTES_INFINITY, - POLL_BYTES_SPARE_20, - POLL_BYTES_SPARE_19, - POLL_BYTES_SPARE_18, - POLL_BYTES_SPARE_17, - POLL_BYTES_SPARE_16, - POLL_BYTES_SPARE_15, - POLL_BYTES_SPARE_14, - POLL_BYTES_SPARE_13, - POLL_BYTES_SPARE_12, - POLL_BYTES_SPARE_11, - POLL_BYTES_SPARE_10, - POLL_BYTES_SPARE_9, - POLL_BYTES_SPARE_8, - POLL_BYTES_SPARE_7, - POLL_BYTES_SPARE_6, - POLL_BYTES_SPARE_5, - POLL_BYTES_SPARE_4, - POLL_BYTES_SPARE_3, - POLL_BYTES_SPARE_2, - POLL_BYTES_SPARE_1 - -}PollBytes; - -typedef enum -{ - RETX_TH_1, - RETX_TH_2, - RETX_TH_3, - RETX_TH_4, - RETX_TH_6, - RETX_TH_8, - RETX_TH_16, - RETX_TH_32 - -}MaxRetxTh; - typedef enum { RE_ASM_0MS, @@ -426,11 +238,11 @@ typedef struct ulAmCfg typedef struct dlAmCfg { - SnLenAm snLenDl; /* Sequence Number length in bits. Allowed values are 12 and 18 */ - TpollReTxTmr pollRetxTmr; /* T_poll_retransmit Timer in msec */ - PollPdu pollPdu; /* Used to trigger a poll for every pollPdu.*/ - PollBytes pollByte; /* Poll_Byte in bytes. */ - MaxRetxTh maxRetxTh; /* Max_Retx_Threshold */ + SnLenAm snLenDl; /* Sequence Number length in bits. Allowed values are 12 and 18 */ + uint16_t pollRetxTmr; /* T_poll_retransmit Timer in msec */ + int16_t pollPdu; /* Used to trigger a poll for every pollPdu.*/ + int32_t pollByte; /* Poll_Byte in bytes. */ + uint8_t maxRetxTh; /* Max_Retx_Threshold */ }DlAmCfg; diff --git a/src/du_app/du_cfg.h b/src/du_app/du_cfg.h index daf5e05e6..f896046b8 100644 --- a/src/du_app/du_cfg.h +++ b/src/du_app/du_cfg.h @@ -247,10 +247,14 @@ #define PHR_PWR_FACTOR_CHANGE 3 #define PHR_MODE_OTHER_CG 0 #define SN_FIELD_LEN 0 -#define T_POLL_RETRANSMIT 8 -#define POLL_PDU 0 -#define POLL_BYTE 43 -#define MAX_RETX_THRESHOLD 5 +#define T_POLL_RETRANSMIT 8 /* Enum for 45ms */ +#define T_POLL_RETRANSMIT_VAL 45 /* Value in ms */ +#define POLL_PDU 0 /* Enum for 4 pdus */ +#define POLL_PDU_VAL 4 /* Value of poll pdu */ +#define POLL_BYTE 43 /* Enum for infinite poll bytes */ +#define POLL_BYTE_VAL -1 /* Value for infinite poll byte */ +#define MAX_RETX_THRESHOLD 5 /* Enum for 8 retransmissions */ +#define MAX_RETX_THRESHOLD_VAL 8 /* Value for 8 retransmissions */ #define T_REASSEMBLY 8 #define T_STATUS_PROHIBHIT 7 #define MAC_LC_PRIORITY 1 diff --git a/src/du_app/du_egtp.c b/src/du_app/du_egtp.c index 0a64c01ba..bb82d2b09 100644 --- a/src/du_app/du_egtp.c +++ b/src/du_app/du_egtp.c @@ -58,6 +58,7 @@ uint8_t egtpActvInit(Ent entity, Inst inst, Region region, Reason reason) memset (&egtpCb, 0, sizeof(EgtpGlobalCb)); protType = CM_INET_PROTO_UDP; + gDlDataRcvdCnt = 0; return ROK; } @@ -811,13 +812,11 @@ uint8_t egtpSendMsg(Buffer *mBuf) uint8_t egtpRecvMsg() { uint8_t ret; /* Return value */ - uint16_t nMsg; /* Number of messages to read from UDP socked */ uint16_t bufLen; /* Length of received buffer */ Buffer *recvBuf; /* Received buffer */ CmInetAddr fromAddr; /* Egtp data sender address */ CmInetMemInfo memInfo; /* Buffer allocation info */ - nMsg = 0; memInfo.region = DU_APP_MEM_REGION; memInfo.pool = DU_POOL; @@ -831,10 +830,10 @@ uint8_t egtpRecvMsg() &recvBuf, (int16_t *)&bufLen, CM_INET_NO_FLAG); if(ret == ROK && recvBuf != NULLP) { - DU_LOG("\nDEBUG --> EGTP : Received DL Message[%d]\n", nMsg+1); + DU_LOG("\nDEBUG --> EGTP : Received DL Message[%d]\n", gDlDataRcvdCnt + 1); ODU_PRINT_MSG(recvBuf, 0 ,0); egtpHdlRecvData(recvBuf); - nMsg++; + gDlDataRcvdCnt++; } } diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index 0c316052c..bd6fa0817 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -99,6 +99,368 @@ DuCfgParams duCfgParam; +/************************************************************************ + * + * @brief Converts enum values into actual value of Poll retransmit timer + * + * @details + * + * Function : getPollPdu + * + * Functionality: Converts enum values into actual value of poll + * retransmit timer + * + * @params[in] Enum value of pollPdu + * @return Actual value of pollPdu + * + * **********************************************************************/ +uint16_t getPollRetxTmr(uint8_t pollRetxTmrCfg) +{ + uint16_t pollRetxTmr; + + /* All values of poll retx timer are at interval of 5ms. + * This is valid upto 250ms + * Hence converting the enum value to actual value by multiplying it to 5 + */ + if(pollRetxTmrCfg <= T_PollRetransmit_ms250) + pollRetxTmr = (pollRetxTmrCfg + 1) * 5; + else + { + switch(pollRetxTmrCfg) + { + case T_PollRetransmit_ms300: + pollRetxTmr = 300; + break; + case T_PollRetransmit_ms350: + pollRetxTmr = 350; + break; + case T_PollRetransmit_ms400: + pollRetxTmr = 400; + break; + case T_PollRetransmit_ms450: + pollRetxTmr = 450; + break; + case T_PollRetransmit_ms500: + pollRetxTmr = 500; + break; + case T_PollRetransmit_ms800: + pollRetxTmr = 800; + break; + default: + DU_LOG("\nERROR --> F1AP: Invalid value of Poll Retransmit timer"); + pollRetxTmr = 0; + } + } + return pollRetxTmr; +} + +/******************************************************************* + * + * @brief Converts enum values into actual value of PollPdu + * + * @details + * + * Function : getPollPdu + * + * Functionality: Converts enum values into actual value of PollPdu + * + * @params[in] Enum value of pollPdu + * @return Actual value of pollPdu + * + * ****************************************************************/ +int16_t getPollPdu(uint8_t pollPduCfg) +{ + int16_t pollPdu; + switch(pollPduCfg) + { + case PollPDU_p4: + pollPdu = 4; + break; + case PollPDU_p8: + pollPdu = 8; + break; + case PollPDU_p16: + pollPdu = 16; + break; + case PollPDU_p32: + pollPdu = 32; + break; + case PollPDU_p64: + pollPdu = 64; + break; + case PollPDU_p128: + pollPdu = 128; + break; + case PollPDU_p256: + pollPdu = 256; + break; + case PollPDU_p512: + pollPdu = 512; + break; + case PollPDU_p1024: + pollPdu = 1024; + break; + case PollPDU_p2048: + pollPdu = 2048; + break; + case PollPDU_p4096: + pollPdu = 4096; + break; + case PollPDU_p6144: + pollPdu = 6144; + break; + case PollPDU_p8192: + pollPdu = 8192; + break; + case PollPDU_p12288: + pollPdu = 12288; + break; + case PollPDU_p16384: + pollPdu = 16384; + break; + case PollPDU_p20480: + pollPdu = 20480; + break; + case PollPDU_p24576: + pollPdu = 24576; + break; + case PollPDU_p28672: + pollPdu = 28672; + break; + case PollPDU_p32768: + pollPdu = 32768; + break; + case PollPDU_p40960: + pollPdu = 40960; + break; + case PollPDU_p49152: + pollPdu = 49152; + break; + case PollPDU_p57344: + pollPdu = 57344; + break; + case PollPDU_p65536: + pollPdu = 65536; + break; + case PollPDU_infinity: + pollPdu = -1; + break; + default: + DU_LOG("\nERROR --> F1AP: Invalid value of poll pdu"); + pollPdu = 0; + break; + } + return pollPdu; +} + +/******************************************************************* + * + * @brief Converts enum values into actual value of poll bytes + * + * @details + * + * Function : getPollByte + * + * Functionality: Converts enum values into actual value of pollBytes + * + * @params[in] Enum value + * @return Actual value + * + * ****************************************************************/ +int32_t getPollByte(uint16_t pollBytesCfg) +{ + int32_t pollBytes; + switch(pollBytesCfg) + { + case PollByte_kB1: + pollBytes = 1000; + break; + case PollByte_kB2: + pollBytes = 2000; + break; + case PollByte_kB5: + pollBytes = 5000; + break; + case PollByte_kB8: + pollBytes = 8000; + break; + case PollByte_kB10: + pollBytes = 10000; + break; + case PollByte_kB15: + pollBytes = 15000; + break; + case PollByte_kB25: + pollBytes = 25000; + break; + case PollByte_kB50: + pollBytes = 50000; + break; + case PollByte_kB75: + pollBytes = 75000; + break; + case PollByte_kB100: + pollBytes = 100000; + break; + case PollByte_kB125: + pollBytes = 125000; + break; + case PollByte_kB250: + pollBytes = 250000; + break; + case PollByte_kB375: + pollBytes = 375000; + break; + case PollByte_kB500: + pollBytes = 500000; + break; + case PollByte_kB750: + pollBytes = 750000; + break; + case PollByte_kB1000: + pollBytes = 1000000; + break; + case PollByte_kB1250: + pollBytes = 1250000; + break; + case PollByte_kB1500: + pollBytes = 1500000; + break; + case PollByte_kB2000: + pollBytes = 2000000; + break; + case PollByte_kB3000: + pollBytes = 3000000; + break; + case PollByte_kB4000: + pollBytes = 4000000; + break; + case PollByte_kB4500: + pollBytes = 4500000; + break; + case PollByte_kB5000: + pollBytes = 5000000; + break; + case PollByte_kB5500: + pollBytes = 5500000; + break; + case PollByte_kB6000: + pollBytes = 6000000; + break; + case PollByte_kB6500: + pollBytes = 6500000; + break; + case PollByte_kB7000: + pollBytes = 7000000; + break; + case PollByte_kB7500: + pollBytes = 7500000; + break; + case PollByte_mB8: + pollBytes = 8000000; + break; + case PollByte_mB9: + pollBytes = 9000000; + break; + case PollByte_mB10: + pollBytes = 10000000; + break; + case PollByte_mB11: + pollBytes = 11000000; + break; + case PollByte_mB12: + pollBytes = 12000000; + break; + case PollByte_mB13: + pollBytes = 13000000; + break; + case PollByte_mB14: + pollBytes = 14000000; + break; + case PollByte_mB15: + pollBytes = 15000000; + break; + case PollByte_mB16: + pollBytes = 16000000; + break; + case PollByte_mB17: + pollBytes = 17000000; + break; + case PollByte_mB18: + pollBytes = 18000000; + break; + case PollByte_mB20: + pollBytes = 20000000; + break; + case PollByte_mB25: + pollBytes = 25000000; + break; + case PollByte_mB30: + pollBytes = 30000000; + break; + case PollByte_mB40: + pollBytes = 40000000; + break; + case PollByte_infinity: + pollBytes = -1; + break; + default: + DU_LOG("\nERROR --> F1AP: Invalid value of poll bytes"); + pollBytes = 0; + } + return pollBytes; +} + +/******************************************************************* + * + * @brief Converts enum values into actual value of maxRetx + * + * @details + * + * Function : getMaxRetx + * + * Functionality: Converts enum values into actual value of maxRetx + * + * @params[in] Enum value + * @return Actual value + * + * ****************************************************************/ +uint8_t getMaxRetx(uint8_t maxRetxCfg) +{ + uint8_t maxRetx; + switch(maxRetxCfg) + { + case UL_AM_RLC__maxRetxThreshold_t1: + maxRetx = 1; + break; + case UL_AM_RLC__maxRetxThreshold_t2: + maxRetx = 2; + break; + case UL_AM_RLC__maxRetxThreshold_t3: + maxRetx = 3; + break; + case UL_AM_RLC__maxRetxThreshold_t4: + maxRetx = 4; + break; + case UL_AM_RLC__maxRetxThreshold_t6: + maxRetx = 6; + break; + case UL_AM_RLC__maxRetxThreshold_t8: + maxRetx = 8; + break; + case UL_AM_RLC__maxRetxThreshold_t16: + maxRetx = 16; + break; + case UL_AM_RLC__maxRetxThreshold_t32: + maxRetx = 32; + break; + default: + DU_LOG("\nERROR --> F1AP: Invalid configuration for Max retransmission threshold"); + maxRetx = 0; + } + return maxRetx; +} + /******************************************************************* * * @brief Builds Uplink Info for NR diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index 878b130d2..5fb75f910 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -1133,10 +1133,10 @@ void fillDefaultAmInfo(AmBearerCfg *amCfg) { /* DL AM */ amCfg->dlAmCfg.snLenDl = AM_SIZE_12; - amCfg->dlAmCfg.pollRetxTmr = POLL_RETX_TMR_45MS; - amCfg->dlAmCfg.pollPdu = POLL_PDU_TMR_INFINITY; - amCfg->dlAmCfg.pollByte = POLL_BYTES_INFINITY; - amCfg->dlAmCfg.maxRetxTh = RETX_TH_8; + amCfg->dlAmCfg.pollRetxTmr = T_POLL_RETRANSMIT_VAL; + amCfg->dlAmCfg.pollPdu = POLL_PDU_VAL; + amCfg->dlAmCfg.pollByte = POLL_BYTE_VAL; + amCfg->dlAmCfg.maxRetxTh = MAX_RETX_THRESHOLD_VAL; /* UL AM */ amCfg->ulAmCfg.snLenUl = AM_SIZE_12; diff --git a/src/phy_stub/phy_stub_msg_hdl.c b/src/phy_stub/phy_stub_msg_hdl.c index b5fb1ac5a..176385dc6 100644 --- a/src/phy_stub/phy_stub_msg_hdl.c +++ b/src/phy_stub/phy_stub_msg_hdl.c @@ -1366,6 +1366,110 @@ uint8_t l1SendUlUserData() return ROK; } +/******************************************************************* + * + * @brief Sends RLC Status PDU to DU + * + * @details + * + * Function : l1SendStatusPdu + * + * Functionality: Send RLC Status PDU to DU + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t l1SendStatusPdu() +{ + fapi_rx_data_indication_t *rxDataInd; + fapi_pdu_ind_info_t *pduInfo; + uint8_t *pdu = NULLP; + uint16_t byteIdx = 0; + uint32_t msgLen = 0; + uint8_t idx = 0; + + MAC_ALLOC(rxDataInd, sizeof(fapi_rx_data_indication_t)); + if(!rxDataInd) + { + printf("\nERROR --> PHY_STUB: Memory allocation failed for Rx Data Indication"); + return RFAILED; + } + memset(rxDataInd, 0, sizeof(fapi_rx_data_indication_t)); + + msgLen = sizeof(fapi_rx_data_indication_t) - sizeof(fapi_msg_t); + rxDataInd->sfn = 0; + rxDataInd->slot = 0; + rxDataInd->numPdus = 1; + + /* TODO : Fill pduInfo using PUSCH PDU. Currently hardcoding */ + pduInfo = &rxDataInd->pdus[idx]; + pduInfo->handle = 100; + pduInfo->rnti = 100; + pduInfo->harqId = 1; + /* Since status pdu size = 3bytes and 2 bytes of MAC header, + * setting tbsize = 24 from Table 5.1.3.2-1 spec 38.214 */ + pduInfo->pdu_length = 24; + pduInfo->ul_cqi = 0; + pduInfo->timingAdvance = 0; + pduInfo->rssi = 0; + + /* Filling pdu with random values for testing */ + pduInfo->pduData = NULL; + MAC_ALLOC(pduInfo->pduData, pduInfo->pdu_length); + if(!pduInfo->pduData) + { + printf("\nERROR --> PHY_STUB: Memory allocation failed for Rx Data Pdu"); + return RFAILED; + } + + /* Filling PDU */ + pdu = (uint8_t *)pduInfo->pduData; + msgLen = 3; + + /* For RLC Status PDU + MAC subheader format is R/F/LCId/L (2/3 bytes) + LCId is 4 for DRB1 + L is length of Status PDU i.e 3 bytes + From 38.321 section 6.1.1 + */ + uint8_t statusPdu[] = {4, msgLen, 0, 0, 0}; + msgLen += 2; /* 2bytes of header */ + memcpy(pdu, &statusPdu, msgLen); + byteIdx += msgLen; /* 2 bytes of header */ + + + /* Filling MAC SDU for Padding bytes*/ + if(byteIdx < pduInfo->pdu_length) + { + /* For Padding + MAC subheader format is R/R/LCId (1byte) + LCId is 63 for padding + From 38.321 section 6.1.1 + */ + pdu[byteIdx++] = 63; + + for(; byteIdx < pduInfo->pdu_length; byteIdx++) + pdu[byteIdx] = 0; + } + msgLen += pduInfo->pdu_length; + + fillMsgHeader(&rxDataInd->header, FAPI_RX_DATA_INDICATION, msgLen); + + /* Send Message to peer */ + DU_LOG("\nDEBUG --> PHY STUB : Sending RLC status pdu at sfn %d slot %d", sfnValue, slotValue); + /* Sending Rx data indication to MAC */ + rxDataInd->sfn = sfnValue; + rxDataInd->slot = slotValue; + procPhyMessages(rxDataInd->header.msg_id, sizeof(fapi_rx_data_indication_t), (void *)rxDataInd); + + if(pduInfo->pdu_length) + MAC_FREE(pduInfo->pduData, pduInfo->pdu_length); + MAC_FREE(rxDataInd, sizeof(fapi_rx_data_indication_t)); + return ROK; +} + /******************************************************************* * * @brief Receives message from MAC diff --git a/src/phy_stub/phy_stub_thread_hdl.c b/src/phy_stub/phy_stub_thread_hdl.c index e76c067ef..5b09351a2 100644 --- a/src/phy_stub/phy_stub_thread_hdl.c +++ b/src/phy_stub/phy_stub_thread_hdl.c @@ -23,6 +23,7 @@ #include "du_log.h" uint8_t l1SendUlUserData(); +uint8_t l1SendStatusPdu(); uint16_t l1BuildAndSendSlotIndication(); pthread_t thread = 0; @@ -123,6 +124,12 @@ void *l1ConsoleHandler(void *args) DU_LOG("\nDEBUG --> PHY STUB: Sending UL User Data"); l1SendUlUserData(); } + else if((ch = getchar()) == 'c') + { + /* Send Control PDU from PHY stub to DU */ + DU_LOG("\nDEBUG --> PHY STUB: Sending Status PDU"); + l1SendStatusPdu(); + } } }