X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_egtp.c;h=830b2df4f130261e0587a9a7fdbb5a4e9b68e69f;hb=59649f5f2828f14c82686094a633b14ce391f484;hp=36f03fea59fdca786225e5396bca64da8c100a6d;hpb=694adde1a08c393a8443fd5bbd4f036f5cf85403;p=o-du%2Fl2.git diff --git a/src/du_app/du_egtp.c b/src/du_app/du_egtp.c index 36f03fea5..830b2df4f 100644 --- a/src/du_app/du_egtp.c +++ b/src/du_app/du_egtp.c @@ -107,9 +107,23 @@ uint8_t egtpActvTsk(Pst *pst, Buffer *mBuf) ret = unpackEgtpTnlMgmtReq(egtpTnlMgmtReq, pst, mBuf); break; } - case EVTSLOTIND: + default: { - ret = unpackEgtpSlotInd(egtpSlotInd, pst, mBuf); + DU_LOG("\nEGTP : Invalid event %d", pst->event); + ODU_PUT_MSG_BUF(mBuf); + ret = RFAILED; + } + } + break; + } + case ENTEGTP: + { + switch(pst->event) + { + case EVTSTARTPOLL: + { + DU_LOG("\nEGTP : Starting Socket Polling"); + egtpRecvMsg(); ODU_PUT_MSG_BUF(mBuf); break; } @@ -119,8 +133,8 @@ uint8_t egtpActvTsk(Pst *pst, Buffer *mBuf) ODU_PUT_MSG_BUF(mBuf); ret = RFAILED; } - } - break; + } + break; } case ENTRLC: { @@ -165,22 +179,22 @@ uint8_t egtpActvTsk(Pst *pst, Buffer *mBuf) * ***********************************************************************/ uint8_t egtpCfgReq(Pst *pst, EgtpConfig egtpCfg) { - uint8_t ret; /* Return value */ - Pst rspPst; /* Response Pst structure */ + uint8_t ret; /* Return value */ + Pst rspPst; /* Response Pst structure */ CmStatus cfgCfm; /* Configuration Confirm */ memcpy(&egtpCb.egtpCfg, &egtpCfg, sizeof(EgtpConfig)); - egtpCb.recvTptSrvr.addr.address = CM_INET_NTOH_U32(egtpCb.egtpCfg.localIp.ipV4Addr); + egtpCb.recvTptSrvr.addr.address = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.localIp.ipV4Addr); egtpCb.recvTptSrvr.addr.port = EGTP_DFLT_PORT; - egtpCb.dstCb.dstIp = CM_INET_NTOH_U32(egtpCb.egtpCfg.destIp.ipV4Addr); + 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_U32(egtpCb.egtpCfg.localIp.ipV4Addr); + egtpCb.dstCb.sendTptSrvr.addr.address = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.localIp.ipV4Addr); egtpCb.dstCb.sendTptSrvr.addr.port = egtpCb.egtpCfg.localPort; egtpCb.dstCb.numTunn = 0; - ret = cmHashListInit(&(egtpCb.dstCb.teIdLst), 1024, sizeof(EgtpTeIdCb), FALSE, CM_HASH_KEYTYPE_U32MOD, DU_APP_MEM_REGION, DU_POOL); + ret = cmHashListInit(&(egtpCb.dstCb.teIdLst), 1024, sizeof(EgtpTeIdCb), FALSE, CM_HASH_KEYTYPE_UINT32_MOD, DU_APP_MEM_REGION, DU_POOL); if(ret != ROK) { @@ -255,10 +269,11 @@ uint8_t egtpFillRspPst(Pst *pst, Pst *rspPst) uint8_t egtpSrvOpenReq(Pst *pst) { - uint8_t ret; /* Return value */ - Pst rspPst; /* Response Pst structure */ - CmStatus cfm; /* Confirmation status */ - uint8_t sockType; /* Socket type */ + uint8_t ret; /* Return value */ + Pst rspPst; /* Response Pst structure */ + Pst egtpPst; /* Self post */ + CmStatus cfm; /* Confirmation status */ + uint8_t sockType; /* Socket type */ DU_LOG("\nEGTP : Received EGTP open server request"); @@ -280,7 +295,20 @@ uint8_t egtpSrvOpenReq(Pst *pst) DU_LOG("\nEGTP : Receiver socket[%d] and Sender socket[%d] open", egtpCb.recvTptSrvr.sockFd.fd, egtpCb.dstCb.sendTptSrvr.sockFd.fd); - /* Filling and seing response */ + /* Start Socket polling */ + memset(&egtpPst, 0, sizeof(egtpPst)); + egtpPst.srcEnt = (Ent)ENTEGTP; + egtpPst.srcInst = (Inst)EGTP_INST; + egtpPst.srcProcId = DU_PROC; + egtpPst.dstEnt = (Ent)ENTEGTP; + egtpPst.dstInst = (Inst)EGTP_INST; + egtpPst.dstProcId = DU_PROC; + egtpPst.event = EVTSTARTPOLL; + egtpPst.selector = ODU_SELECTOR_LC; + egtpPst.pool= DU_POOL; + packEgtpStartPollingReq(&egtpPst); + + /* Filling and sending response */ cfm.status = LCM_PRIM_OK; cfm.reason = LCM_REASON_NOT_APPL; @@ -337,8 +365,7 @@ uint8_t egtpSrvOpenPrc(uint8_t sockType, EgtpTptSrvr *server) * Functionality: * This function handles EGTP tunnel managament request * - * @param[in] Pst *pst, post structure - * Tunnel Eveny structure + * @param[in] Tunnel Eveny structure * @return ROK - success * RFAILED - failure * @@ -347,7 +374,6 @@ uint8_t egtpSrvOpenPrc(uint8_t sockType, EgtpTptSrvr *server) uint8_t egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) { S8 ret; - Pst rspPst; DU_LOG("\nEGTP : Received tunnel management request"); switch(tnlEvt.action) @@ -386,9 +412,7 @@ uint8_t egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) } DU_LOG("\nEGTP : Sending Tunnel management confirmation"); - egtpFillRspPst(pst, &rspPst); - rspPst.event = EVTTNLMGMTCFM; - packEgtpTnlMgmtCfm(&rspPst, tnlEvt); + duHdlEgtpTnlMgmtCfm(tnlEvt); return ROK; } @@ -410,9 +434,9 @@ uint8_t egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) * ***************************************************************************/ uint8_t egtpTnlAdd(EgtpTnlEvt tnlEvt) { - uint8_t ret; - EgtpTeIdCb *teidCb; /* Tunnel endpoint control block */ - EgtpMsgHdr preDefHdr; /* pre-define header for this tunnel */ + 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); @@ -539,11 +563,11 @@ uint8_t egtpTnlDel(EgtpTnlEvt tnlEvt) * ****************************************************************/ uint8_t egtpHdlDatInd(EgtpMsg egtpMsg) { - EgtpTeIdCb *teidCb = NULLP; - uint16_t tPduSize; + EgtpTeIdCb *teidCb = NULLP; + uint16_t tPduSize; uint8_t hdrLen; uint32_t msgLen; - EgtpMsgHdr *msgHdr; + EgtpMsgHdr *msgHdr; DU_LOG("\nEGTP : Received Data Indication"); @@ -630,10 +654,10 @@ uint8_t egtpHdlDatInd(EgtpMsg egtpMsg) * ****************************************************************/ uint8_t egtpEncodeHdr(uint8_t *preEncodedHdr, EgtpMsgHdr *preDefHdr, uint8_t *hdrIdx) { - uint8_t tmpByte = 0; /* Stores one byte of data for enc */ - uint8_t cnt = EGTP_MAX_HDR_LEN; /* Stores the position */ + 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; + uint16_t nwWord = 0; /* Encoding header */ tmpByte |= EGTP_MASK_BIT6; /* Setting 6th LSB of 1st byte as version */ @@ -741,8 +765,8 @@ uint8_t egtpEncodeHdr(uint8_t *preEncodedHdr, EgtpMsgHdr *preDefHdr, uint8_t *hd * ****************************************************************/ uint8_t egtpSendMsg(Buffer *mBuf) { - uint8_t ret; - uint16_t txLen; + uint8_t ret; + uint16_t txLen; CmInetMemInfo info; CmInetAddr dstAddr; @@ -765,28 +789,6 @@ uint8_t egtpSendMsg(Buffer *mBuf) return ROK; } -/******************************************************************* - * - * @brief Handles Slot Indication from PHY - * - * @details - * - * Function : egtpSlotInd - * - * Functionality: - * Handles TTI Indication from PHY - * - * @params[in] - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -uint8_t egtpSlotInd() -{ - egtpRecvMsg(); - return ROK; -} - /******************************************************************* * * @brief Receives EGTP message from UDP socket @@ -806,16 +808,13 @@ uint8_t egtpSlotInd() uint8_t egtpRecvMsg() { - uint8_t ret; /* Return value */ - uint8_t nMsg; /* Number of messages to read from UDP socked */ - uint16_t 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 Slot Indication"); - nMsg = 0; memInfo.region = DU_APP_MEM_REGION; memInfo.pool = DU_POOL; @@ -823,7 +822,7 @@ uint8_t egtpRecvMsg() fromAddr.port = egtpCb.dstCb.dstPort; fromAddr.address = egtpCb.dstCb.dstIp; - while(nMsg < EGTP_MAX_MSG_RECV) + while(true) { bufLen = -1; ret = cmInetRecvMsg(&(egtpCb.recvTptSrvr.sockFd), &fromAddr, &memInfo, \ @@ -840,6 +839,21 @@ uint8_t egtpRecvMsg() return ROK; } +/******************************************************************* + * + * @brief Handles DL User data received from CU + * + * @details + * + * Function : egtpHdlRecvData + * + * Functionality: Handles DL User data received from CU + * + * @params[in] DL Usre data buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ uint8_t egtpHdlRecvData(Buffer *mBuf) { EgtpMsg egtpMsg; @@ -853,15 +867,30 @@ uint8_t egtpHdlRecvData(Buffer *mBuf) return ROK; } +/******************************************************************* + * + * @brief Decodes EGTP header from DL User data + * + * @details + * + * Function : egtpDecodeHdr + * + * Functionality: Decodes EGTP header from DL User data + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ uint8_t egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) { - uint8_t tmpByte[5]; /* Holds 5 byte of data after Decoding */ - uint8_t version = 0; /* Holds the version type, decoded */ + 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 */ + 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 */ ODU_GET_MSG_LEN(mBuf, (int16_t *)&bufLen); @@ -1016,3 +1045,6 @@ uint8_t egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) return ROK; } +/********************************************************************** + End of file +**********************************************************************/