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"
31 #include "du_app_mac_inf.h"
32 #include "du_app_rlc_inf.h"
33 #include "du_e2ap_mgr.h"
34 #include "du_e2ap_msg_hdl.h"
40 #include "du_f1ap_msg_hdl.h"
41 #include "du_app_mac_inf.h"
42 #include "du_ue_mgr.h"
45 uint8_t unpackRlcConfigCfm(RlcConfigCfm func,Pst *pst, Buffer *mBuf);
46 uint8_t cmUnpkLkwCntrlCfm(LkwCntrlCfm func,Pst *pst, Buffer *mBuf);
47 uint8_t cmUnpkLrgCfgCfm(LrgCfgCfm func,Pst *pst, Buffer *mBuf);
48 uint8_t cmUnpkKwuDatInd(KwuDatInd func,Pst *pst, Buffer *mBuf);
49 uint8_t cmUnpkLrgSchCfgCfm(LrgSchCfgCfm func,Pst *pst,Buffer *mBuf);
50 /**************************************************************************
51 * @brief Task Initiation callback function.
55 * Function : duActvInit
58 * This function is supplied as one of parameters during DU APP's
59 * task registration. SSI will invoke this function once, after
60 * it creates and attaches this TAPA Task to a system task.
62 * @param[in] Ent entity, the entity ID of this task.
63 * @param[in] Inst inst, the instance ID of this task.
64 * @param[in] Region region, the region ID registered for memory
66 * @param[in] Reason reason.
67 * @return ROK - success
69 ***************************************************************************/
70 uint8_t duActvInit(Ent entity, Inst inst, Region region, Reason reason)
74 memset(&duCb, 0, sizeof(DuCb));
76 duCb.init.procId = ODU_GET_PROCID();
77 duCb.init.ent = entity;
78 duCb.init.inst = inst;
79 duCb.init.region = region;
80 duCb.init.reason = reason;
81 duCb.init.cfgDone = FALSE;
82 duCb.init.pool = DU_POOL;
83 duCb.init.acnt = FALSE;
84 duCb.init.trc = FALSE;
85 duCb.init.usta = TRUE;
86 duCb.mem.region = DFLT_REGION;
87 duCb.mem.pool = DU_POOL;
89 duCb.f1Status = FALSE;
90 duCb.e2Status = FALSE;
92 for(id = 0; id < MAX_NUM_CELL; id ++)
94 duCb.cfgCellLst[id] = NULL;
95 duCb.actvCellLst[id] = NULL;
98 memset(duCb.ueCcchCtxt, 0, MAX_NUM_UE * sizeof(UeCcchCtxt));
100 duCb.numActvCells = 0;
101 duCb.gnbDuUeF1apIdGenerator = 0;
102 cmLListInit(&duCb.reservedF1apPduList);
103 ODU_SET_PROC_ID(DU_PROC);
109 #ifdef CALL_FLOW_DEBUG_LOG
110 /**************************************************************************
111 * @brief Function prints the src dest and msg reached to egtp.
115 * Function : callFlowduActvTsk
118 * Function prints the src dest and msg reached to egtp.
120 * @param[in] Pst *pst, Post structure of the primitive.
124 +***************************************************************************/
126 void callFlowduActvTsk(Pst *pst)
129 char destTask[50]="ENTDUAPP";
136 strcpy(sourceTask,"ENTDUAPP");
141 strcpy(message,"EVTCFG");
146 strcpy(message,"Invalid Event");
155 strcpy(sourceTask,"ENTRLC");
158 case LKW_EVT_CFG_CFM:
160 strcpy(message,"LKW_EVT_CFG_CFM");
163 case LKW_EVT_CNTRL_CFM:
165 strcpy(message,"LKW_EVT_CNTRL_CFM");
168 case LKW_EVT_STA_IND:
170 strcpy(message,"LKW_EVT_STA_IND");
173 case EVENT_RLC_UE_CREATE_RSP:
175 strcpy(message,"EVENT_RLC_UE_CREATE_RSP");
178 case EVENT_RLC_UE_RECONFIG_RSP:
180 strcpy(message,"EVENT_RLC_UE_RECONFIG_RSP");
183 case EVENT_RLC_UE_DELETE_RSP:
185 strcpy(message,"EVENT_RLC_UE_DELETE_RSP");
188 case EVENT_UL_RRC_MSG_TRANS_TO_DU:
190 strcpy(message,"EVENT_UL_RRC_MSG_TRANS_TO_DU");
193 case EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU:
195 strcpy(message,"EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU");
198 case EVENT_DL_RRC_MSG_RSP_TO_DU:
200 strcpy(message,"EVENT_DL_RRC_MSG_RSP_TO_DU");
203 case EVENT_UL_USER_DATA_TRANS_TO_DU:
205 strcpy(message,"EVENT_UL_USER_DATA_TRANS_TO_DU");
210 strcpy(message,"Invalid Event");
217 strcpy(sourceTask,"ENTMAC");
222 strcpy(message,"EVTCFG");
227 strcpy(message,"EVTLRGCFGCFM");
230 case EVTMACSCHGENCFGCFM:
232 strcpy(message,"EVTMACSCHGENCFGCFM");
235 case EVENT_MAC_CELL_CONFIG_CFM:
237 strcpy(message,"EVENT_MAC_CELL_CONFIG_CFM");
240 case EVENT_MAC_CELL_UP_IND:
242 strcpy(message,"EVENT_MAC_CELL_UP_IND");
245 case EVENT_MAC_SLOT_IND:
247 strcpy(message,"EVENT_MAC_SLOT_IND");
250 case EVENT_MAC_STOP_IND:
252 strcpy(message,"EVENT_MAC_STOP_IND");
255 case EVENT_MAC_UL_CCCH_IND:
257 strcpy(message,"EVENT_MAC_UL_CCCH_IND");
260 case EVENT_MAC_UE_CREATE_RSP:
262 strcpy(message,"EVENT_MAC_UE_CREATE_RSP");
265 case EVENT_MAC_UE_RECONFIG_RSP:
267 strcpy(message,"EVENT_MAC_UE_RECONFIG_RSP");
270 case EVENT_MAC_UE_DELETE_RSP:
272 strcpy(message,"EVENT_MAC_UE_DELETE_RSP");
275 case EVENT_MAC_CELL_DELETE_RSP:
277 strcpy(message,"EVENT_MAC_CELL_DELETE_RSP");
280 case EVENT_MAC_SLICE_CFG_RSP:
282 strcpy(message,"EVENT_MAC_SLICE_CFG_RSP");
285 case EVENT_MAC_SLICE_RECFG_RSP:
287 strcpy(message,"EVENT_MAC_SLICE_RECFG_RSP");
290 case EVENT_MAC_STATISTICS_RSP:
292 strcpy(message,"EVENT_MAC_STATISTICS_RSP");
297 strcpy(message,"Invalid Event");
306 strcpy(sourceTask,"ENTSCTP");
311 strcpy(message,"EVENT_CU_DATA");
314 case EVENT_SCTP_NTFY:
316 strcpy(message,"EVENT_SCTP_NTFY");
321 strcpy(message,"EVENT_RIC_DATA");
326 strcpy(message,"Invalid Event");
335 strcpy(sourceTask,"ENTEGTP");
340 strcpy(message,"EVTCFGCFM");
345 strcpy(message,"EVTSRVOPENCFM");
350 strcpy(message,"EVTTNLMGMTCFM");
355 strcpy(message,"Invalid Event");
363 strcpy(sourceTask,"Invalid Source Entity Id");
367 DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
371 /**************************************************************************
372 * @brief Task Activation callback function.
376 * Function : duActvTsk
379 * Primitives invoked by DU APP's users/providers through
380 * a loosely coupled interface arrive here by means of
381 * SSI's message handling. This API is registered with
382 * SSI during the Task Registration of DU APP.
384 * @param[in] Pst *pst, Post structure of the primitive.
385 * @param[in] Buffer *mBuf, Packed primitive parameters in the
387 * @return ROK - success
390 ***************************************************************************/
391 uint8_t duActvTsk(Pst *pst, Buffer *mBuf)
395 #ifdef CALL_FLOW_DEBUG_LOG
396 callFlowduActvTsk(pst);
407 DU_LOG("\n****** Received initial configs at DU APP ******\n");
409 ODU_PUT_MSG_BUF(mBuf);
414 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTDUAPP");
415 ODU_PUT_MSG_BUF(mBuf);
426 case LKW_EVT_CFG_CFM:
428 ret = unpackRlcConfigCfm(DuHdlRlcCfgComplete, pst, mBuf);
431 case LKW_EVT_CNTRL_CFM:
433 ret = cmUnpkLkwCntrlCfm(duHdlRlcCntrlCfgComplete, pst, mBuf);
436 case LKW_EVT_STA_IND:
440 case EVENT_RLC_UE_CREATE_RSP:
442 ret = unpackRlcUeCreateRsp(DuProcRlcUeCreateRsp, pst, mBuf);
445 case EVENT_RLC_UE_RECONFIG_RSP:
447 ret = unpackRlcUeReconfigRsp(DuProcRlcUeReconfigRsp, pst, mBuf);
450 case EVENT_RLC_UE_DELETE_RSP:
452 ret = unpackRlcUeDeleteRsp(DuProcRlcUeDeleteRsp, pst, mBuf);
455 case EVENT_UL_RRC_MSG_TRANS_TO_DU:
457 ret = unpackRlcUlRrcMsgToDu(DuProcRlcUlRrcMsgTrans, pst, mBuf);
460 case EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU:
462 ret = unpackRrcDeliveryReportToDu(DuProcRlcRrcDeliveryReport, pst, mBuf);
465 case EVENT_DL_RRC_MSG_RSP_TO_DU:
467 ret = unpackRlcDlRrcMsgRspToDu(DuProcRlcDlRrcMsgRsp, pst, mBuf);
470 case EVENT_RLC_MAX_RETRANSMISSION:
472 ret = unpackRlcMaxRetransInd(DuProcRlcMaxRetransInd, pst, mBuf);
475 case EVENT_UL_USER_DATA_TRANS_TO_DU:
477 ret = unpackRlcUlUserDataToDu(DuProcRlcUlUserDataTrans, pst, mBuf);
480 case EVENT_RLC_SLICE_PM_TO_DU:
482 ret = unpackRlcSlicePm(DuProcRlcSliceMetrics, pst, mBuf);
485 case EVENT_RLC_UE_REESTABLISH_RSP:
487 ret = unpackRlcUeReestablishRsp(DuProcRlcUeReestablishRsp, pst, mBuf);
492 DU_LOG("\nERROR --> DU_APP : Invalid event %d received at duActvTsk from ENTRLC", \
494 ODU_PUT_MSG_BUF(mBuf);
507 ODU_PUT_MSG_BUF(mBuf);
512 ret = cmUnpkLrgCfgCfm(duHdlMacCfgComplete, pst, mBuf);
515 case EVTMACSCHGENCFGCFM:
517 ret = cmUnpkLrgSchCfgCfm(duHdlSchCfgComplete, pst, mBuf);
520 case EVENT_MAC_CELL_CONFIG_CFM:
522 ret = unpackMacCellCfgCfm(duHandleMacCellCfgCfm, pst, mBuf);
525 case EVENT_MAC_CELL_UP_IND:
527 ret = unpackMacCellUpInd(duHandleCellUpInd, pst, mBuf);
530 case EVENT_MAC_SLOT_IND:
532 ret = unpackDuMacSlotInd(duHandleSlotInd, pst, mBuf);
535 case EVENT_MAC_STOP_IND:
537 ret = unpackMacStopInd(duHandleStopInd, pst, mBuf);
540 case EVENT_MAC_UL_CCCH_IND:
542 ret = unpackMacUlCcchInd(duHandleUlCcchInd, pst, mBuf);
545 case EVENT_MAC_UE_CREATE_RSP:
547 ret = unpackDuMacUeCreateRsp(DuProcMacUeCreateRsp, pst, mBuf);
550 case EVENT_MAC_UE_RECONFIG_RSP:
552 ret = unpackDuMacUeRecfgRsp(DuProcMacUeRecfgRsp, pst, mBuf);
555 case EVENT_MAC_UE_DELETE_RSP:
557 ret = unpackDuMacUeDeleteRsp(DuProcMacUeDeleteRsp, pst, mBuf);
560 case EVENT_MAC_CELL_DELETE_RSP:
562 ret = unpackDuMacCellDeleteRsp(DuProcMacCellDeleteRsp, pst, mBuf);
565 case EVENT_MAC_SLICE_CFG_RSP:
567 ret = unpackDuMacSliceCfgRsp(DuProcMacSliceCfgRsp, pst, mBuf);
570 case EVENT_MAC_UE_SYNC_STATUS_IND:
572 ret = unpackDuMacUeSyncStatusInd(DuProcMacUeSyncStatusInd, pst, mBuf);
575 case EVENT_MAC_SLICE_RECFG_RSP:
577 ret = unpackDuMacSliceRecfgRsp(DuProcMacSliceRecfgRsp, pst, mBuf);
580 case EVENT_MAC_RACH_RESOURCE_RSP:
582 ret = unpackDuMacRachRsrcRsp(DuProcMacRachRsrcRsp, pst, mBuf);
585 case EVENT_MAC_UE_RESET_RSP:
587 ret = unpackDuMacUeResetRsp(DuProcMacUeResetRsp, pst, mBuf);
590 case EVENT_MAC_STATISTICS_RSP:
592 ret = unpackDuMacStatsRsp(DuProcMacStatsRsp, pst, mBuf);
597 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTMAC");
598 ODU_PUT_MSG_BUF(mBuf);
614 case EVENT_SCTP_NTFY:
616 ret = cmUnpkSctpNtfy(duSctpNtfyHdl, pst, mBuf);
626 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTSCTP");
631 ODU_PUT_MSG_BUF(mBuf);
640 unpackEgtpCfgCfm(duHdlEgtpCfgComplete, mBuf);
645 unpackEgtpSrvOpenCfm(duHdlEgtpSrvOpenComplete, mBuf);
650 unpackEgtpTnlMgmtCfm(duHdlEgtpTnlMgmtCfm, mBuf);
655 DU_LOG("\nERROR --> DU_APP : Invalid event[%d] received at duActvTsk from ENTEGTP", pst->event);
659 ODU_PUT_MSG_BUF(mBuf);
664 DU_LOG("\nERROR --> DU_APP : DU APP can not process message from Entity %d", pst->srcEnt);
665 ODU_PUT_MSG_BUF(mBuf);
674 /**********************************************************************
676 **********************************************************************/