[ JIRA Id - ODUHIGH-606 ] Fixing null memory size allocation issue
[o-du/l2.git] / src / 5gnrrlc / rlc_utils.h
index caf2c7e..dfdc312 100755 (executable)
@@ -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);\
@@ -1218,7 +1232,7 @@ typedef struct _rlcStats
    UMRLCStats   umRlcStats;
 }RLCStats;
 
-RLCStats gRlcStats;
+extern RLCStats gRlcStats;
 
 /* kw005.201 added support for L2 Measurement */
 #ifdef LTE_L2_MEAS
@@ -1779,9 +1793,9 @@ typedef struct rlcCb
    RlcThpt    rlcThpt;   /*!< Throughput at RLC*/
 }RlcCb;
 
-RlcCb *rlcCb[MAX_RLC_INSTANCES];   /*!< RLC global control block */
+extern RlcCb *rlcCb[MAX_RLC_INSTANCES];   /*!< RLC global control block */
 
-CmLListCp *arrTputPerSnssai[DIR_BOTH]; /*Stores the address of Througput LL*/
+extern CmLListCp *arrTputPerSnssai[DIR_BOTH]; /*Stores the address of Througput LL*/
 /****************************************************************************
  *                      Declarations
  ***************************************************************************/