X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_sctp.c;h=efee2915db960ca44e68307d8aec3170f70cd89a;hb=0c4403cc2355cc38d01c6645b1dad36dd4c1daa7;hp=a1ba4066ab62c26f334f7298a48b9b95c04f8be6;hpb=75a90d3abafa8edf6c85aa28319f6ec93efde6b3;p=o-du%2Fl2.git diff --git a/src/du_app/du_sctp.c b/src/du_app/du_sctp.c index a1ba4066a..efee2915d 100644 --- a/src/du_app/du_sctp.c +++ b/src/du_app/du_sctp.c @@ -18,6 +18,7 @@ /* This file contains all SCTP related functionality */ #include "common_def.h" +#include "du_tmr.h" #include "lrg.h" #include "legtp.h" #include "lrg.x" @@ -25,9 +26,12 @@ #include "cm_inet.h" #include "cm_inet.x" #include "du_app_mac_inf.h" +#include "du_e2ap_mgr.h" #include "du_cfg.h" #include "du_sctp.h" #include "lsctp.h" +#include "du_app_rlc_inf.h" +#include "du_mgr.h" #include "du_utils.h" /************************************************************************** @@ -55,13 +59,54 @@ uint8_t sctpActvInit(Ent entity, Inst inst, Region region, Reason reason) DU_LOG("\n\nDEBUG --> SCTP : Initializing"); ODU_SET_PROC_ID(DU_PROC); connUp = FALSE; + + memset(&f1Params, 0, sizeof(DuSctpDestCb)); f1Params.assocId = -1; + memset(&ricParams, 0, sizeof(DuSctpDestCb)); ricParams.assocId = -1; nonblocking = FALSE; return ROK; } +/************************************************************************** +* @brief Function prints src, dest, msg infor about all the msgs that received. +* +* @details +* +* Function : callFlowSctpActvTsk +* +* Function prints src, dest, msg infor about all the msgs that received +* +* @param[in] Pst *pst, Post structure of the primitive. +* +* @return void +***************************************************************************/ +void callFlowSctpActvTsk(Pst *pst) +{ + char sourceTask[50]; + char destTask[50]="ENTSCTP"; + char message[100]; + + switch(pst->srcEnt) + { + case ENTDUAPP: + { + strcpy(sourceTask,"ENTDUAPP"); + switch(pst->event) + { + case EVTSTARTPOLL: + { + strcpy(message,"EVTSTARTPOLL"); + break; + } + } + break; + } + } + DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message); +} + /************************************************************************** * @brief Task Activation callback function. * @@ -83,6 +128,12 @@ uint8_t sctpActvInit(Ent entity, Inst inst, Region region, Reason reason) ***************************************************************************/ uint8_t sctpActvTsk(Pst *pst, Buffer *mBuf) { + +#ifdef CALL_FLOW_DEBUG_LOG + callFlowSctpActvTsk(pst); +#endif + + switch(pst->srcEnt) { case ENTDUAPP: @@ -152,6 +203,9 @@ uint8_t duSctpCfgReq(SctpParams sctpCfg) uint8_t ret = ROK; CmStatus cfm; +#ifdef CALL_FLOW_DEBUG_LOG + DU_LOG("\nCall Flow: ENTDUAPP -> ENTSCTP : EVENT_CFG_REQ_TO_SCTP\n"); +#endif /* Fill F1 Params */ f1Params.destIpAddr.ipV4Pres = sctpCfg.cuIpAddr.ipV4Pres; f1Params.destIpAddr.ipV4Addr = sctpCfg.cuIpAddr.ipV4Addr; @@ -336,6 +390,10 @@ uint8_t duSctpAssocReq(uint8_t itfType) CmStatus cfm; DuSctpDestCb *paramPtr = NULLP; +#ifdef CALL_FLOW_DEBUG_LOG + DU_LOG("\nCall Flow: ENTDUAPP -> ENTSCTP : EVENT_ASSOC_REQ_TO_SCTP\n"); +#endif + DU_ALLOC(paramPtr, sizeof(DuSctpDestCb)); if(paramPtr == NULLP) { @@ -513,7 +571,7 @@ void sendToDuApp(Buffer *mBuf, Event event) * RFAILED - failure * * ****************************************************************/ -uint8_t sctpNtfyHdlr(CmInetSctpNotification *ntfy, uint8_t *itfState) +uint8_t sctpNtfyHdlr(CmInetSctpNotification *ntfy, uint8_t *itfState, uint8_t interface) { Pst pst; @@ -559,10 +617,21 @@ uint8_t sctpNtfyHdlr(CmInetSctpNotification *ntfy, uint8_t *itfState) DU_LOG("\nINFO --> SCTP : Send Failed notification received\n"); break; case CM_INET_SCTP_SHUTDOWN_EVENT : /* peer socket gracefully closed */ - DU_LOG("\nINFO --> SCTP : Shutdown Event notification received\n"); - *itfState = DU_SCTP_DOWN; - exit(0); - break; + { + DU_LOG("\nINFO --> SCTP : Shutdown Event notification received\n"); + *itfState = DU_SCTP_DOWN; + switch(interface) + { + case F1_INTERFACE: + break; + case E2_INTERFACE: + removeE2NodeInformation(); + break; + default: + exit(0); + } + break; + } case CM_INET_SCTP_ADAPTATION_INDICATION : DU_LOG("\nINFO --> SCTP : Adaptation Indication received\n"); break; @@ -637,19 +706,25 @@ uint8_t processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, uint32 } else { +#ifdef CALL_FLOW_DEBUG_LOG + if(pollParams->port == f1Params.destPort) + DU_LOG("\nCall Flow: CU -> ENTSCTP : EVENT_SCTP_MSG\n"); + else + DU_LOG("\nCall Flow: RIC -> ENTSCTP : EVENT_SCTP_MSG\n"); +#endif if((((pollParams->flag & CM_INET_SCTP_MSG_NOTIFICATION) != 0)) && ret == ROK) { if(pollParams->port == f1Params.destPort) { f1Params.assocId = pollParams->ntfy.u.assocChange.assocId; DU_LOG("\nDEBUG --> SCTP : AssocId assigned to F1Params from PollParams [%d]\n", f1Params.assocId); - ret = sctpNtfyHdlr(&pollParams->ntfy, &f1Params.itfState); + ret = sctpNtfyHdlr(&pollParams->ntfy, &f1Params.itfState, F1_INTERFACE); } else if(pollParams->port == ricParams.destPort) { ricParams.assocId = pollParams->ntfy.u.assocChange.assocId; DU_LOG("\nDEBUG --> SCTP : AssocId assigned to ricParams from PollParams [%d]\n", ricParams.assocId); - ret = sctpNtfyHdlr(&pollParams->ntfy, &ricParams.itfState); + ret = sctpNtfyHdlr(&pollParams->ntfy, &ricParams.itfState, E2_INTERFACE); } else { @@ -767,16 +842,33 @@ uint8_t sctpSend(Buffer *mBuf, uint8_t itfType) memInfo.region = DU_APP_MEM_REGION; memInfo.pool = DU_POOL; + +#ifdef CALL_FLOW_DEBUG_LOG + if(itfType == F1_INTERFACE) + { + DU_LOG("\nCall Flow: ENTDUAPP -> ENTSCTP : EVENT_F1AP_MSG_TO_SCTP\n"); + } + else + { + DU_LOG("\nCall Flow: ENTDUAPP -> ENTSCTP : EVENT_E2AP_MSG_TO_SCTP\n"); + } +#endif if(itfType == F1_INTERFACE) { - DU_LOG("\nDEBUG --> SCTP : sending the message to DuApp"); + DU_LOG("\nDEBUG --> SCTP : sending the message to CU"); +#ifdef CALL_FLOW_DEBUG_LOG + DU_LOG("\nCall Flow: ENTSCTP -> CU : EVENT_F1AP_MSG_TO_CU\n"); +#endif ret = cmInetSctpSendMsg(&f1Params.sockFd, &f1Params.destIpNetAddr, f1Params.destPort, &memInfo, mBuf, &len, 0, FALSE, 0, 0/*SCT_PROTID_NONE*/, RWOULDBLOCK); } if(itfType == E2_INTERFACE) { - DU_LOG("\nDEBUG --> SCTP : sending the message to ric"); + DU_LOG("\nDEBUG --> SCTP : sending the message to ric"); +#ifdef CALL_FLOW_DEBUG_LOG + DU_LOG("\nCall Flow: ENTSCTP -> RIC : EVENT_E2AP_MSG_TO_RIC\n"); +#endif ret = cmInetSctpSendMsg(&ricParams.sockFd, &ricParams.destIpNetAddr, ricParams.destPort, &memInfo, mBuf, &len, 0, FALSE, 0, 0/*SCT_PROTID_NONE*/, RWOULDBLOCK); }