X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_egtp.c;h=36d3978b18d9f17fcf02fb911b894bcb9b84e07d;hb=4d45b914f9e94203603d3b9fdbcb1aad361301dd;hp=e3d8d2e1ca7e2f311938c5ea7111aef9fe89485c;hpb=be7e4e372cc1d6f12f7af9c6b6d09a7ecedca58c;p=o-du%2Fl2.git diff --git a/src/du_app/du_egtp.c b/src/du_app/du_egtp.c index e3d8d2e1c..36d3978b1 100644 --- a/src/du_app/du_egtp.c +++ b/src/du_app/du_egtp.c @@ -17,10 +17,17 @@ *******************************************************************************/ /* This file contains all EGTP related functionality */ - -#include +#include "common_def.h" +#include "lrg.h" +#include "lkw.x" +#include "lrg.x" +#include "cm_inet.h" +#include "legtp.h" +#include "cm_inet.x" +#include "du_app_mac_inf.h" +#include "du_cfg.h" #include "du_egtp.h" -#include "du_ue_mgr.h" +#include "du_utils.h" /* Global variable declaration */ EgtpGlobalCb egtpCb; @@ -45,14 +52,14 @@ EgtpGlobalCb egtpCb; * @return ROK - success * RFAILED - failure ***************************************************************************/ -S16 egtpActvInit(Ent entity, Inst inst, Region region, Reason reason) +uint8_t egtpActvInit(Ent entity, Inst inst, Region region, Reason reason) { DU_LOG("\n\nEGTP : Initializing"); - cmMemset ((U8 *)&egtpCb, 0, sizeof(EgtpGlobalCb)); + memset ((uint8_t *)&egtpCb, 0, sizeof(EgtpGlobalCb)); protType = CM_INET_PROTO_UDP; - RETVALUE(ROK); + return ROK; } @@ -75,9 +82,9 @@ S16 egtpActvInit(Ent entity, Inst inst, Region region, Reason reason) * RFAILED - failure * ***************************************************************************/ -S16 egtpActvTsk(Pst *pst, Buffer *mBuf) +uint8_t egtpActvTsk(Pst *pst, Buffer *mBuf) { - S16 ret = ROK; + uint8_t ret = ROK; switch(pst->srcEnt) { @@ -87,29 +94,29 @@ S16 egtpActvTsk(Pst *pst, Buffer *mBuf) { case EVTCFGREQ: { - ret = cmUnpkEgtpCfgReq(egtpCfgReq, pst, mBuf); + ret = unpackEgtpCfgReq(egtpCfgReq, pst, mBuf); break; } case EVTSRVOPENREQ: { - ret = cmUnpkEgtpSrvOpenReq(egtpSrvOpenReq, pst, mBuf); + ret = unpackEgtpSrvOpenReq(egtpSrvOpenReq, pst, mBuf); break; } case EVTTNLMGMTREQ: { - ret = cmUnpkEgtpTnlMgmtReq(egtpTnlMgmtReq, pst, mBuf); + ret = unpackEgtpTnlMgmtReq(egtpTnlMgmtReq, pst, mBuf); break; } - case EVTTTIIND: + case EVTSLOTIND: { - ret = cmUnpkEgtpTTIInd(egtpTTIInd, pst, mBuf); - SPutMsg(mBuf); + ret = unpackEgtpSlotInd(egtpSlotInd, pst, mBuf); + ODU_PUT_MSG(mBuf); break; } default: { DU_LOG("\nEGTP : Invalid event %d", pst->event); - SPutMsg(mBuf); + ODU_PUT_MSG(mBuf); ret = RFAILED; } } @@ -138,8 +145,8 @@ S16 egtpActvTsk(Pst *pst, Buffer *mBuf) ret = RFAILED; } } - SExitTsk(); - RETVALUE(ret); + ODU_EXIT_TASK(); + return ret; } /************************************************************************** @@ -156,13 +163,13 @@ S16 egtpActvTsk(Pst *pst, Buffer *mBuf) * RFAILED - failure * * ***********************************************************************/ -S16 egtpCfgReq(Pst *pst, EgtpConfig egtpCfg) +uint8_t egtpCfgReq(Pst *pst, EgtpConfig egtpCfg) { - U8 ret; /* Return value */ + uint8_t ret; /* Return value */ Pst rspPst; /* Response Pst structure */ CmStatus cfgCfm; /* Configuration Confirm */ - cmMemcpy((U8 *)&egtpCb.egtpCfg, (U8 *)&egtpCfg, (PTR)sizeof(EgtpConfig)); + memcpy((uint8_t *)&egtpCb.egtpCfg, (uint8_t *)&egtpCfg, (PTR)sizeof(EgtpConfig)); egtpCb.recvTptSrvr.addr.address = CM_INET_NTOH_U32(egtpCb.egtpCfg.localIp.ipV4Addr); egtpCb.recvTptSrvr.addr.port = EGTP_DFLT_PORT; @@ -192,9 +199,9 @@ S16 egtpCfgReq(Pst *pst, EgtpConfig egtpCfg) egtpFillRspPst(pst, &rspPst); rspPst.event = EVTCFGCFM; - cmPkEgtpCfgCfm(&rspPst, cfgCfm); + packEgtpCfgCfm(&rspPst, cfgCfm); - RETVALUE(ROK); + return ROK; } /************************************************************************** @@ -212,20 +219,20 @@ S16 egtpCfgReq(Pst *pst, EgtpConfig egtpCfg) * * * ***********************************************************************/ -S16 egtpFillRspPst(Pst *pst, Pst *rspPst) +uint8_t egtpFillRspPst(Pst *pst, Pst *rspPst) { - cmMemset((U8 *)rspPst, 0, sizeof(Pst)); + memset((uint8_t *)rspPst, 0, sizeof(Pst)); rspPst->srcEnt = pst->dstEnt; rspPst->srcInst = pst->dstInst; rspPst->srcProcId = pst->dstProcId; rspPst->dstEnt = pst->srcEnt; rspPst->dstInst = pst->srcInst; rspPst->dstProcId = pst->srcProcId; - rspPst->selector = DU_SELECTOR_LC; + rspPst->selector = ODU_SELECTOR_LC; rspPst->pool= DU_POOL; - RETVALUE(ROK); + return ROK; } /************************************************************************** @@ -245,30 +252,30 @@ S16 egtpFillRspPst(Pst *pst, Pst *rspPst) * ***************************************************************************/ -S16 egtpSrvOpenReq(Pst *pst) +uint8_t egtpSrvOpenReq(Pst *pst) { - U8 ret; /* Return value */ + uint8_t ret; /* Return value */ Pst rspPst; /* Response Pst structure */ CmStatus cfm; /* Confirmation status */ - U8 sockType; /* Socket type */ + uint8_t sockType; /* Socket type */ DU_LOG("\nEGTP : Received EGTP open server request"); sockType = CM_INET_DGRAM; - - /* Opening and Binding receiver socket */ - if(ret = egtpSrvOpenPrc(sockType, &(egtpCb.recvTptSrvr)) != ROK) + ret = egtpSrvOpenPrc(sockType, &(egtpCb.recvTptSrvr)); + /* Opening and Binding receiver socket */ + if(ret != ROK) { DU_LOG("\nEGTP : Failed while opening receiver transport server"); - RETVALUE(RFAILED); + return ret; } - /* Opening and Binding sender socket */ - if(ret = egtpSrvOpenPrc(sockType, &(egtpCb.dstCb.sendTptSrvr)) != ROK) + ret = egtpSrvOpenPrc(sockType, &(egtpCb.dstCb.sendTptSrvr)); + if(ret != ROK) { DU_LOG("\nEGTP : Failed while opening sender transport server"); - RETVALUE(RFAILED); + return ret; } DU_LOG("\nEGTP : Receiver socket[%d] and Sender socket[%d] open", egtpCb.recvTptSrvr.sockFd.fd, egtpCb.dstCb.sendTptSrvr.sockFd.fd); @@ -279,9 +286,9 @@ S16 egtpSrvOpenReq(Pst *pst) egtpFillRspPst(pst, &rspPst); rspPst.event = EVTSRVOPENCFM; - cmPkEgtpSrvOpenCfm(&rspPst, cfm); + packEgtpSrvOpenCfm(&rspPst, cfm); - RETVALUE(ROK); + return ret; } /******************************************************************* @@ -301,23 +308,23 @@ S16 egtpSrvOpenReq(Pst *pst) * * ****************************************************************/ -S16 egtpSrvOpenPrc(U8 sockType, EgtpTptSrvr *server) +uint8_t egtpSrvOpenPrc(uint8_t sockType, EgtpTptSrvr *server) { - S8 ret; - - if(ret = (cmInetSocket(sockType, &(server->sockFd), protType)) != ROK) + S8 ret=ROK; + ret = cmInetSocket(sockType, &(server->sockFd), protType); + if(ret != ROK) { DU_LOG("\nEGTP : Failed to open UDP socket"); - RETVALUE(RFAILED); + return ret; } - - if(ret = cmInetBind(&(server->sockFd), &(server->addr)) != ROK) + ret = cmInetBind(&(server->sockFd), &(server->addr)); + if(ret != ROK) { DU_LOG("\nEGTP : Failed to bind socket"); - RETVALUE(RFAILED); + return ret; } - RETVALUE(ROK); + return ret; } /************************************************************************** @@ -337,7 +344,7 @@ S16 egtpSrvOpenPrc(U8 sockType, EgtpTptSrvr *server) * * ***************************************************************************/ -S16 egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) +uint8_t egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) { S8 ret; Pst rspPst; @@ -381,9 +388,9 @@ S16 egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) DU_LOG("\nEGTP : Sending Tunnel management confirmation"); egtpFillRspPst(pst, &rspPst); rspPst.event = EVTTNLMGMTCFM; - cmPkEgtpTnlMgmtCfm(&rspPst, tnlEvt); + packEgtpTnlMgmtCfm(&rspPst, tnlEvt); - RETVALUE(ROK); + return ROK; } /************************************************************************** @@ -401,45 +408,45 @@ S16 egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) * RFAILED - failure * * ***************************************************************************/ -S16 egtpTnlAdd(EgtpTnlEvt tnlEvt) +uint8_t egtpTnlAdd(EgtpTnlEvt tnlEvt) { - S16 ret; + uint8_t ret; EgtpTeIdCb *teidCb; /* Tunnel endpoint control block */ EgtpMsgHdr preDefHdr; /* pre-define header for this tunnel */ DU_LOG("\nEGTP : Tunnel addition : LocalTeid[%d] Remote Teid[%d]", tnlEvt.lclTeid, tnlEvt.remTeid); - ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)&teidCb, (Size)sizeof(EgtpTeIdCb)); - if(ret != ROK) + DU_ALLOC(teidCb, sizeof(EgtpTeIdCb)); + if(teidCb == NULLP) { DU_LOG("\nEGTP : Memory allocation failed"); - RETVALUE(LCM_REASON_MEM_NOAVAIL); + return LCM_REASON_MEM_NOAVAIL; } - cmMemset((U8 *)teidCb, 0, sizeof(EgtpTeIdCb)); + memset((uint8_t *)teidCb, 0, sizeof(EgtpTeIdCb)); teidCb->teId = tnlEvt.lclTeid; teidCb->remTeId = tnlEvt.remTeid; - ret = cmHashListInsert(&(egtpCb.dstCb.teIdLst), (PTR)teidCb, (U8 *)&(teidCb->teId), sizeof(U32)); + ret = cmHashListInsert(&(egtpCb.dstCb.teIdLst), (PTR)teidCb, (uint8_t *)&(teidCb->teId), sizeof(uint32_t)); if(ret != ROK) { DU_LOG("\nEGTP : Failed to insert in hash list"); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)teidCb, (Size)sizeof(EgtpTeIdCb)); - RETVALUE(LCM_REASON_HASHING_FAILED); + DU_FREE(teidCb, sizeof(EgtpTeIdCb)); + return LCM_REASON_HASHING_FAILED; } egtpCb.dstCb.numTunn++; /* Encoding pre-defined header */ - cmMemset((U8*)&preDefHdr, 0, sizeof(EgtpMsgHdr)); + memset((uint8_t*)&preDefHdr, 0, sizeof(EgtpMsgHdr)); preDefHdr.msgType = EGTPU_MSG_GPDU; preDefHdr.teId = teidCb->remTeId; preDefHdr.extHdr.pdcpNmb.pres = FALSE; preDefHdr.extHdr.udpPort.pres = FALSE; preDefHdr.nPdu.pres = FALSE; - egtpEncodeHdr((U8 *)teidCb->preEncodedHdr.hdr, &preDefHdr, &(teidCb->preEncodedHdr.cnt)); + egtpEncodeHdr((uint8_t *)teidCb->preEncodedHdr.hdr, &preDefHdr, &(teidCb->preEncodedHdr.cnt)); - RETVALUE(ROK); + return ROK; } /* egtpTnlAdd */ /************************************************************************** @@ -457,25 +464,25 @@ S16 egtpTnlAdd(EgtpTnlEvt tnlEvt) * RFAILED - failure * * ***************************************************************************/ -S16 egtpTnlMod(EgtpTnlEvt tnlEvt) +uint8_t egtpTnlMod(EgtpTnlEvt tnlEvt) { #if 0 - S16 ret; + uint8_t ret; EgtpTeIdCb *teidCb = NULLP; printf("\nTunnel modification : LocalTeid[%d] Remote Teid[%d]", tnlEvt.lclTeid, tnlEvt.remTeid); - cmHashListFind(&(egtpCb.dstCb.teIdLst), (U8 *)&(tnlEvt.teId), sizeof(U32), 0, (PTR *)&teidCb); + cmHashListFind(&(egtpCb.dstCb.teIdLst), (uint8_t *)&(tnlEvt.teId), sizeof(uint32_t), 0, (PTR *)&teidCb); if(teidCb == NULLP) { printf("\nTunnel id not found"); - RETVALUE(RFAILED); + return RFAILED; } teidCb->teId = tnlEvt.lclTeid; teidCb->remTeId = tnlEvt.remTeid; #endif - RETVALUE(ROK); + return ROK; } /************************************************************************** @@ -493,24 +500,24 @@ S16 egtpTnlMod(EgtpTnlEvt tnlEvt) * RFAILED - failure * * ***************************************************************************/ -S16 egtpTnlDel(EgtpTnlEvt tnlEvt) +uint8_t egtpTnlDel(EgtpTnlEvt tnlEvt) { EgtpTeIdCb *teidCb = NULLP; DU_LOG("\nEGTP : Tunnel deletion : Local Teid[%d] Remote Teid[%d]", tnlEvt.lclTeid, tnlEvt.remTeid); - cmHashListFind(&(egtpCb.dstCb.teIdLst), (U8 *)&(tnlEvt.lclTeid), sizeof(U32), 0, (PTR *)&teidCb); + cmHashListFind(&(egtpCb.dstCb.teIdLst), (uint8_t *)&(tnlEvt.lclTeid), sizeof(uint32_t), 0, (PTR *)&teidCb); if(teidCb == NULLP) { DU_LOG("\nEGTP : Tunnel id[%d] not configured", tnlEvt.lclTeid); - RETVALUE(LCM_REASON_INVALID_PAR_VAL); + return LCM_REASON_INVALID_PAR_VAL; } cmHashListDelete(&(egtpCb.dstCb.teIdLst), (PTR)teidCb); - SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)teidCb, (Size)sizeof(EgtpTeIdCb)); + DU_FREE(teidCb, sizeof(EgtpTeIdCb)); egtpCb.dstCb.numTunn--; - RETVALUE(ROK); + return ROK; } /******************************************************************* @@ -530,21 +537,21 @@ S16 egtpTnlDel(EgtpTnlEvt tnlEvt) * RFAILED - failure * * ****************************************************************/ -S16 egtpHdlDatInd(EgtpMsg egtpMsg) +uint8_t egtpHdlDatInd(EgtpMsg egtpMsg) { EgtpTeIdCb *teidCb = NULLP; - MsgLen tPduSize; - U8 hdrLen; - U32 msgLen; + uint16_t tPduSize; + uint8_t hdrLen; + uint32_t msgLen; EgtpMsgHdr *msgHdr; DU_LOG("\nEGTP : Received Data Indication"); - cmHashListFind(&(egtpCb.dstCb.teIdLst), (U8 *)&(egtpMsg.msgHdr.teId), sizeof(U32), 0, (PTR *)&teidCb); + cmHashListFind(&(egtpCb.dstCb.teIdLst), (uint8_t *)&(egtpMsg.msgHdr.teId), sizeof(uint32_t), 0, (PTR *)&teidCb); if(teidCb == NULLP) { DU_LOG("\nEGTP : Tunnel id[%d] not configured", egtpMsg.msgHdr.teId); - RETVALUE(LCM_REASON_INVALID_PAR_VAL); + return LCM_REASON_INVALID_PAR_VAL; } msgHdr = &(egtpMsg.msgHdr); @@ -565,7 +572,7 @@ S16 egtpHdlDatInd(EgtpMsg egtpMsg) teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 1] &= ~(EGTP_MASK_BIT3); } - SFndLenMsg(egtpMsg.msg, &tPduSize); + ODU_FIND_MSG_LEN(egtpMsg.msg, &tPduSize); /*Adjust the header to fill the correct length*/ msgLen = tPduSize + (EGTP_MAX_HDR_LEN - hdrLen) - 0x08; @@ -573,15 +580,15 @@ S16 egtpHdlDatInd(EgtpMsg egtpMsg) /*********************************************** * Fill the length field of the message header * ***********************************************/ - teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 3] = (U8)GetHiByte(msgLen); - teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 4] = (U8)GetLoByte(msgLen); + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 3] = (uint8_t)GetHiByte(msgLen); + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 4] = (uint8_t)GetLoByte(msgLen); /*Update the sequence number*/ if(egtpMsg.msgHdr.seqNum.pres) { teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 1] |= (EGTP_MASK_BIT2); - teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 9] = (U8)GetHiByte(egtpMsg.msgHdr.seqNum.val); - teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 10] = (U8)GetLoByte(egtpMsg.msgHdr.seqNum.val); + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 9] = (uint8_t)GetHiByte(egtpMsg.msgHdr.seqNum.val); + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 10] = (uint8_t)GetLoByte(egtpMsg.msgHdr.seqNum.val); } else { @@ -589,19 +596,19 @@ S16 egtpHdlDatInd(EgtpMsg egtpMsg) } DU_LOG("\nEGTP : UL Data buffer before encoding header"); - SPrntMsg(egtpMsg.msg, 0, 0); + ODU_PRINT_MSG(egtpMsg.msg, 0, 0); - SAddPreMsgMult(&teidCb->preEncodedHdr.hdr[hdrLen], (EGTP_MAX_HDR_LEN - hdrLen), egtpMsg.msg); + ODU_ADD_PRE_MSG_MULT(&teidCb->preEncodedHdr.hdr[hdrLen], (EGTP_MAX_HDR_LEN - hdrLen), egtpMsg.msg); DU_LOG("\nEGTP : UL Data buffer after encoding header"); - SPrntMsg(egtpMsg.msg, 0, 0); + ODU_PRINT_MSG(egtpMsg.msg, 0, 0); /* Send over UDP */ egtpSendMsg(egtpMsg.msg); - SPutMsg(egtpMsg.msg); + ODU_PUT_MSG(egtpMsg.msg); - RETVALUE(ROK); + return ROK; }/* EgtpHdlDatInd */ /******************************************************************* @@ -621,12 +628,12 @@ S16 egtpHdlDatInd(EgtpMsg egtpMsg) * RFAILED - failure * * ****************************************************************/ -S16 egtpEncodeHdr(U8 *preEncodedHdr, EgtpMsgHdr *preDefHdr, U8 *hdrIdx) +uint8_t egtpEncodeHdr(uint8_t *preEncodedHdr, EgtpMsgHdr *preDefHdr, uint8_t *hdrIdx) { - U8 tmpByte = 0; /* Stores one byte of data for enc */ - U8 cnt = EGTP_MAX_HDR_LEN; /* Stores the position */ - Bool extPres = FALSE; /* Flag for indication of S, E or P presense flag */ - U16 nwWord = 0; + uint8_t tmpByte = 0; /* Stores one byte of data for enc */ + uint8_t cnt = EGTP_MAX_HDR_LEN; /* Stores the position */ + bool extPres = FALSE; /* Flag for indication of S, E or P presense flag */ + uint16_t nwWord = 0; /* Encoding header */ tmpByte |= EGTP_MASK_BIT6; /* Setting 6th LSB of 1st byte as version */ @@ -658,12 +665,12 @@ S16 egtpEncodeHdr(U8 *preEncodedHdr, EgtpMsgHdr *preDefHdr, U8 *hdrIdx) /* Encode Tunnel endpoint */ preEncodedHdr[--cnt] = 0; preEncodedHdr[--cnt] = 0; - nwWord = (U16)(GetHiWord(preDefHdr->teId)); - preEncodedHdr[--cnt] = (U8)(GetHiByte(nwWord)); - preEncodedHdr[--cnt] = (U8)(GetLoByte(nwWord)); - nwWord = (U16)(GetLoWord(preDefHdr->teId)); - preEncodedHdr[--cnt] = (U8)(GetHiByte(nwWord)); - preEncodedHdr[--cnt] = (U8)(GetLoByte(nwWord)); + nwWord = (uint16_t)(GetHiWord(preDefHdr->teId)); + preEncodedHdr[--cnt] = (uint8_t)(GetHiByte(nwWord)); + preEncodedHdr[--cnt] = (uint8_t)(GetLoByte(nwWord)); + nwWord = (uint16_t)(GetLoWord(preDefHdr->teId)); + preEncodedHdr[--cnt] = (uint8_t)(GetHiByte(nwWord)); + preEncodedHdr[--cnt] = (uint8_t)(GetLoByte(nwWord)); /* Encode sequence number */ if(preDefHdr->seqNum.pres) @@ -713,7 +720,7 @@ S16 egtpEncodeHdr(U8 *preEncodedHdr, EgtpMsgHdr *preDefHdr, U8 *hdrIdx) } *hdrIdx = cnt; - RETVALUE(ROK); + return ROK; } /* egtpEncodeHdr */ /******************************************************************* @@ -732,10 +739,10 @@ S16 egtpEncodeHdr(U8 *preEncodedHdr, EgtpMsgHdr *preDefHdr, U8 *hdrIdx) * RFAILED - failure * * ****************************************************************/ -S16 egtpSendMsg(Buffer *mBuf) +uint8_t egtpSendMsg(Buffer *mBuf) { - S16 ret; - MsgLen txLen; + uint8_t ret; + uint16_t txLen; CmInetMemInfo info; CmInetAddr dstAddr; @@ -749,21 +756,21 @@ S16 egtpSendMsg(Buffer *mBuf) if(ret != ROK && ret != RWOULDBLOCK) { DU_LOG("\nEGTP : Failed sending the message"); - RETVALUE(RFAILED); + return RFAILED; } DU_LOG("\nEGTP : Message Sent"); - RETVALUE(ROK); + return ROK; } /******************************************************************* * - * @brief Handles TTI Indication from PHY + * @brief Handles Slot Indication from PHY * * @details * - * Function : egtpTTIInd + * Function : egtpSlotInd * * Functionality: * Handles TTI Indication from PHY @@ -773,10 +780,10 @@ S16 egtpSendMsg(Buffer *mBuf) * RFAILED - failure * * ****************************************************************/ -S16 egtpTTIInd() +uint8_t egtpSlotInd() { egtpRecvMsg(); - RETVALUE(ROK); + return ROK; } /******************************************************************* @@ -796,17 +803,17 @@ S16 egtpTTIInd() * * ****************************************************************/ -S16 egtpRecvMsg() +uint8_t egtpRecvMsg() { - U8 ret; /* Return value */ - U8 nMsg; /* Number of messages to read from UDP socked */ - MsgLen bufLen; /* Length of received buffer */ + uint8_t ret; /* Return value */ + uint8_t nMsg; /* Number of messages to read from UDP socked */ + uint16_t bufLen; /* Length of received buffer */ Buffer *recvBuf; /* Received buffer */ CmInetAddr fromAddr; /* Egtp data sender address */ CmInetMemInfo memInfo; /* Buffer allocation info */ - DU_LOG("\nEGTP : Received TTI Indication"); + DU_LOG("\nEGTP : Received Slot Indication"); nMsg = 0; memInfo.region = DU_APP_MEM_REGION; @@ -822,16 +829,16 @@ S16 egtpRecvMsg() if(ret == ROK && recvBuf != NULLP) { DU_LOG("\nEGTP : Received DL Message[%d]\n", nMsg+1); - SPrntMsg(recvBuf, 0 ,0); + ODU_PRINT_MSG(recvBuf, 0 ,0); egtpHdlRecvData(recvBuf); } nMsg++; } - RETVALUE(ROK); + return ROK; } -S16 egtpHdlRecvData(Buffer *mBuf) +uint8_t egtpHdlRecvData(Buffer *mBuf) { EgtpMsg egtpMsg; @@ -841,23 +848,23 @@ S16 egtpHdlRecvData(Buffer *mBuf) /* TODO : Send received message to RLC */ duHdlEgtpDlData(&egtpMsg); - RETVALUE(ROK); + return ROK; } -S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) +uint8_t egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) { - U8 tmpByte[5]; /* Holds 5 byte of data after Decoding */ - U8 version = 0; /* Holds the version type, decoded */ - MsgLen msgLen = 0; /* Holds the msgLen from the Hdr */ - MsgLen bufLen = 0; /* Holds the total buffer length */ - U8 extHdrType = 0; /* Holds the Extension hdr type */ - U8 extHdrLen = 0; /* Extension hdr length */ - Bool extPres = FALSE; /* Flag for indication of S, E or P presense flag */ + uint8_t tmpByte[5]; /* Holds 5 byte of data after Decoding */ + uint8_t version = 0; /* Holds the version type, decoded */ + uint16_t msgLen = 0; /* Holds the msgLen from the Hdr */ + uint16_t bufLen = 0; /* Holds the total buffer length */ + uint8_t extHdrType = 0; /* Holds the Extension hdr type */ + uint8_t extHdrLen = 0; /* Extension hdr length */ + bool extPres = FALSE; /* Flag for indication of S, E or P presense flag */ - SFndLenMsg(mBuf, &bufLen); + ODU_FIND_MSG_LEN(mBuf, &bufLen); /* Decode first byte and storing in temporary variable */ - SRemPreMsg(&tmpByte[0], mBuf); + ODU_REM_PRE_MSG(&tmpByte[0], mBuf); /* Extracting version fro 1st byte */ version = tmpByte[0] >> 5; @@ -865,15 +872,15 @@ S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) DU_LOG("\nEGTP : Version %d", version); /* Decode message type */ - SRemPreMsg((Data*)&(egtpMsg->msgHdr.msgType), mBuf); + ODU_REM_PRE_MSG((Data*)&(egtpMsg->msgHdr.msgType), mBuf); DU_LOG("\nEGTP : msgType %d", egtpMsg->msgHdr.msgType); /**************************************************************************** * Message length param is 2 bytes. So decode next 2 bytes from msg hdr and * performing OR operation on these two bytes to calculate message length ***************************************************************************/ - SRemPreMsg(&tmpByte[1], mBuf); - SRemPreMsg(&tmpByte[2], mBuf); + ODU_REM_PRE_MSG(&tmpByte[1], mBuf); + ODU_REM_PRE_MSG(&tmpByte[2], mBuf); msgLen = (tmpByte[1] << 8) | tmpByte[2]; DU_LOG("\nEGTP : msgLen %d", msgLen); @@ -882,10 +889,10 @@ S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) * Tunnel id param is 4 bytes. So decode next 4 bytes from msg hdr and * perform OR operation on these 4 bytes to calculate tunnel id ***************************************************************************/ - SRemPreMsg(&tmpByte[1], mBuf); - SRemPreMsg(&tmpByte[2], mBuf); - SRemPreMsg(&tmpByte[3], mBuf); - SRemPreMsg(&tmpByte[4], mBuf); + ODU_REM_PRE_MSG(&tmpByte[1], mBuf); + ODU_REM_PRE_MSG(&tmpByte[2], mBuf); + 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("\nEGTP : teId %d",egtpMsg->msgHdr.teId); @@ -904,8 +911,8 @@ S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) * perform OR operation on them ************************************************************************/ egtpMsg->msgHdr.seqNum.pres = TRUE; - SRemPreMsg(&tmpByte[1], mBuf); - SRemPreMsg(&tmpByte[2], mBuf); + ODU_REM_PRE_MSG(&tmpByte[1], mBuf); + ODU_REM_PRE_MSG(&tmpByte[2], mBuf); egtpMsg->msgHdr.seqNum.val = (tmpByte[1] << 8) | tmpByte[2]; } /**************************************************************************** @@ -919,8 +926,8 @@ S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) * perform OR operation on them ************************************************************************/ egtpMsg->msgHdr.seqNum.pres = 0; - SRemPreMsg(&tmpByte[1], mBuf); - SRemPreMsg(&tmpByte[2], mBuf); + ODU_REM_PRE_MSG(&tmpByte[1], mBuf); + ODU_REM_PRE_MSG(&tmpByte[2], mBuf); egtpMsg->msgHdr.seqNum.val = (tmpByte[1] << 8) | tmpByte[2]; } @@ -928,7 +935,7 @@ S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) if (tmpByte[0] & EGTP_MASK_BIT1) { egtpMsg->msgHdr.nPdu.pres = TRUE; - SRemPreMsg(&(egtpMsg->msgHdr.nPdu.val), mBuf); + ODU_REM_PRE_MSG(&(egtpMsg->msgHdr.nPdu.val), mBuf); } /**************************************************************************** * If extPres is true, but PN bit is not set, implies, either of S or E bit @@ -937,20 +944,20 @@ S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) else if(extPres) { egtpMsg->msgHdr.nPdu.pres = TRUE; - SRemPreMsg(&(egtpMsg->msgHdr.nPdu.val), mBuf); + ODU_REM_PRE_MSG(&(egtpMsg->msgHdr.nPdu.val), mBuf); } /* If E flag is set in first byte, decode extension header */ if(tmpByte[0] & EGTP_MASK_BIT3) { - SRemPreMsg(&extHdrType, mBuf); + ODU_REM_PRE_MSG(&extHdrType, mBuf); while( 0 != extHdrType) { switch (extHdrType) { case EGTP_EXT_HDR_UDP_TYPE: { - SRemPreMsg(&extHdrLen, mBuf); + ODU_REM_PRE_MSG(&extHdrLen, mBuf); if(extHdrLen == 0x01) { /************************************************************ @@ -958,8 +965,8 @@ S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) * and perform OR operation on them *************************************************************/ egtpMsg->msgHdr.extHdr.udpPort.pres = TRUE; - SRemPreMsg(&tmpByte[1], mBuf); - SRemPreMsg(&tmpByte[2], mBuf); + ODU_REM_PRE_MSG(&tmpByte[1], mBuf); + ODU_REM_PRE_MSG(&tmpByte[2], mBuf); egtpMsg->msgHdr.extHdr.udpPort.val = (tmpByte[1] << 8) | tmpByte[2]; } break; @@ -967,7 +974,7 @@ S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) case EGTP_EXT_HDR_PDCP_TYPE: { - SRemPreMsg(&extHdrLen, mBuf); + ODU_REM_PRE_MSG(&extHdrLen, mBuf); if(extHdrLen == 0x01) { /************************************************************* @@ -975,15 +982,15 @@ S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) * and perform OR operation on them ************************************************************/ egtpMsg->msgHdr.extHdr.pdcpNmb.pres = TRUE; - SRemPreMsg(&tmpByte[1], mBuf); - SRemPreMsg(&tmpByte[2], mBuf); + ODU_REM_PRE_MSG(&tmpByte[1], mBuf); + ODU_REM_PRE_MSG(&tmpByte[2], mBuf); egtpMsg->msgHdr.extHdr.pdcpNmb.val = (tmpByte[1] << 8) | tmpByte[2]; } break; } } /* End of switch */ - SRemPreMsg(&extHdrType, mBuf); + ODU_REM_PRE_MSG(&extHdrType, mBuf); } /* End of while */ } @@ -994,16 +1001,16 @@ S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) ***************************************************************************/ else if(extPres) { - SRemPreMsg(&extHdrType, mBuf); + ODU_REM_PRE_MSG(&extHdrType, mBuf); } egtpMsg->msg = mBuf; DU_LOG("\nEGTP : DL Data Buffer after decoding header "); - SPrntMsg(mBuf, 0, 0); + ODU_PRINT_MSG(mBuf, 0, 0); /* Forward the data to duApp/RLC */ - RETVALUE(ROK); + return ROK; }