From 87c35884595a3166121854c3ae6e6e856f004ff4 Mon Sep 17 00:00:00 2001 From: "lal.harshita" Date: Fri, 9 Dec 2022 16:41:52 +0530 Subject: [PATCH] [Epic-ID: ODUHIGH-464][Task-ID: ODUHIGH-483] Memeory related fix in FDD and TDD mode Signed-off-by: lal.harshita Change-Id: Ib18bee077d89a8f85b86ec75ca864731956fde73 Signed-off-by: lal.harshita --- src/5gnrmac/lwr_mac_fsm.c | 28 +++++++------------------ src/5gnrmac/lwr_mac_phy.h | 2 +- src/5gnrmac/mac_utils.h | 2 +- src/5gnrrlc/rlc_utils.h | 2 +- src/5gnrsch/sch_drx.c | 16 +++++++-------- src/5gnrsch/sch_utils.h | 2 +- src/cm/common_def.c | 8 ++++---- src/du_app/du_ue_mgr.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++ src/du_app/du_utils.h | 2 +- 9 files changed, 76 insertions(+), 38 deletions(-) diff --git a/src/5gnrmac/lwr_mac_fsm.c b/src/5gnrmac/lwr_mac_fsm.c index cdf66a7f9..9c4b1b870 100644 --- a/src/5gnrmac/lwr_mac_fsm.c +++ b/src/5gnrmac/lwr_mac_fsm.c @@ -55,7 +55,7 @@ void fapiMacConfigRsp(uint16_t cellId); uint16_t sendTxDataReq(SlotTimingInfo currTimingInfo, MacDlSlot *dlSlot, p_fapi_api_queue_elem_t prevElem, fapi_vendor_tx_data_req_t *vendorTxDataReq); uint16_t fillUlTtiReq(SlotTimingInfo currTimingInfo, p_fapi_api_queue_elem_t prevElem, fapi_vendor_ul_tti_req_t* vendorUlTti); uint16_t fillUlDciReq(SlotTimingInfo currTimingInfo, p_fapi_api_queue_elem_t prevElem, fapi_vendor_ul_dci_req_t *vendorUlDciReq); -uint8_t lwr_mac_procStopReqEvt(SlotTimingInfo slotInfo, p_fapi_api_queue_elem_t prevElem); +uint8_t lwr_mac_procStopReqEvt(SlotTimingInfo slotInfo, p_fapi_api_queue_elem_t prevElem, fapi_stop_req_vendor_msg_t *vendorMsg); void lwrMacLayerInit(Region region, Pool pool) { @@ -2383,7 +2383,7 @@ uint8_t lwr_mac_procStartReqEvt(void *msg) * ********************************************************************/ -uint8_t lwr_mac_procStopReqEvt(SlotTimingInfo slotInfo, p_fapi_api_queue_elem_t prevElem) +uint8_t lwr_mac_procStopReqEvt(SlotTimingInfo slotInfo, p_fapi_api_queue_elem_t prevElem, fapi_stop_req_vendor_msg_t *vendorMsg) { #ifdef INTEL_FAPI #ifdef CALL_FLOW_DEBUG_LOG @@ -2391,33 +2391,19 @@ uint8_t lwr_mac_procStopReqEvt(SlotTimingInfo slotInfo, p_fapi_api_queue_elem_t #endif fapi_stop_req_t *stopReq; - fapi_vendor_msg_t *vendorMsg; p_fapi_api_queue_elem_t stopReqElem; - p_fapi_api_queue_elem_t vendorMsgElem; - /* Allocte And fill Vendor msg */ - LWR_MAC_ALLOC(vendorMsgElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_vendor_msg_t))); - if(!vendorMsgElem) - { - DU_LOG("\nERROR --> LWR_MAC: Memory allocation failed for vendor msg in stop req"); - return RFAILED; - } - FILL_FAPI_LIST_ELEM(vendorMsgElem, NULLP, FAPI_VENDOR_MESSAGE, 1, sizeof(fapi_vendor_msg_t)); - vendorMsg = (fapi_vendor_msg_t *)(vendorMsgElem + 1); - fillMsgHeader(&vendorMsg->header, FAPI_VENDOR_MESSAGE, sizeof(fapi_vendor_msg_t)); - vendorMsg->stop_req_vendor.sfn = slotInfo.sfn; - vendorMsg->stop_req_vendor.slot = slotInfo.slot; + vendorMsg->sfn = slotInfo.sfn; + vendorMsg->slot = slotInfo.slot; /* Fill FAPI stop req */ LWR_MAC_ALLOC(stopReqElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_stop_req_t))); if(!stopReqElem) { DU_LOG("\nERROR --> LWR_MAC: Memory allocation failed for stop req"); - LWR_MAC_FREE(vendorMsgElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_vendor_msg_t))); return RFAILED; } - FILL_FAPI_LIST_ELEM(stopReqElem, vendorMsgElem, FAPI_STOP_REQUEST, 1, \ - sizeof(fapi_stop_req_t)); + FILL_FAPI_LIST_ELEM(stopReqElem, NULLP, FAPI_STOP_REQUEST, 1, sizeof(fapi_stop_req_t)); stopReq = (fapi_stop_req_t *)(stopReqElem + 1); memset(stopReq, 0, sizeof(fapi_stop_req_t)); fillMsgHeader(&stopReq->header, FAPI_STOP_REQUEST, sizeof(fapi_stop_req_t)); @@ -3919,10 +3905,10 @@ uint16_t fillDlTtiReq(SlotTimingInfo currTimingInfo) if(macCb.macCell[cellIdx]->state == CELL_TO_BE_STOPPED) { /* Intel L1 expects UL_DCI.request following DL_TTI.request */ - lwr_mac_procStopReqEvt(currTimingInfo, prevElem); + lwr_mac_procStopReqEvt(currTimingInfo, prevElem, &(vendorMsg->stop_req_vendor)); msgHeader->num_msg++; macCb.macCell[cellIdx]->state = CELL_STOP_IN_PROGRESS; - prevElem = prevElem->p_next; + prevElem = prevElem->p_next; } prevElem->p_next = vendorMsgQElem; LwrMacSendToL1(headerElem); diff --git a/src/5gnrmac/lwr_mac_phy.h b/src/5gnrmac/lwr_mac_phy.h index 54ae8db13..5d4192edc 100644 --- a/src/5gnrmac/lwr_mac_phy.h +++ b/src/5gnrmac/lwr_mac_phy.h @@ -35,7 +35,7 @@ typedef enum #ifdef ODU_MEMORY_DEBUG_LOG #define WLS_MEM_LOG(_macro, _file, _line, _func, _size, _datPtr)\ {\ - printf("\n%s=== %s +%d, %s, %lu, %p", \ + printf("\n%s=== %s +%d, %s, %lu, %p \n", \ _macro, _file, _line, _func, (uint64_t)_size, _datPtr); \ } #else diff --git a/src/5gnrmac/mac_utils.h b/src/5gnrmac/mac_utils.h index 16166d094..8f55814b3 100644 --- a/src/5gnrmac/mac_utils.h +++ b/src/5gnrmac/mac_utils.h @@ -26,7 +26,7 @@ #ifdef ODU_MEMORY_DEBUG_LOG #define MAC_MEM_LOG(_macro, _file, _line, _func, _size, _datPtr)\ {\ - printf("\n%s=== %s +%d, %s, %lu, %p", \ + printf("\n%s=== %s +%d, %s, %lu, %p \n", \ _macro, _file, _line, _func, (uint64_t)_size, _datPtr); \ } #else diff --git a/src/5gnrrlc/rlc_utils.h b/src/5gnrrlc/rlc_utils.h index 14a5e0dec..490916922 100755 --- a/src/5gnrrlc/rlc_utils.h +++ b/src/5gnrrlc/rlc_utils.h @@ -107,7 +107,7 @@ extern "C" { #ifdef ODU_MEMORY_DEBUG_LOG #define RLC_MEM_LOG(_macro, _file, _line, _func, _size, _datPtr)\ {\ - printf("\n%s=== %s +%d, %s, %lu, %p", \ + printf("\n%s=== %s +%d, %s, %lu, %p \n", \ _macro, _file, _line, _func, (uint64_t)_size, _datPtr); \ } #else diff --git a/src/5gnrsch/sch_drx.c b/src/5gnrsch/sch_drx.c index 911af3c68..d2dbcfb6c 100644 --- a/src/5gnrsch/sch_drx.c +++ b/src/5gnrsch/sch_drx.c @@ -324,7 +324,7 @@ void schFillDrxUeCb(uint8_t numerology, SchDrxCfg drxCfg, SchDrxUeCb *drxUeCb) * -# RFAILED **/ -uint8_t schAddDrxTimerIntoList(CmLListCp *drxTimerList,void * nodeInfo, CmLList *drxNodeInfo) +uint8_t schAddDrxTimerIntoList(CmLListCp *drxTimerList,void * nodeInfo, CmLList **drxNodeInfo) { CmLList *currentNodeInfo = NULLP; @@ -338,7 +338,7 @@ uint8_t schAddDrxTimerIntoList(CmLListCp *drxTimerList,void * nodeInfo, CmLList currentNodeInfo->node = (PTR)nodeInfo; cmLListAdd2Tail(drxTimerList, currentNodeInfo); - drxNodeInfo = currentNodeInfo; + (*drxNodeInfo) = currentNodeInfo; DU_LOG("\nINFO --> SCH : Drx node added into the list"); return ROK; } @@ -539,7 +539,7 @@ void schDrxUeReCfgTimer(SchCellCb *cell, SchUeCb *ueCb) } SCH_CALCULATE_TIMER_INDEX(onDurTime, ueCb->drxUeCb.onDurationStartIndex); ueCb->drxUeCb.onDurationStartDistance = SCH_CALC_SLOT_DIFF(onDurationOccurance, cell->slotInfo, cell->numSlots)/MAX_DRX_SIZE; - schAddDrxTimerIntoList(&cell->drxCb[ueCb->drxUeCb.onDurationStartIndex].onDurationStartList, ueCb, ueCb->drxUeCb.onDurationStartNodeInfo); + schAddDrxTimerIntoList(&cell->drxCb[ueCb->drxUeCb.onDurationStartIndex].onDurationStartList, ueCb, &ueCb->drxUeCb.onDurationStartNodeInfo); } /** @@ -569,7 +569,7 @@ void schAddUeInOndurationList(SchCellCb *cell, SchUeCb *ueCb, uint8_t delta) onDurTime = onDurationOccurance.sfn*cell->numSlots+onDurationOccurance.slot; SCH_CALCULATE_TIMER_INDEX(onDurTime, ueCb->drxUeCb.onDurationStartIndex); ueCb->drxUeCb.onDurationStartDistance = SCH_CALC_SLOT_DIFF(onDurationOccurance, cell->slotInfo, cell->numSlots)/MAX_DRX_SIZE; - schAddDrxTimerIntoList(&cell->drxCb[ueCb->drxUeCb.onDurationStartIndex].onDurationStartList, ueCb, ueCb->drxUeCb.onDurationStartNodeInfo); + schAddDrxTimerIntoList(&cell->drxCb[ueCb->drxUeCb.onDurationStartIndex].onDurationStartList, ueCb, &ueCb->drxUeCb.onDurationStartNodeInfo); } } @@ -631,7 +631,7 @@ void schHdlDrxOnDurStrtTimerForDlDirection(SchCellCb *cell, uint16_t currListIn /* onDurationExpiry = (current slot + onduration length) % MAX_DRX_SIZE*/ onDurationExpiry = (currListIndx + ueCb->drxUeCb.onDurationLen)%MAX_DRX_SIZE; ueCb->drxUeCb.onDurationExpiryDistance = (ueCb->drxUeCb.onDurationLen)/MAX_DRX_SIZE; - schAddDrxTimerIntoList(&cell->drxCb[onDurationExpiry].onDurationExpiryList, ueCb, ueCb->drxUeCb.onDurationExpiryNodeInfo); + schAddDrxTimerIntoList(&cell->drxCb[onDurationExpiry].onDurationExpiryList, ueCb, &ueCb->drxUeCb.onDurationExpiryNodeInfo); ueCb->drxUeCb.onDurationExpiryIndex = onDurationExpiry; } @@ -692,7 +692,7 @@ void schHdlDrxOnDurStrtTimerForUlDirection(SchCellCb *cell, uint16_t currListIn } SCH_CALCULATE_TIMER_INDEX(onDurTime, ueCb->drxUeCb.onDurationStartIndex); ueCb->drxUeCb.onDurationStartDistance = ueCb->drxUeCb.longCycleLen/MAX_DRX_SIZE; - schAddDrxTimerIntoList(&cell->drxCb[ueCb->drxUeCb.onDurationStartIndex].onDurationStartList, ueCb, ueCb->drxUeCb.onDurationStartNodeInfo); + schAddDrxTimerIntoList(&cell->drxCb[ueCb->drxUeCb.onDurationStartIndex].onDurationStartList, ueCb, &ueCb->drxUeCb.onDurationStartNodeInfo); } } } @@ -766,7 +766,7 @@ void schHdlDrxInActvStrtTmr(SchCellCb *cell, SchUeCb *ueCb, uint8_t delta) /* Adding the new entry in in-activity timer list */ ueCb->drxUeCb.inActvExpiryIndex = (slotIndx + ueCb->drxUeCb.inActvTimerLen) % MAX_DRX_SIZE; ueCb->drxUeCb.inActiveTmrExpiryDistance = (ueCb->drxUeCb.inActvTimerLen) / MAX_DRX_SIZE; - schAddDrxTimerIntoList(&cell->drxCb[ueCb->drxUeCb.inActvExpiryIndex].inActvTmrExpiryList, ueCb, ueCb->drxUeCb.inActvTimerExpiryNodeInfo); + schAddDrxTimerIntoList(&cell->drxCb[ueCb->drxUeCb.inActvExpiryIndex].inActvTmrExpiryList, ueCb, &ueCb->drxUeCb.inActvTimerExpiryNodeInfo); /* Set the UE active for UL And Dl transfer */ ueCb->drxUeCb.drxDlUeActiveMask |= UE_ACTIVE_FOR_INACTIVE_TIMER; @@ -817,7 +817,7 @@ void schHdlDrxStartShortCycleTimer(SchCellCb *cell, SchUeCb *ueCb) /* recalculate the new index for shortCycleExpiryList */ ueCb->drxUeCb.shortCycleExpiryIndex = (ueCb->drxUeCb.onDurationStartIndex + ueCb->drxUeCb.shortCycleTmrLen) % MAX_DRX_SIZE; ueCb->drxUeCb.shortCycleDistance = ueCb->drxUeCb.shortCycleTmrLen / MAX_DRX_SIZE; - schAddDrxTimerIntoList(&cell->drxCb[ueCb->drxUeCb.shortCycleExpiryIndex].shortCycleExpiryList, ueCb, ueCb->drxUeCb.shortCycleTmrExpiryNodeInfo); + schAddDrxTimerIntoList(&cell->drxCb[ueCb->drxUeCb.shortCycleExpiryIndex].shortCycleExpiryList, ueCb, &ueCb->drxUeCb.shortCycleTmrExpiryNodeInfo); } /** diff --git a/src/5gnrsch/sch_utils.h b/src/5gnrsch/sch_utils.h index cc48c4b7b..b01c9ea26 100644 --- a/src/5gnrsch/sch_utils.h +++ b/src/5gnrsch/sch_utils.h @@ -51,7 +51,7 @@ #ifdef ODU_MEMORY_DEBUG_LOG #define SCH_MEM_LOG(_macro, _file, _line, _func, _size, _datPtr)\ {\ - printf("\n%s=== %s +%d, %s, %lu, %p", \ + printf("\n%s=== %s +%d, %s, %lu, %p \n", \ _macro, _file, _line, _func, (uint64_t)_size, (void *)_datPtr); \ } #else diff --git a/src/cm/common_def.c b/src/cm/common_def.c index 5071b7bc8..184d1d70f 100644 --- a/src/cm/common_def.c +++ b/src/cm/common_def.c @@ -283,7 +283,7 @@ uint8_t SGetSBufNewForDebug(char *file, const char *func, int line, Region regio #ifdef ODU_MEMORY_DEBUG_LOG if (strncmp(func,"cmInetRecvMsg",sizeof("cmInetRecvMsg"))) { - printf("\nCM_ALLOC=== SGetSBufNewForDebug %s +%d, %s, %d, %p",\ + printf("\nCM_ALLOC=== SGetSBufNewForDebug %s +%d, %s, %d, %p \n",\ file, line, func, size, *ptr); } #endif @@ -316,7 +316,7 @@ uint8_t SPutSBufNewForDebug(char *file, const char *func, int line, Region regio #ifdef ODU_MEMORY_DEBUG_LOG if (strncmp(func,"cmInetRecvMsg",sizeof("cmInetRecvMsg"))) { - printf("\nCM_FREE=== SPutSBufNewForDebug %s +%d, %s, %d, %p",\ + printf("\nCM_FREE=== SPutSBufNewForDebug %s +%d, %s, %d, %p \n",\ file, line, func, size, ptr); } #endif @@ -349,7 +349,7 @@ Region region, Pool pool, Data **ptr, Size size, uint8_t memType) if(SGetStaticBuffer(region, pool, ptr, size, memType) == ROK) { #ifdef ODU_MEMORY_DEBUG_LOG - printf("\nCM_ALLOC=== SGetStaticBufNewForDebug %s +%d, %s, %d, %p",\ + printf("\nCM_ALLOC=== SGetStaticBufNewForDebug %s +%d, %s, %d, %p \n",\ file, line, func, size, *ptr); #endif return ROK; @@ -380,7 +380,7 @@ Region region, Pool pool, Data *ptr, Size size, uint8_t memType) if(SPutStaticBuffer(region, pool, ptr, size, memType) == ROK) { #ifdef ODU_MEMORY_DEBUG_LOG - printf("\nCM_FREE=== SPutStaticBufNewForDebug %s +%d, %s, %d, %p",\ + printf("\nCM_FREE=== SPutStaticBufNewForDebug %s +%d, %s, %d, %p \n",\ file, line, func, size, ptr); #endif return ROK; diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index b690c6bb2..aae867745 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -710,7 +710,9 @@ uint8_t fillDefaultInitDlBwp(InitialDlBwp *initDlBwp) return RFAILED; } if(initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].k0) + { *(initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].k0) = 1; + } initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].mappingType = MAPPING_TYPEA; initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbol = PDSCH_START_SYMBOL; initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].symbolLength = PDSCH_LENGTH_SYMBOL; @@ -2117,6 +2119,53 @@ uint8_t DuProcMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp) return ret; } +/******************************************************************* + * + * @brief fill k0 value in duCb + * + * @details + * + * Function : fillK0Values + * Functionality: update k0 value in duCb + * + * @params[in] PdschConfig *cuPdschCfg, PdschConfig *storePdschCfg + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t fillK0Values(Bool toUpdate, PdschConfig *cuPdschCfg, PdschConfig *storePdschCfg) +{ + uint8_t numTimeDomRsrcAlloc, rsrcIdx; + + if(toUpdate) + { + if(cuPdschCfg) + { + if(storePdschCfg->numTimeDomRsrcAlloc) + { + numTimeDomRsrcAlloc = cuPdschCfg->numTimeDomRsrcAlloc; + for(rsrcIdx =0 ; rsrcIdxtimeDomRsrcAllociList[rsrcIdx].k0) + { + if(storePdschCfg->timeDomRsrcAllociList[rsrcIdx].k0) + { + *(storePdschCfg->timeDomRsrcAllociList[rsrcIdx].k0) = *(cuPdschCfg->timeDomRsrcAllociList[rsrcIdx].k0); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cuPdschCfg->timeDomRsrcAllociList[rsrcIdx].k0, sizeof(uint8_t)); + } + else + { + (storePdschCfg->timeDomRsrcAllociList[rsrcIdx].k0) = (cuPdschCfg->timeDomRsrcAllociList[rsrcIdx].k0); + } + } + } + } + } + } + return ROK; +} + /******************************************************************* * * @brief To update DuUeCb Mac Cfg @@ -2155,6 +2204,8 @@ uint8_t duUpdateMacCfg(DuMacUeCfg *macUeCfg, F1UeContextSetupDb *f1UeDb) { if(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent) { + /* update k0 values */ + fillK0Values(true, &f1UeDb->duUeCfg.copyOfmacUeCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg, &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg); fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\ &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL); } @@ -3025,6 +3076,7 @@ uint8_t duBuildAndSendUeRecfgReqToRlc(uint8_t cellId, uint8_t gnbDuUeF1apId, uin DU_LOG("\nERROR --> DU APP : Memory Alloc failed at duBuildAndSendUeRecfgReqToRlc()"); ret = RFAILED; } + DU_FREE(duRlcUeCfg, sizeof(DuRlcUeCfg)); return ret; } diff --git a/src/du_app/du_utils.h b/src/du_app/du_utils.h index 55a40de73..9c1cc148d 100644 --- a/src/du_app/du_utils.h +++ b/src/du_app/du_utils.h @@ -47,7 +47,7 @@ #ifdef ODU_MEMORY_DEBUG_LOG #define DU_MEM_LOG(_macro, _file, _line, _func, _size, _datPtr)\ {\ - printf("\n%s=== %s +%d, %s, %lu, %p", \ + printf("\n%s=== %s +%d, %s, %lu, %p \n", \ _macro, _file, _line, _func, (uint64_t)_size, _datPtr); \ } #else -- 2.16.6