From 653aa9a77c383713ea88d4b34759b333576646b4 Mon Sep 17 00:00:00 2001 From: sphoorthi Date: Mon, 15 Mar 2021 22:10:56 +0530 Subject: [PATCH] Fixed issues in processing of large DL packets [Issue-ID: ODUHIGH-309] Change-Id: I297c4dd8c8a3cc36356cfed17d74e13d440e462b Signed-off-by: sphoorthi --- src/5gnrsch/sch.h | 6 +++--- src/5gnrsch/sch_common.c | 6 ++++-- src/5gnrsch/sch_slot_ind.c | 10 ++++++++-- src/5gnrsch/sch_utils.c | 9 +++++++-- src/5gnrsch/sch_utils.h | 2 +- src/cm/mac_sch_interface.h | 2 +- src/cm/rlc_mac_inf.h | 4 ++-- src/codec_utils/common/odu_common_codec.c | 5 +---- src/du_app/du_egtp.c | 16 ++++++++-------- src/ric_stub/ric_e2ap_msg_hdl.c | 2 +- 10 files changed, 36 insertions(+), 26 deletions(-) diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index 11ec5016a..d99f67183 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -142,7 +142,7 @@ typedef struct schLcCtxt uint8_t lcId; // logical Channel ID uint8_t lcp; // logical Channel Prioritization SchLcState lcState; - uint16_t bo; + uint32_t bo; }SchDlLcCtxt; typedef struct schDlCb @@ -233,14 +233,14 @@ uint8_t schBroadcastAlloc(SchCellCb *cell, DlBrdcstAlloc *dlBrdcstAlloc,uint16_t uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst inst); uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst); uint8_t schDlRsrcAllocMsg4(DlMsgAlloc *msg4Alloc, SchCellCb *cell, uint16_t slot); -uint16_t schCalcTbSize(uint16_t payLoadSize); +uint16_t schCalcTbSize(uint32_t payLoadSize); uint16_t schCalcNumPrb(uint16_t tbSize, uint16_t mcs, uint8_t numSymbols); uint16_t schAllocPucchResource(SchCellCb *cell, uint16_t crnti, uint16_t slot); uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst); uint8_t schFillUlDci(SchUeCb *ueCb, SchPuschInfo puschInfo, DciInfo *dciInfo); uint8_t schFillPuschAlloc(SchUeCb *ueCb, uint16_t pdcchSlot, uint32_t dataVol, SchPuschInfo *puschInfo); uint8_t schDlRsrcAllocDlMsg(DlMsgAlloc *dlMsgAlloc, SchCellCb *cell, uint16_t crnti, - uint16_t accumalatedSize, uint16_t slot); + uint32_t *accumalatedSize, uint16_t slot); uint16_t schAccumalateLcBoSize(SchCellCb *cell, uint16_t ueIdx); /********************************************************************** diff --git a/src/5gnrsch/sch_common.c b/src/5gnrsch/sch_common.c index 019718b34..83d3141cf 100644 --- a/src/5gnrsch/sch_common.c +++ b/src/5gnrsch/sch_common.c @@ -710,7 +710,7 @@ uint16_t schAllocPucchResource(SchCellCb *cell, uint16_t crnti, uint16_t slot) * * ****************************************************************/ uint8_t schDlRsrcAllocDlMsg(DlMsgAlloc *dlMsgAlloc, SchCellCb *cell, uint16_t crnti, - uint16_t accumalatedSize, uint16_t slot) + uint32_t *accumalatedSize, uint16_t slot) { uint8_t ueIdx; uint16_t tbSize = 0; @@ -777,7 +777,9 @@ uint8_t schDlRsrcAllocDlMsg(DlMsgAlloc *dlMsgAlloc, SchCellCb *cell, uint16_t cr pdsch->codeword[cwCount].mcsIndex = ueCb.ueCfg.dlModInfo.mcsIndex; pdsch->codeword[cwCount].mcsTable = ueCb.ueCfg.dlModInfo.mcsTable; pdsch->codeword[cwCount].rvIndex = 0; - tbSize = schCalcTbSize(accumalatedSize); + tbSize = schCalcTbSize(*accumalatedSize); + if(tbSize < *accumalatedSize) + *accumalatedSize = tbSize; pdsch->codeword[cwCount].tbSize = tbSize; } pdsch->dataScramblingId = cell->cellCfg.phyCellId; diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 935d22c1a..3a2329355 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -140,7 +140,7 @@ uint8_t schFillBoGrantDlSchedInfo(SchCellCb *cell, DlSchedInfo *dlSchedInfo, DlM uint8_t ueIdx, lcIdx; uint16_t slot; uint16_t crnti = 0; - uint16_t accumalatedSize = 0; + uint32_t accumalatedSize = 0; SchUeCb *ueCb = NULLP; while(cell->boIndBitMap) @@ -184,7 +184,13 @@ uint8_t schFillBoGrantDlSchedInfo(SchCellCb *cell, DlSchedInfo *dlSchedInfo, DlM } /* pdcch and pdsch data is filled */ - schDlRsrcAllocDlMsg(dlMsgAlloc, cell, crnti, accumalatedSize, slot); + schDlRsrcAllocDlMsg(dlMsgAlloc, cell, crnti, &accumalatedSize, slot); + /* Calculated TB size could be less than the total size requested. + * Hence, updated the scheduled bytes report. Following is valid only for + * one LC. + * TODO : Update the scheduling byte report for multiple LC based on QCI + * and Priority */ + dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc -1].schBytes = accumalatedSize; /* PUCCH resource */ schAllocPucchResource(cell, dlMsgAlloc->crnti, slot); diff --git a/src/5gnrsch/sch_utils.c b/src/5gnrsch/sch_utils.c index 713e2a8c2..97c6aa3e3 100644 --- a/src/5gnrsch/sch_utils.c +++ b/src/5gnrsch/sch_utils.c @@ -470,11 +470,16 @@ uint8_t pucchResourceSet[MAX_PUCCH_RES_SET_IDX][4] = { * @param[in] payLoadSize - size of payload in bytes * @return TBsize from the Table in bytes **/ -uint16_t schCalcTbSize(uint16_t payLoadSize) +uint16_t schCalcTbSize(uint32_t payLoadSize) { uint8_t tbsIndex = 0; - payLoadSize = payLoadSize*8; + uint16_t maxTbSize; + + maxTbSize = tbSizeTable[TOTAL_TBSIZE_VALUES -1]/8; + if(payLoadSize >= maxTbSize) + return maxTbSize; + payLoadSize = payLoadSize*8; while(payLoadSize > tbSizeTable[tbsIndex]) { tbsIndex++; diff --git a/src/5gnrsch/sch_utils.h b/src/5gnrsch/sch_utils.h index 60c92ea42..09ac4c938 100644 --- a/src/5gnrsch/sch_utils.h +++ b/src/5gnrsch/sch_utils.h @@ -88,7 +88,7 @@ int8_t searchSpaceIdxTable[MAX_SEARCH_SPACE_INDEX][4]; /* functions declarations */ void freqDomRscAllocType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain); -uint16_t schCalcTbSize(uint16_t payLoadSize); +uint16_t schCalcTbSize(uint32_t payLoadSize); uint16_t schCalcNumPrb(uint16_t tbSize, uint16_t mcs, uint8_t numSymbols); uint16_t schCalcTbSizeFromNPrb(uint16_t numPrb, uint16_t mcs, uint8_t numSymbols); SchUeCb* schGetUeCb(SchCellCb *cellCb, uint16_t crnti); diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index 14ea26a59..7fd0d6d1c 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -730,7 +730,7 @@ typedef struct dlMsgInfo typedef struct lcSchInfo { uint8_t lcId; - uint16_t schBytes; /* Number of scheduled bytes */ + uint32_t schBytes; /* Number of scheduled bytes */ }LcSchInfo; typedef struct dlMsgAlloc diff --git a/src/cm/rlc_mac_inf.h b/src/cm/rlc_mac_inf.h index 97f3fc75b..45fc1eeb3 100644 --- a/src/cm/rlc_mac_inf.h +++ b/src/cm/rlc_mac_inf.h @@ -37,7 +37,7 @@ typedef struct rlcBoStatus uint16_t ueIdx; /*!< UE ID */ bool commCh; /*!< Common or Dedicated Channel */ uint8_t lcId; /*!< Logical channel ID */ - uint16_t bo; /*!< Buffer occupancy reported by RLC */ + uint32_t bo; /*!< Buffer occupancy reported by RLC */ }RlcBoStatus; /* Scheduled logical channel info */ @@ -45,7 +45,7 @@ typedef struct rlcLcSchInfo { bool commCh; /* Common or dedicated channel */ uint8_t lcId; /*!< Logical channel ID */ - uint16_t bufSize; /*!< Total buffer size in bytes scheduled by MAC */ + uint32_t bufSize; /*!< Total buffer size in bytes scheduled by MAC */ }RlcLcSchInfo; /* Schedule result report */ diff --git a/src/codec_utils/common/odu_common_codec.c b/src/codec_utils/common/odu_common_codec.c index 9439554ec..cb302f460 100644 --- a/src/codec_utils/common/odu_common_codec.c +++ b/src/codec_utils/common/odu_common_codec.c @@ -56,10 +56,7 @@ uint8_t fillBitString(BIT_STRING_t *id, uint8_t unusedBits, uint8_t byteSize, ui return RFAILED; } - for (tmp = 0 ; tmp < (byteSize-1); tmp++) - { - id->buf[tmp] = tmp; - } + memset(id->buf, 0, byteSize-1); id->buf[byteSize-1] = val; id->bits_unused = unusedBits; return ROK; diff --git a/src/du_app/du_egtp.c b/src/du_app/du_egtp.c index 90f67bcb5..03befe85e 100644 --- a/src/du_app/du_egtp.c +++ b/src/du_app/du_egtp.c @@ -824,8 +824,8 @@ uint8_t egtpRecvMsg() &recvBuf, (int16_t *)&bufLen, CM_INET_NO_FLAG); if(ret == ROK && recvBuf != NULLP) { - DU_LOG("\nDEBUG --> EGTP : Received DL Message[%ld]\n", gDlDataRcvdCnt + 1); - ODU_PRINT_MSG(recvBuf, 0 ,0); + //DU_LOG("\nDEBUG --> EGTP : Received DL Message[%ld]\n", gDlDataRcvdCnt + 1); + //ODU_PRINT_MSG(recvBuf, 0 ,0); egtpHdlRecvData(recvBuf); gDlDataRcvdCnt++; } @@ -895,11 +895,11 @@ uint8_t egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) /* Extracting version fro 1st byte */ version = tmpByte[0] >> 5; - DU_LOG("\nDEBUG --> EGTP : Version %d", version); + //DU_LOG("\nDEBUG --> EGTP : Version %d", version); /* Decode message type */ ODU_REM_PRE_MSG((Data*)&(egtpMsg->msgHdr.msgType), mBuf); - DU_LOG("\nDEBUG --> EGTP : msgType %d", egtpMsg->msgHdr.msgType); + //DU_LOG("\nDEBUG --> EGTP : msgType %d", egtpMsg->msgHdr.msgType); /**************************************************************************** * Message length param is 2 bytes. So decode next 2 bytes from msg hdr and @@ -908,7 +908,7 @@ uint8_t egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) ODU_REM_PRE_MSG(&tmpByte[1], mBuf); ODU_REM_PRE_MSG(&tmpByte[2], mBuf); msgLen = (tmpByte[1] << 8) | tmpByte[2]; - DU_LOG("\nDEBUG --> EGTP : msgLen %d", msgLen); + //DU_LOG("\nDEBUG --> EGTP : msgLen %d", msgLen); /**************************************************************************** @@ -920,7 +920,7 @@ uint8_t egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) ODU_REM_PRE_MSG(&tmpByte[3], mBuf); ODU_REM_PRE_MSG(&tmpByte[4], mBuf); egtpMsg->msgHdr.teId = (tmpByte[1] << 24) | (tmpByte[2] << 16) | (tmpByte[3] << 8) | tmpByte[4]; - DU_LOG("\nDEBUG --> EGTP : teId %d",egtpMsg->msgHdr.teId); + //DU_LOG("\nDEBUG --> EGTP : teId %d",egtpMsg->msgHdr.teId); /* If any one of S, E or PN flag is set, set extension present as true. */ @@ -1032,8 +1032,8 @@ uint8_t egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) egtpMsg->msg = mBuf; - DU_LOG("\nDEBUG --> EGTP : DL Data Buffer after decoding header "); - ODU_PRINT_MSG(mBuf, 0, 0); + //DU_LOG("\nDEBUG --> EGTP : DL Data Buffer after decoding header "); + //ODU_PRINT_MSG(mBuf, 0, 0); /* Forward the data to duApp/RLC */ diff --git a/src/ric_stub/ric_e2ap_msg_hdl.c b/src/ric_stub/ric_e2ap_msg_hdl.c index e48ac4ea7..851fb5d12 100644 --- a/src/ric_stub/ric_e2ap_msg_hdl.c +++ b/src/ric_stub/ric_e2ap_msg_hdl.c @@ -104,7 +104,7 @@ S16 BuildGlobalRicId(GlobalRIC_ID_t *ricId) { uint8_t unused = 4; uint8_t byteSize = 3; - uint8_t val = 1; + uint8_t val = 16; if(ricId != NULLP) { ricId->pLMN_Identity.size = byteSize * sizeof(uint8_t); -- 2.16.6