X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fdu_app%2Fdu_sctp.c;h=bdbccbbaaf44ff9ec82ae329b37e70ed7b28e285;hb=45d134510deb6902b870b4a0fb574b6075fba601;hp=28576af186feefd7ced65b43bfbac05c46b8313b;hpb=571b7d1991b8ea5cc64a76f38940d5ac9b4b84e2;p=o-du%2Fl2.git diff --git a/src/du_app/du_sctp.c b/src/du_app/du_sctp.c index 28576af18..bdbccbbaa 100644 --- a/src/du_app/du_sctp.c +++ b/src/du_app/du_sctp.c @@ -17,11 +17,16 @@ *******************************************************************************/ /* This file contains all SCTP related functionality */ - -#include +#include "common_def.h" +#include "lrg.h" +#include "legtp.h" +#include "lrg.x" +#include "lkw.x" +#include "du_app_mac_inf.h" +#include "du_cfg.h" #include "du_sctp.h" #include "lsctp.h" - +#include "du_utils.h" /************************************************************************** * @brief Task Initiation callback function. @@ -291,7 +296,7 @@ S16 establishReq(DuSctpDestCb *paramPtr) } if((ret == ROK) & (paramPtr->itfState == DU_SCTP_DOWN)) { - paramPtr->itfState = DU_SCTP_UP; + paramPtr->itfState = DU_SCTP_CONNECTING; } /* Post the EVTSTARTPOLL Msg */ @@ -329,7 +334,8 @@ S16 duSctpAssocReq(U8 itfType) CmStatus cfm; DuSctpDestCb *paramPtr = NULLP; - if(SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)¶mPtr, (Size)sizeof(DuSctpDestCb)) != ROK) + DU_ALLOC(paramPtr, sizeof(DuSctpDestCb)); + if(paramPtr == NULLP) { printf("\nDU_APP : Failed to allocate memory"); RETVALUE(RFAILED); @@ -401,7 +407,7 @@ S16 duFillSctpPst(Pst *pst, Event event) pst->dstInst = (Inst)SCTP_INST; pst->dstProcId = pst->srcProcId; pst->event = event; - pst->selector = DU_SELECTOR_LC; + pst->selector = ODU_SELECTOR_LC; pst->pool= DU_POOL; SPstTsk(pst, mBuf); @@ -479,7 +485,7 @@ void sendToDuApp(Buffer *mBuf, Event event) pst.dstInst = (Inst)DU_INST; pst.dstProcId = pst.srcProcId; pst.event = event; - pst.selector = DU_SELECTOR_LC; + pst.selector = ODU_SELECTOR_LC; pst.pool= DU_POOL; pst.region = DFLT_REGION; @@ -505,7 +511,7 @@ void sendToDuApp(Buffer *mBuf, Event event) * RFAILED - failure * * ****************************************************************/ -S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy) +S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy, U8 *itfState) { Pst pst; @@ -517,23 +523,23 @@ S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy) { case CM_INET_SCTP_COMM_UP: DU_LOG("Event : COMMUNICATION UP"); - connUp = TRUE; + *itfState = DU_SCTP_UP; break; case CM_INET_SCTP_COMM_LOST: DU_LOG("Event : COMMUNICATION LOST"); - connUp = FALSE; + *itfState = DU_SCTP_DOWN; break; case CM_INET_SCTP_RESTART: DU_LOG("Event : SCTP RESTART"); - connUp = FALSE; + *itfState = DU_SCTP_DOWN; break; case CM_INET_SCTP_SHUTDOWN_COMP: /* association gracefully shutdown */ DU_LOG("Event : SHUTDOWN COMPLETE"); - connUp = FALSE; + *itfState = DU_SCTP_DOWN; break; case CM_INET_SCTP_CANT_STR_ASSOC: DU_LOG("Event : CANT START ASSOC"); - connUp = FALSE; + *itfState = DU_SCTP_DOWN; break; default: DU_LOG("\nInvalid event"); @@ -552,7 +558,7 @@ S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy) break; case CM_INET_SCTP_SHUTDOWN_EVENT : /* peer socket gracefully closed */ DU_LOG("\nSCTP : Shutdown Event notification received\n"); - connUp = FALSE; + *itfState = DU_SCTP_DOWN; exit(0); break; case CM_INET_SCTP_ADAPTATION_INDICATION : @@ -576,10 +582,10 @@ S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy) pst.dstEnt = (Ent)ENTDUAPP; pst.dstInst = (Inst)DU_INST; pst.dstProcId = pst.srcProcId; - pst.event = EVTSCTPNTFY; - pst.selector = DU_SELECTOR_LC; + pst.event = EVENT_SCTP_NTFY; + pst.selector = ODU_SELECTOR_LC; pst.pool= DU_POOL; - pst.region = DFLT_REGION; + pst.region = DU_APP_MEM_REGION; if(cmPkSctpNtfy(&pst, ntfy) != ROK) { @@ -616,13 +622,13 @@ S16 processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, U32 *timeou { U16 ret = ROK; CM_INET_FD_SET(sockFd, &pollParams->readFd); - ret = cmInetSelect(&pollParams->readFd, NULLP, timeoutPtr, &pollParams->numFds); + ret = cmInetSelect(&pollParams->readFd, NULLP, timeoutPtr, &pollParams->numFd); if(CM_INET_FD_ISSET(sockFd, &pollParams->readFd)) { CM_INET_FD_CLR(sockFd, &pollParams->readFd); ret = cmInetSctpRecvMsg(sockFd, &pollParams->addr, &pollParams->port, memInfo, &(pollParams->mBuf), &pollParams->bufLen, &pollParams->info, &pollParams->flag, &pollParams->ntfy); - if(connUp && ret != ROK) + if(ret != ROK) { DU_LOG("\n SCTP: Failed to receive sctp msg for sockFd[%d]\n", sockFd->fd); recvMsgSet = RFAILED; @@ -635,29 +641,31 @@ S16 processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, U32 *timeou { f1Params.assocId = pollParams->ntfy.u.assocChange.assocId; DU_LOG("\nSCTP : AssocId assigned to F1Params from PollParams [%d]\n", f1Params.assocId); + ret = sctpNtfyHdlr(&pollParams->ntfy, &f1Params.itfState); } else if(pollParams->port == ricParams.destPort) { ricParams.assocId = pollParams->ntfy.u.assocChange.assocId; DU_LOG("\nSCTP : AssocId assigned to ricParams from PollParams [%d]\n", ricParams.assocId); + ret = sctpNtfyHdlr(&pollParams->ntfy, &ricParams.itfState); } else { DU_LOG("\nSCTP : Failed to fill AssocId\n"); - } - ret = sctpNtfyHdlr(&pollParams->ntfy); + RETVALUE(RFAILED); + } if(ret != ROK) { DU_LOG("\nSCTP : Failed to process sctp notify msg\n"); } } - else if(connUp & (pollParams->port == f1Params.destPort)) + else if(f1Params.itfState & (pollParams->port == f1Params.destPort)) { - sendToDuApp(pollParams->mBuf, EVTSCTPDATA); + sendToDuApp(pollParams->mBuf, EVENT_CU_DATA); } - else if(connUp & (pollParams->port == ricParams.destPort)) + else if(ricParams.itfState & (pollParams->port == ricParams.destPort)) { - sendToDuApp(pollParams->mBuf, EVTRICDATA); + sendToDuApp(pollParams->mBuf, EVENT_RIC_DATA); } else