From fc7d3ce9647a7da04f5a67fa34419076069defc1 Mon Sep 17 00:00:00 2001 From: pborla Date: Mon, 10 Jun 2024 10:22:30 +0530 Subject: [PATCH] [ JIRA Id - ODUHIGH-606 ] Fixing null memory size allocation issue Change-Id: Ib8ec455b0a7714b62051e9b6ecde7c2647ed2eaf Signed-off-by: pborla --- build/odu/makefile | 2 +- src/5gnrmac/lwr_mac_phy.h | 10 ++++++++++ src/5gnrmac/mac_cfg_hdl.c | 4 ++++ src/5gnrmac/mac_utils.h | 13 +++++++++++++ src/5gnrrlc/rlc_utils.h | 14 ++++++++++++++ src/5gnrsch/sch_utils.h | 12 +++++++++++- src/cm/common_def.c | 11 +++++++++++ src/cm/du_app_mac_inf.h | 2 +- src/cm/mac_sch_interface.h | 2 +- src/du_app/du_utils.h | 12 ++++++++++++ 10 files changed, 78 insertions(+), 4 deletions(-) diff --git a/build/odu/makefile b/build/odu/makefile index 598228e44..d932b88c5 100644 --- a/build/odu/makefile +++ b/build/odu/makefile @@ -74,7 +74,7 @@ endif # macro for output file name and makefile name # -PLTFRM_FLAGS=-UMSPD -DODU -DINTEL_FAPI -UODU_MEMORY_DEBUG_LOG -DDEBUG_ASN_PRINT -UDEBUG_PRINT -DERROR_PRINT -USTART_DL_UL_DATA -UNR_DRX -UCALL_FLOW_DEBUG_LOG -UODU_SLOT_IND_DEBUG_LOG -UNFAPI_ENABLED -UTHREAD_AFFINITY +PLTFRM_FLAGS=-UMSPD -DODU -DINTEL_FAPI -UODU_MEMORY_DEBUG_LOG -DDEBUG_ASN_PRINT -UDEBUG_PRINT -DERROR_PRINT -USTART_DL_UL_DATA -UNR_DRX -UCALL_FLOW_DEBUG_LOG -UODU_SLOT_IND_DEBUG_LOG -UNFAPI_ENABLED -UTHREAD_AFFINITY -UMEM_SIZE_CHECK ifeq ($(MODE),TDD) PLTFRM_FLAGS += -DNR_TDD diff --git a/src/5gnrmac/lwr_mac_phy.h b/src/5gnrmac/lwr_mac_phy.h index 7c4fdb264..8f6591fa6 100644 --- a/src/5gnrmac/lwr_mac_phy.h +++ b/src/5gnrmac/lwr_mac_phy.h @@ -32,6 +32,15 @@ typedef enum MSG_TX_ERR }ErrorCode; +#ifdef MEM_SIZE_CHECK +#define WLS_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) \ +{\ + DU_LOG("\nRLC line = %d, func = %s, _size= %d ", _line, _func, _size); \ +} +#else +#define WLS_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) {} +#endif + #ifdef ODU_MEMORY_DEBUG_LOG #define WLS_MEM_LOG(_macro, _file, _line, _func, _size, _datPtr)\ {\ @@ -51,6 +60,7 @@ typedef enum /* allocate static buffer from WLS memory */ #define WLS_MEM_ALLOC(_datPtr, _size) \ { \ + WLS_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \ uint8_t _ret; \ _ret = SGetSBufWls(0, 0, (Data **)&_datPtr, _size); \ if(_ret == ROK) \ diff --git a/src/5gnrmac/mac_cfg_hdl.c b/src/5gnrmac/mac_cfg_hdl.c index bfac69cbd..b1e77b252 100644 --- a/src/5gnrmac/mac_cfg_hdl.c +++ b/src/5gnrmac/mac_cfg_hdl.c @@ -193,6 +193,10 @@ uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg) for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++) { macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices = macCellCfg->cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices; + + if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices==0) + break; + MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai, macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices\ * sizeof(Snssai*)); if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai == NULLP) diff --git a/src/5gnrmac/mac_utils.h b/src/5gnrmac/mac_utils.h index fea6322f5..99b07e442 100644 --- a/src/5gnrmac/mac_utils.h +++ b/src/5gnrmac/mac_utils.h @@ -23,6 +23,17 @@ #define MAC_MEM_REGION 4 #define MAC_POOL 1 +/* allocate and zero out a static buffer */ + +#ifdef MEM_SIZE_CHECK +#define MAC_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) \ +{\ + DU_LOG("\n MAC line = %d, func = %s, _size= %d ", _line, _func, _size); \ +} +#else +#define MAC_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) {} +#endif + #ifdef ODU_MEMORY_DEBUG_LOG #define MAC_MEM_LOG(_macro, _file, _line, _func, _size, _datPtr)\ {\ @@ -36,6 +47,7 @@ /* allocate and zero out a MAC static buffer */ #define MAC_ALLOC(_datPtr, _size) \ { \ + MAC_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \ uint8_t _ret; \ _ret = SGetSBuf(MAC_MEM_REGION, MAC_POOL, \ (Data **)&_datPtr, _size); \ @@ -66,6 +78,7 @@ * during inter-layer communication */ #define MAC_ALLOC_SHRABL_BUF(_buf, _size) \ { \ + MAC_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \ if(SGetStaticBuffer(MAC_MEM_REGION, MAC_POOL, \ (Data **)&_buf, (Size) _size, 0) == ROK) \ { \ diff --git a/src/5gnrrlc/rlc_utils.h b/src/5gnrrlc/rlc_utils.h index 5ec43d46a..dfdc31277 100755 --- a/src/5gnrrlc/rlc_utils.h +++ b/src/5gnrrlc/rlc_utils.h @@ -104,6 +104,15 @@ extern "C" { * Memory related Defines ******************************************************************************/ /* Allocate function */ +#ifdef MEM_SIZE_CHECK +#define RLC_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) \ +{\ + DU_LOG("\nRLC line = %d, func = %s, _size= %d ", _line, _func, _size); \ +} +#else +#define RLC_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) {} +#endif + #ifdef ODU_MEMORY_DEBUG_LOG #define RLC_MEM_LOG(_macro, _file, _line, _func, _size, _datPtr)\ {\ @@ -116,6 +125,7 @@ extern "C" { #define RLC_ALLOC(_cb,_buf, _size) \ { \ + RLC_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \ if (SGetSBuf(_cb->init.region, _cb->init.pool, (Data **)&_buf, \ (Size) _size) == ROK) \ { \ @@ -162,6 +172,7 @@ extern "C" { #define RLC_ALLOC_SHRABL_BUF_WC(_region, _pool,_buf, _size) \ { \ + RLC_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \ if(SGetStaticBuffer(_region, _pool, (Data **)&_buf, \ (Size) _size, 0)==ROK) \ {\ @@ -175,6 +186,7 @@ extern "C" { #define RLC_ALLOC_SHRABL_BUF(_region, _pool,_buf, _size) \ { \ + RLC_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \ if (SGetStaticBuffer(_region, _pool, (Data **)&_buf, \ (Size) _size, 0) == ROK) \ { \ @@ -189,6 +201,7 @@ extern "C" { #define RLC_ALLOC_WC(_cb,_buf, _size) \ {\ + RLC_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \ if(SGetSBuf(_cb->init.region, _cb->init.pool, (Data **)&_buf, (Size) _size) == ROK)\ {\ RLC_MEM_LOG("RLC,ALLOC_WC", __FILE__, __LINE__, __FUNCTION__, _size, _buf);\ @@ -270,6 +283,7 @@ extern "C" { #define RLC_SHRABL_STATIC_BUF_ALLOC(_region, _pool, _buf, _size) \ { \ + RLC_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \ SGetStaticBuffer(_region, _pool, (Data **)&_buf, \ (Size) _size, 0); \ RLC_MEM_LOG("RLC,SHRABL_STATIC_BUF_ALLOC", __FILE__, __LINE__, __FUNCTION__, _size, _buf);\ diff --git a/src/5gnrsch/sch_utils.h b/src/5gnrsch/sch_utils.h index f2e143748..c47a5adba 100644 --- a/src/5gnrsch/sch_utils.h +++ b/src/5gnrsch/sch_utils.h @@ -48,6 +48,15 @@ } /* allocate and zero out a static buffer */ +#ifdef MEM_SIZE_CHECK +#define SCH_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) \ +{\ + DU_LOG("\n SCH line = %d, func = %s, _size= %d ", _line, _func, _size); \ +} +#else +#define SCH_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) {} +#endif + #ifdef ODU_MEMORY_DEBUG_LOG #define SCH_MEM_LOG(_macro, _file, _line, _func, _size, _datPtr)\ {\ @@ -60,7 +69,8 @@ #define SCH_ALLOC(_datPtr, _size) \ { \ - uint8_t _ret; \ + SCH_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \ + uint8_t _ret; \ _ret = SGetSBuf(SCH_MEM_REGION, SCH_POOL, \ (Data **)&_datPtr, _size); \ if(_ret == ROK) \ diff --git a/src/cm/common_def.c b/src/cm/common_def.c index 4b974c3b5..c731bad45 100644 --- a/src/cm/common_def.c +++ b/src/cm/common_def.c @@ -18,6 +18,15 @@ #include "common_def.h" +#ifdef MEM_SIZE_CHECK +#define CM_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) \ +{\ + DU_LOG("\nRLC line = %d, func = %s, _size= %d ", _line, _func, _size); \ +} +#else +#define CM_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) {} +#endif + /*Spec 38.104, Table 5.4.2.1-1 ARFCN - FREQ mapping*/ /*{ F_REF(Mhz), ΔF_Global, F_REF-Offs, N_REF-offs, Range of N_REF }*/ uint32_t arfcnFreqTable[3][5] = { @@ -286,6 +295,7 @@ uint8_t convertSSBPeriodicityToEnum(uint32_t num) * ****************************************************************/ uint8_t SGetSBufNewForDebug(char *file, const char *func, int line, Region region, Pool pool, Data **ptr, Size size) { + CM_MEMORY_ALLOC_SIZE_LOG(line, func, size); if(SGetSBuf(region, pool, ptr, size) == ROK) { #ifdef ODU_MEMORY_DEBUG_LOG @@ -354,6 +364,7 @@ uint8_t SPutSBufNewForDebug(char *file, const char *func, int line, Region regio uint8_t SGetStaticBufNewForDebug(char *file, const char *func, int line, \ Region region, Pool pool, Data **ptr, Size size, uint8_t memType) { + CM_MEMORY_ALLOC_SIZE_LOG(line, func, size); if(SGetStaticBuffer(region, pool, ptr, size, memType) == ROK) { #ifdef ODU_MEMORY_DEBUG_LOG diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 0aa705552..f6ecc1125 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -98,7 +98,7 @@ #define BSR_SR_DELAY_TMR_2560 2560 #define PAGING_SCHED_DELTA 4 -#define MAX_PLMN 2 +#define MAX_PLMN 1 /********************* Global Variable ********************/ extern uint64_t ueBitMapPerCell[MAX_NUM_CELL]; /* Bit Map to store used/free UE-IDX per Cell */ diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index d6d42b7df..63fc020a3 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -117,7 +117,7 @@ #define DEFAULT_K2_VALUE_FOR_SCS60 2 #define DEFAULT_K2_VALUE_FOR_SCS120 3 -#define MAX_PLMN 2 +#define MAX_PLMN 1 #define DL_DMRS_SYMBOL_POS 4 /* Bitmap value 00000000000100 i.e. using 3rd symbol for PDSCH DMRS */ #define MAX_PHR_REPORT 1 /*TODO: Range of PHR reports in multiple PHR.*/ diff --git a/src/du_app/du_utils.h b/src/du_app/du_utils.h index e98aa43ad..98f033899 100644 --- a/src/du_app/du_utils.h +++ b/src/du_app/du_utils.h @@ -44,6 +44,16 @@ /* allocate and zero out a static buffer */ +#ifdef MEM_SIZE_CHECK +#define DU_APP_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) \ +{\ + DU_LOG("\n DUAPP line = %d, func = %s, _size= %d ", _line, _func, _size); \ +} +#else +#define DU_APP_MEMORY_ALLOC_SIZE_LOG(_line, _func, _size) {} +#endif + + #ifdef ODU_MEMORY_DEBUG_LOG #define DU_MEM_LOG(_macro, _file, _line, _func, _size, _datPtr)\ {\ @@ -56,6 +66,7 @@ #define DU_ALLOC(_datPtr, _size) \ { \ + DU_APP_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \ int _ret; \ _ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, \ (Data **)&_datPtr, _size); \ @@ -83,6 +94,7 @@ * during inter-layer communication */ #define DU_ALLOC_SHRABL_BUF(_buf, _size) \ { \ + DU_APP_MEMORY_ALLOC_SIZE_LOG(__LINE__, __FUNCTION__, _size); \ if(SGetStaticBuffer(DU_APP_MEM_REGION, DU_POOL, \ (Data **)&_buf, (Size) _size, 0) == ROK) \ { \ -- 2.16.6