X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_egtp.c;h=a4a8d805534f26f5070a3c61e49212d463832f6b;hb=7bbfb856ac535a1d45ebdf9d37bb3ffc5e7a83dc;hp=90f67bcb5af1a9ccdbf2c984232d25524d07f0b9;hpb=5cc86eb25cc33a2cc1472325cffc5634a6c203c6;p=o-du%2Fl2.git diff --git a/src/du_app/du_egtp.c b/src/du_app/du_egtp.c index 90f67bcb5..a4a8d8055 100644 --- a/src/du_app/du_egtp.c +++ b/src/du_app/du_egtp.c @@ -27,10 +27,10 @@ #include "du_app_mac_inf.h" #include "du_cfg.h" #include "du_egtp.h" +#include "du_app_rlc_inf.h" +#include "du_mgr.h" #include "du_utils.h" -/* Global variable declaration */ -EgtpGlobalCb egtpCb; /************************************************************************** * @brief Task Initiation callback function. @@ -63,6 +63,104 @@ uint8_t egtpActvInit(Ent entity, Inst inst, Region region, Reason reason) return ROK; } +#ifdef CALL_FLOW_DEBUG_LOG +/************************************************************************** +* @brief Function prints the src dest and msg reached to egtp. +* +* @details +* +* Function : callFlowEgtpActvTsk +* +* Functionality: +* Function prints the src dest and msg reached to egtp. +* +* @param[in] Pst *pst, Post structure of the primitive. +* +* @return void +* +***************************************************************************/ + +void callFlowEgtpActvTsk(Pst *pst) +{ + + char sourceTask[50]; + char destTask[50]="ENTEGTP"; + char message[100]; + + switch(pst->srcEnt) + { + case ENTDUAPP: + { + strcpy(sourceTask,"ENTDUAPP"); + switch(pst->event) + { + case EVTCFGREQ: + { + strcpy(message,"EVTCFGREQ"); + break; + } + case EVTSRVOPENREQ: + { + strcpy(message,"EVTSRVOPENREQ"); + break; + } + case EVTTNLMGMTREQ: + { + strcpy(message,"EVTTNLMGMTREQ"); + break; + } + default: + { + strcpy(message,"Invalid Event"); + break; + } + } + break; + } + case ENTEGTP: + { + strcpy(sourceTask,"ENTEGTP"); + switch(pst->event) + { + case EVTSTARTPOLL: + { + strcpy(message,"EVTSTARTPOLL"); + break; + } + default: + { + strcpy(message,"Invalid Event"); + break; + } + } + break; + } + case ENTRLC: + { + strcpy(sourceTask,"ENTRLC"); + switch(pst->event) + { + case EVTDATIND: + { + strcpy(message,"EVTDATIND"); + break; + } + default: + { + strcpy(message,"Invalid Event"); + break; + } + } + break; + } + default: + { + strcpy(sourceTask,"Invalid Source Entity Id"); + } + } + DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message); +} +#endif /************************************************************************** * @brief Task Activation callback function. @@ -86,6 +184,10 @@ uint8_t egtpActvInit(Ent entity, Inst inst, Region region, Reason reason) uint8_t egtpActvTsk(Pst *pst, Buffer *mBuf) { uint8_t ret = ROK; + +#ifdef CALL_FLOW_DEBUG_LOG + callFlowEgtpActvTsk(pst); +#endif switch(pst->srcEnt) { @@ -186,13 +288,11 @@ uint8_t egtpCfgReq(Pst *pst, EgtpConfig egtpCfg) memcpy(&egtpCb.egtpCfg, &egtpCfg, sizeof(EgtpConfig)); - egtpCb.recvTptSrvr.addr.address = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.localIp.ipV4Addr); - egtpCb.recvTptSrvr.addr.port = EGTP_DFLT_PORT; + egtpCb.localAddr.address = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.localIp.ipV4Addr); + egtpCb.localAddr.port = egtpCb.egtpCfg.localPort; - egtpCb.dstCb.dstIp = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.destIp.ipV4Addr); - egtpCb.dstCb.dstPort = egtpCb.egtpCfg.destPort; - egtpCb.dstCb.sendTptSrvr.addr.address = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.localIp.ipV4Addr); - egtpCb.dstCb.sendTptSrvr.addr.port = egtpCb.egtpCfg.localPort; + egtpCb.dstCb.dstAddr.address = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.destIp.ipV4Addr); + egtpCb.dstCb.dstAddr.port = egtpCb.egtpCfg.destPort; egtpCb.dstCb.numTunn = 0; ret = cmHashListInit(&(egtpCb.dstCb.teIdLst), 1024, sizeof(EgtpTeIdCb), FALSE, CM_HASH_KEYTYPE_UINT32_MOD, DU_APP_MEM_REGION, DU_POOL); @@ -279,23 +379,15 @@ uint8_t egtpSrvOpenReq(Pst *pst) DU_LOG("\nDEBUG --> EGTP : Received EGTP open server request"); sockType = CM_INET_DGRAM; - ret = egtpSrvOpenPrc(sockType, &(egtpCb.recvTptSrvr)); - /* Opening and Binding receiver socket */ + ret = egtpSrvOpenPrc(sockType); + /* Opening and Binding receiver socket */ if(ret != ROK) { DU_LOG("\nERROR --> EGTP : Failed while opening receiver transport server"); return ret; } - /* Opening and Binding sender socket */ - ret = egtpSrvOpenPrc(sockType, &(egtpCb.dstCb.sendTptSrvr)); - if(ret != ROK) - { - DU_LOG("\nERROR --> EGTP : Failed while opening sender transport server"); - return ret; - } - DU_LOG("\nDEBUG --> EGTP : Receiver socket[%d] and Sender socket[%d] open", egtpCb.recvTptSrvr.sockFd.fd,\ - egtpCb.dstCb.sendTptSrvr.sockFd.fd); + DU_LOG("\nDEBUG --> EGTP : Socket [%d] is open", egtpCb.sockFd.fd); /* Start Socket polling */ memset(&egtpPst, 0, sizeof(egtpPst)); @@ -338,16 +430,16 @@ uint8_t egtpSrvOpenReq(Pst *pst) * * ****************************************************************/ -uint8_t egtpSrvOpenPrc(uint8_t sockType, EgtpTptSrvr *server) +uint8_t egtpSrvOpenPrc(uint8_t sockType) { S8 ret=ROK; - ret = cmInetSocket(sockType, &(server->sockFd), protType); + ret = cmInetSocket(sockType, &(egtpCb.sockFd), protType); if(ret != ROK) { DU_LOG("\nERROR --> EGTP : Failed to open UDP socket"); return ret; } - ret = cmInetBind(&(server->sockFd), &(server->addr)); + ret = cmInetBind(&(egtpCb.sockFd), &(egtpCb.localAddr)); if(ret != ROK) { DU_LOG("\nERROR --> EGTP : Failed to bind socket"); @@ -377,6 +469,10 @@ uint8_t egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) { uint8_t ret = ROK; +#ifdef CALL_FLOW_DEBUG_LOG + DU_LOG("\nCall Flow: ENTDUAPP -> ENTEGTP : TNL_MGMT\n"); +#endif + DU_LOG("\nDEBUG --> EGTP : Received tunnel management request"); switch(tnlEvt.action) { @@ -566,6 +662,10 @@ uint8_t egtpHdlDatInd(EgtpMsg egtpMsg) uint32_t msgLen; EgtpMsgHdr *msgHdr; +#ifdef CALL_FLOW_DEBUG_LOG + DU_LOG("\nCall Flow: ENTDUAPP -> ENTEGTP : DATA_INDICATION\n"); +#endif + DU_LOG("\nDEBUG --> EGTP : Received Data Indication"); cmHashListFind(&(egtpCb.dstCb.teIdLst), (uint8_t *)&(egtpMsg.msgHdr.teId), sizeof(uint32_t), 0, (PTR *)&teidCb); @@ -765,23 +865,22 @@ uint8_t egtpSendMsg(Buffer *mBuf) uint8_t ret; uint16_t txLen; CmInetMemInfo info; - CmInetAddr dstAddr; + static uint64_t numDataSent = 0; info.region = DU_APP_MEM_REGION; info.pool = DU_POOL; - dstAddr.port = EGTP_DFLT_PORT; - dstAddr.address = egtpCb.dstCb.dstIp; - - ret = cmInetSendMsg(&(egtpCb.dstCb.sendTptSrvr.sockFd), &dstAddr, &info, \ - mBuf, (int16_t *)&txLen, CM_INET_NO_FLAG); + ret = cmInetSendMsg(&egtpCb.sockFd, &egtpCb.dstCb.dstAddr, &info, mBuf, (int16_t *)&txLen, CM_INET_NO_FLAG); if(ret != ROK && ret != RWOULDBLOCK) { DU_LOG("\nERROR --> EGTP : Failed sending the message"); return RFAILED; } - - DU_LOG("\nDEBUG --> EGTP : Message Sent"); + else + { + DU_LOG("\nDEBUG --> EGTP : Sent UL Message [%ld]", numDataSent+1); + numDataSent++; + } return ROK; } @@ -808,26 +907,22 @@ uint8_t egtpRecvMsg() uint8_t ret; /* Return value */ uint16_t bufLen; /* Length of received buffer */ Buffer *recvBuf; /* Received buffer */ - CmInetAddr fromAddr; /* Egtp data sender address */ CmInetMemInfo memInfo; /* Buffer allocation info */ memInfo.region = DU_APP_MEM_REGION; memInfo.pool = DU_POOL; - fromAddr.port = egtpCb.dstCb.dstPort; - fromAddr.address = egtpCb.dstCb.dstIp; - while(true) { bufLen = -1; - ret = cmInetRecvMsg(&(egtpCb.recvTptSrvr.sockFd), &fromAddr, &memInfo, \ - &recvBuf, (int16_t *)&bufLen, CM_INET_NO_FLAG); + ret = cmInetRecvMsg(&egtpCb.sockFd, &egtpCb.dstCb.dstAddr, &memInfo, &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); + //ODU_PRINT_MSG(recvBuf, 0 ,0); egtpHdlRecvData(recvBuf); gDlDataRcvdCnt++; + } } @@ -895,11 +990,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 +1003,9 @@ 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); + UNUSED(msgLen); + UNUSED(version); + //DU_LOG("\nDEBUG --> EGTP : msgLen %d", msgLen); /**************************************************************************** @@ -920,7 +1017,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 +1129,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 */