From d62d6a2c96903363a6d7a2f1b23658bfef3590c9 Mon Sep 17 00:00:00 2001 From: barveankit Date: Wed, 22 Dec 2021 17:23:08 +0530 Subject: [PATCH] Fix for memory leak in UL data path at cu_stub [Issue-ID: ODUHIGH-398] Signed-off-by: barveankit Change-Id: Iddf1ffcffdadefb3d9aeed103cf87b1c0ccc64b6 Signed-off-by: barveankit --- src/cu_stub/cu_stub_egtp.c | 2 ++ src/cu_stub/cu_stub_sctp.c | 6 ++++-- src/du_app/du_egtp.c | 8 ++++++-- src/du_app/du_egtp.h | 1 + src/phy_stub/phy_stub.h | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/cu_stub/cu_stub_egtp.c b/src/cu_stub/cu_stub_egtp.c index 65f19a27e..cb3c5c82e 100644 --- a/src/cu_stub/cu_stub_egtp.c +++ b/src/cu_stub/cu_stub_egtp.c @@ -616,6 +616,8 @@ S16 cuEgtpDecodeHdr(Buffer *mBuf) DU_LOG("\nDEBUG --> EGTP : Message Buffer after decoding header [TEID:%d]",egtpMsg.msgHdr.teId); ODU_PRINT_MSG(mBuf, 0, 0); + SPutMsg(mBuf); + return ROK; } /* End of cuEgtpDecodeHdr */ diff --git a/src/cu_stub/cu_stub_sctp.c b/src/cu_stub/cu_stub_sctp.c index 39874f69e..fc0fe3be1 100644 --- a/src/cu_stub/cu_stub_sctp.c +++ b/src/cu_stub/cu_stub_sctp.c @@ -404,6 +404,7 @@ S16 sctpSockPoll() CmInetAddr egtpFromAddr; CmInetMemInfo memInfo; sctpSockPollParams f1PollParams; + uint64_t numMsgRcvd = 0; memset(&f1PollParams, 0, sizeof(sctpSockPollParams)); @@ -438,8 +439,9 @@ S16 sctpSockPoll() ret = cmInetRecvMsg(&(egtpCb.recvTptSrvr.sockFd), &egtpFromAddr, &memInfo, &egtpBuf, &egtpBufLen, CM_INET_NO_FLAG); if(ret == ROK && egtpBuf != NULLP) { - DU_LOG("\nINFO --> EGTP : Received message \n"); - ODU_PRINT_MSG(egtpBuf, 0 ,0); + DU_LOG("\nINFO --> EGTP : Received UL Message [%ld]\n", numMsgRcvd+1); + numMsgRcvd++; + //ODU_PRINT_MSG(egtpBuf, 0 ,0); cuEgtpHdlRecvMsg(egtpBuf); } diff --git a/src/du_app/du_egtp.c b/src/du_app/du_egtp.c index 075cd7c70..76ec0cf74 100644 --- a/src/du_app/du_egtp.c +++ b/src/du_app/du_egtp.c @@ -29,8 +29,6 @@ #include "du_egtp.h" #include "du_utils.h" -/* Global variable declaration */ -EgtpGlobalCb egtpCb; /************************************************************************** * @brief Task Initiation callback function. @@ -874,6 +872,7 @@ uint8_t egtpSendMsg(Buffer *mBuf) uint16_t txLen; CmInetMemInfo info; CmInetAddr dstAddr; + static uint64_t numDataSent = 0; info.region = DU_APP_MEM_REGION; info.pool = DU_POOL; @@ -888,6 +887,11 @@ uint8_t egtpSendMsg(Buffer *mBuf) DU_LOG("\nERROR --> EGTP : Failed sending the message"); return RFAILED; } + else + { + DU_LOG("\nDEBUG --> EGTP : Sent UL Message [%ld]", numDataSent+1); + numDataSent++; + } return ROK; } diff --git a/src/du_app/du_egtp.h b/src/du_app/du_egtp.h index 5fb3d653c..2f158e25b 100644 --- a/src/du_app/du_egtp.h +++ b/src/du_app/du_egtp.h @@ -72,6 +72,7 @@ typedef struct egtpGlobalCb EgtpTptSrvr recvTptSrvr; /* Transport server for receiving UDP msg */ EgtpDstCb dstCb; /* Destination endpoint */ }EgtpGlobalCb; + EgtpGlobalCb egtpCb; /* EGTP global control block */ uint8_t duHdlEgtpDlData(EgtpMsg *egtpMsg); diff --git a/src/phy_stub/phy_stub.h b/src/phy_stub/phy_stub.h index 6ee1a8fef..ffa77bca9 100644 --- a/src/phy_stub/phy_stub.h +++ b/src/phy_stub/phy_stub.h @@ -26,7 +26,7 @@ #define NR_PCI 1 #define SLOT_DELAY 3 #define NUM_DRB_TO_PUMP_DATA 3 -#define NUM_UL_PACKETS 4 +#define NUM_UL_PACKETS 1 /*UE Ids for RACH IND*/ #define UE_IDX_0 0 #define UE_IDX_1 1 -- 2.16.6