X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fcu_stub%2Fcu_stub_sctp.c;h=c74290a22b4a31fcfc98cc80f97ffb2255bf09ec;hb=2a743dfffc577ac90819776af7e0d86cb00fca57;hp=66ec535af1f35f24bf18eb5cbb61c576754c6c81;hpb=6eda577056855df28788aef28ee0a29c9128d1f5;p=o-du%2Fl2.git diff --git a/src/cu_stub/cu_stub_sctp.c b/src/cu_stub/cu_stub_sctp.c index 66ec535af..c74290a22 100644 --- a/src/cu_stub/cu_stub_sctp.c +++ b/src/cu_stub/cu_stub_sctp.c @@ -55,7 +55,7 @@ uint8_t sctpActvInit() { DU_LOG("\n\nDEBUG --> SCTP : Initializing"); memset(&sctpCb, 0, sizeof(SctpGlobalCb)); - sctpCb.sctpCfg = cuCfgParams.sctpParams; + sctpCb.sctpCfg = cuCb.cuCfgParams.sctpParams; return ROK; } @@ -420,8 +420,6 @@ uint8_t sctpSockPoll() memset(&f1PollParams, 0, sizeof(sctpSockPollParams)); - egtpFromAddr.port = egtpCb.dstCb.dstPort; - egtpFromAddr.address = egtpCb.dstCb.dstIp; /* All sockets are non-blocking */ timeout = 0; @@ -443,15 +441,21 @@ uint8_t sctpSockPoll() } /* Receiving EGTP data */ - egtpBufLen = -1; - ret = cmInetRecvMsg(&(egtpCb.recvTptSrvr.sockFd), &egtpFromAddr, &memInfo, &egtpBuf, &egtpBufLen, CM_INET_NO_FLAG); - if(ret == ROK && egtpBuf != NULLP) + for(destIdx = 0; destIdx < egtpCb.numDu; destIdx++) { - DU_LOG("\nINFO --> EGTP : Received UL Message [%ld]\n", numMsgRcvd+1); - numMsgRcvd++; - //ODU_PRINT_MSG(egtpBuf, 0 ,0); - cuEgtpHdlRecvMsg(egtpBuf); + + egtpFromAddr.port = egtpCb.dstCb[destIdx].dstPort; + egtpFromAddr.address = egtpCb.dstCb[destIdx].dstIp; + egtpBufLen = -1; + ret = cmInetRecvMsg(&(egtpCb.recvTptSrvr.sockFd), &egtpFromAddr, &memInfo, &egtpBuf, &egtpBufLen, CM_INET_NO_FLAG); + if(ret == ROK && egtpBuf != NULLP) + { + DU_LOG("\nINFO --> EGTP : Received UL Message [%ld] from DUid %d\n", numMsgRcvd+1, egtpCb.dstCb[destIdx].duId); + numMsgRcvd++; + //ODU_PRINT_MSG(egtpBuf, 0 ,0); + cuEgtpHdlRecvMsg(egtpBuf); + } } }; return (ret); @@ -506,7 +510,7 @@ uint8_t processPolling(sctpSockPollParams *pollParams, CuSctpDestCb *destCb, uin } else if(destCb->connUp & (pollParams->port == destCb->destPort)) { - F1APMsgHdlr(pollParams->mBuf); + F1APMsgHdlr(&destCb->duId, pollParams->mBuf); ODU_PUT_MSG_BUF(pollParams->mBuf); } else @@ -534,9 +538,9 @@ uint8_t processPolling(sctpSockPollParams *pollParams, CuSctpDestCb *destCb, uin * RFAILED - failure * * ****************************************************************/ -uint8_t sctpSend(Buffer *mBuf) +uint8_t sctpSend(uint32_t duId, Buffer *mBuf) { - uint8_t ret = ROK; + uint8_t ret = ROK, destIdx = 0; MsgLen len = 0; /* number of actually sent octets */ CmInetMemInfo memInfo; @@ -544,16 +548,23 @@ uint8_t sctpSend(Buffer *mBuf) memInfo.region = CU_APP_MEM_REG; memInfo.pool = CU_POOL; - ret = cmInetSctpSendMsg(&sctpCb.destCb[0].sockFd, &sctpCb.destCb[0].destIpNetAddr, sctpCb.destCb[0].destPort, &memInfo,\ - mBuf, &len, 0, FALSE, 0, 0/*SCT_PROTID_NONE*/, RWOULDBLOCK); - - if(ret != ROK && ret != RWOULDBLOCK) + for(destIdx=0; destIdx < sctpCb.numDu; destIdx++) { - DU_LOG("\nERROR --> SCTP : Send message failed"); - return RFAILED; - } + if(sctpCb.destCb[destIdx].duId == duId) + { + ret = cmInetSctpSendMsg(&sctpCb.destCb[destIdx].sockFd, &sctpCb.destCb[destIdx].destIpNetAddr, \ + sctpCb.destCb[destIdx].destPort, &memInfo, mBuf, &len, 0, FALSE, 0, 0/*SCT_PROTID_NONE*/, RWOULDBLOCK); - return ROK; + if(ret != ROK && ret != RWOULDBLOCK) + { + DU_LOG("\nERROR --> SCTP : Send message failed"); + return RFAILED; + } + return ROK; + } + } + DU_LOG("\nERROR --> SCTP : DU ID [%d] not found in SCTP DestCb list. Failed to send message", duId); + return RFAILED; } /* End of sctpSend */ /**********************************************************************