1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
18 /* File : du_mgr_msg_router.c */
19 /* This file contains message handling functionality for DU APP */
20 #include "common_def.h"
30 #include "du_app_mac_inf.h"
31 #include "du_app_rlc_inf.h"
37 #include "du_f1ap_msg_hdl.h"
38 #include "du_e2ap_msg_hdl.h"
39 #include "du_app_mac_inf.h"
40 #include "du_ue_mgr.h"
43 uint8_t unpackRlcConfigCfm(RlcConfigCfm func,Pst *pst, Buffer *mBuf);
44 uint8_t cmUnpkLkwCntrlCfm(LkwCntrlCfm func,Pst *pst, Buffer *mBuf);
45 uint8_t cmUnpkLrgCfgCfm(LrgCfgCfm func,Pst *pst, Buffer *mBuf);
46 uint8_t cmUnpkKwuDatInd(KwuDatInd func,Pst *pst, Buffer *mBuf);
47 uint8_t cmUnpkLrgSchCfgCfm(LrgSchCfgCfm func,Pst *pst,Buffer *mBuf);
48 /**************************************************************************
49 * @brief Task Initiation callback function.
53 * Function : duActvInit
56 * This function is supplied as one of parameters during DU APP's
57 * task registration. SSI will invoke this function once, after
58 * it creates and attaches this TAPA Task to a system task.
60 * @param[in] Ent entity, the entity ID of this task.
61 * @param[in] Inst inst, the instance ID of this task.
62 * @param[in] Region region, the region ID registered for memory
64 * @param[in] Reason reason.
65 * @return ROK - success
67 ***************************************************************************/
68 uint8_t duActvInit(Ent entity, Inst inst, Region region, Reason reason)
72 memset(&duCb, 0, sizeof(DuCb));
74 duCb.init.procId = ODU_GET_PROCID();
75 duCb.init.ent = entity;
76 duCb.init.inst = inst;
77 duCb.init.region = region;
78 duCb.init.reason = reason;
79 duCb.init.cfgDone = FALSE;
80 duCb.init.pool = DU_POOL;
81 duCb.init.acnt = FALSE;
82 duCb.init.trc = FALSE;
83 duCb.init.usta = TRUE;
84 duCb.mem.region = DFLT_REGION;
85 duCb.mem.pool = DU_POOL;
87 duCb.f1Status = FALSE;
88 duCb.e2Status = FALSE;
90 for(id = 0; id < MAX_NUM_CELL; id ++)
92 duCb.cfgCellLst[id] = NULL;
93 duCb.actvCellLst[id] = NULL;
96 memset(duCb.ueCcchCtxt, 0, MAX_NUM_UE * sizeof(UeCcchCtxt));
98 duCb.numActvCells = 0;
99 cmLListInit(&duCb.reservedF1apPduList);
100 ODU_SET_PROC_ID(DU_PROC);
106 /**************************************************************************
107 * @brief Function prints the src dest and msg reached to egtp.
111 * Function : callFlowduActvTsk
114 * Function prints the src dest and msg reached to egtp.
116 * @param[in] Pst *pst, Post structure of the primitive.
120 +***************************************************************************/
122 void callFlowduActvTsk(Pst *pst)
125 char destTask[50]="ENTDUAPP";
132 strcpy(sourceTask,"ENTDUAPP");
137 strcpy(message,"EVTCFG");
142 strcpy(message,"Invalid Event");
151 strcpy(sourceTask,"ENTRLC");
154 case LKW_EVT_CFG_CFM:
156 strcpy(message,"LKW_EVT_CFG_CFM");
159 case LKW_EVT_CNTRL_CFM:
161 strcpy(message,"LKW_EVT_CNTRL_CFM");
164 case LKW_EVT_STA_IND:
166 strcpy(message,"LKW_EVT_STA_IND");
169 case EVENT_RLC_UE_CREATE_RSP:
171 strcpy(message,"EVENT_RLC_UE_CREATE_RSP");
174 case EVENT_RLC_UE_RECONFIG_RSP:
176 strcpy(message,"EVENT_RLC_UE_RECONFIG_RSP");
179 case EVENT_RLC_UE_DELETE_RSP:
181 strcpy(message,"EVENT_RLC_UE_DELETE_RSP");
184 case EVENT_UL_RRC_MSG_TRANS_TO_DU:
186 strcpy(message,"EVENT_UL_RRC_MSG_TRANS_TO_DU");
189 case EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU:
191 strcpy(message,"EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU");
194 case EVENT_DL_RRC_MSG_RSP_TO_DU:
196 strcpy(message,"EVENT_DL_RRC_MSG_RSP_TO_DU");
199 case EVENT_UL_USER_DATA_TRANS_TO_DU:
201 strcpy(message,"EVENT_UL_USER_DATA_TRANS_TO_DU");
206 strcpy(message,"Invalid Event");
213 strcpy(sourceTask,"ENTMAC");
218 strcpy(message,"EVTCFG");
223 strcpy(message,"EVTLRGCFGCFM");
228 strcpy(message,"EVTLRGCNTRLCFM");
231 case EVTMACSCHGENCFGCFM:
233 strcpy(message,"EVTMACSCHGENCFGCFM");
236 case EVENT_MAC_CELL_CONFIG_CFM:
238 strcpy(message,"EVENT_MAC_CELL_CONFIG_CFM");
241 case EVENT_MAC_CELL_UP_IND:
243 strcpy(message,"EVENT_MAC_CELL_UP_IND");
246 case EVENT_MAC_STOP_IND:
248 strcpy(message,"EVENT_MAC_STOP_IND");
251 case EVENT_MAC_UL_CCCH_IND:
253 strcpy(message,"EVENT_MAC_UL_CCCH_IND");
256 case EVENT_MAC_UE_CREATE_RSP:
258 strcpy(message,"EVENT_MAC_UE_CREATE_RSP");
261 case EVENT_MAC_UE_RECONFIG_RSP:
263 strcpy(message,"EVENT_MAC_UE_RECONFIG_RSP");
266 case EVENT_MAC_UE_DELETE_RSP:
268 strcpy(message,"EVENT_MAC_UE_DELETE_RSP");
271 case EVENT_MAC_CELL_DELETE_RSP:
273 strcpy(message,"EVENT_MAC_CELL_DELETE_RSP");
278 strcpy(message,"Invalid Event");
287 strcpy(sourceTask,"ENTSCTP");
292 strcpy(message,"EVENT_CU_DATA");
295 case EVENT_SCTP_NTFY:
297 strcpy(message,"EVENT_SCTP_NTFY");
302 strcpy(message,"EVENT_RIC_DATA");
307 strcpy(message,"Invalid Event");
316 strcpy(sourceTask,"ENTEGTP");
321 strcpy(message,"EVTCFGCFM");
326 strcpy(message,"EVTSRVOPENCFM");
331 strcpy(message,"EVTTNLMGMTCFM");
336 strcpy(message,"Invalid Event");
344 strcpy(sourceTask,"Invalid Source Entity Id");
348 DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
350 /**************************************************************************
351 * @brief Task Activation callback function.
355 * Function : duActvTsk
358 * Primitives invoked by DU APP's users/providers through
359 * a loosely coupled interface arrive here by means of
360 * SSI's message handling. This API is registered with
361 * SSI during the Task Registration of DU APP.
363 * @param[in] Pst *pst, Post structure of the primitive.
364 * @param[in] Buffer *mBuf, Packed primitive parameters in the
366 * @return ROK - success
369 ***************************************************************************/
370 uint8_t duActvTsk(Pst *pst, Buffer *mBuf)
374 #ifdef CALL_FLOW_DEBUG_LOG
375 callFlowduActvTsk(pst);
386 DU_LOG("\n****** Received initial configs at DU APP ******\n");
388 ODU_PUT_MSG_BUF(mBuf);
393 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTDUAPP");
394 ODU_PUT_MSG_BUF(mBuf);
405 case LKW_EVT_CFG_CFM:
407 ret = unpackRlcConfigCfm(DuHdlRlcCfgComplete, pst, mBuf);
410 case LKW_EVT_CNTRL_CFM:
412 ret = cmUnpkLkwCntrlCfm(duHdlRlcCntrlCfgComplete, pst, mBuf);
415 case LKW_EVT_STA_IND:
419 case EVENT_RLC_UE_CREATE_RSP:
421 ret = unpackRlcUeCfgRsp(DuProcRlcUeCfgRsp, pst, mBuf);
424 case EVENT_RLC_UE_RECONFIG_RSP:
426 ret = unpackRlcUeCfgRsp(DuProcRlcUeCfgRsp, pst, mBuf);
429 case EVENT_RLC_UE_DELETE_RSP:
431 ret = unpackRlcUeDeleteRsp(DuProcRlcUeDeleteRsp, pst, mBuf);
434 case EVENT_UL_RRC_MSG_TRANS_TO_DU:
436 ret = unpackRlcUlRrcMsgToDu(DuProcRlcUlRrcMsgTrans, pst, mBuf);
439 case EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU:
441 ret = unpackRrcDeliveryReportToDu(DuProcRlcRrcDeliveryReport, pst, mBuf);
444 case EVENT_DL_RRC_MSG_RSP_TO_DU:
446 ret = unpackRlcDlRrcMsgRspToDu(DuProcRlcDlRrcMsgRsp, pst, mBuf);
449 case EVENT_UL_USER_DATA_TRANS_TO_DU:
451 ret = unpackRlcUlUserDataToDu(DuProcRlcUlUserDataTrans, pst, mBuf);
456 DU_LOG("\nERROR --> DU_APP : Invalid event %d received at duActvTsk from ENTRLC", \
458 ODU_PUT_MSG_BUF(mBuf);
471 ODU_PUT_MSG_BUF(mBuf);
476 ret = cmUnpkLrgCfgCfm(duHdlMacCfgComplete, pst, mBuf);
483 case EVTMACSCHGENCFGCFM:
485 ret = cmUnpkLrgSchCfgCfm(duHdlSchCfgComplete, pst, mBuf);
488 case EVENT_MAC_CELL_CONFIG_CFM:
490 ret = unpackMacCellCfgCfm(duHandleMacCellCfgCfm, pst, mBuf);
493 case EVENT_MAC_CELL_UP_IND:
495 ret = unpackMacCellUpInd(duHandleCellUpInd, pst, mBuf);
498 case EVENT_MAC_STOP_IND:
500 ret = unpackMacStopInd(duHandleStopInd, pst, mBuf);
503 case EVENT_MAC_UL_CCCH_IND:
505 ret = unpackMacUlCcchInd(duHandleUlCcchInd, pst, mBuf);
508 case EVENT_MAC_UE_CREATE_RSP:
510 ret = unpackDuMacUeCfgRsp(DuProcMacUeCfgRsp, pst, mBuf);
513 case EVENT_MAC_UE_RECONFIG_RSP:
515 ret = unpackDuMacUeCfgRsp(DuProcMacUeCfgRsp, pst, mBuf);
518 case EVENT_MAC_UE_DELETE_RSP:
520 ret = unpackDuMacUeDeleteRsp(DuProcMacUeDeleteRsp, pst, mBuf);
523 case EVENT_MAC_CELL_DELETE_RSP:
525 ret = unpackDuMacCellDeleteRsp(DuProcMacCellDeleteRsp, pst, mBuf);
530 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTMAC");
531 ODU_PUT_MSG_BUF(mBuf);
547 case EVENT_SCTP_NTFY:
549 ret = cmUnpkSctpNtfy(duSctpNtfyHdl, pst, mBuf);
559 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTSCTP");
564 ODU_PUT_MSG_BUF(mBuf);
573 unpackEgtpCfgCfm(duHdlEgtpCfgComplete, mBuf);
578 unpackEgtpSrvOpenCfm(duHdlEgtpSrvOpenComplete, mBuf);
583 unpackEgtpTnlMgmtCfm(duHdlEgtpTnlMgmtCfm, mBuf);
588 DU_LOG("\nERROR --> DU_APP : Invalid event[%d] received at duActvTsk from ENTEGTP", pst->event);
592 ODU_PUT_MSG_BUF(mBuf);
597 DU_LOG("\nERROR --> DU_APP : DU APP can not process message from Entity %d", pst->srcEnt);
598 ODU_PUT_MSG_BUF(mBuf);
607 /**********************************************************************
609 **********************************************************************/