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");
292 strcpy(message,"Invalid Event");
301 strcpy(sourceTask,"ENTSCTP");
306 strcpy(message,"EVENT_CU_DATA");
309 case EVENT_SCTP_NTFY:
311 strcpy(message,"EVENT_SCTP_NTFY");
316 strcpy(message,"EVENT_RIC_DATA");
321 strcpy(message,"Invalid Event");
330 strcpy(sourceTask,"ENTEGTP");
335 strcpy(message,"EVTCFGCFM");
340 strcpy(message,"EVTSRVOPENCFM");
345 strcpy(message,"EVTTNLMGMTCFM");
350 strcpy(message,"Invalid Event");
358 strcpy(sourceTask,"Invalid Source Entity Id");
362 DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
366 /**************************************************************************
367 * @brief Task Activation callback function.
371 * Function : duActvTsk
374 * Primitives invoked by DU APP's users/providers through
375 * a loosely coupled interface arrive here by means of
376 * SSI's message handling. This API is registered with
377 * SSI during the Task Registration of DU APP.
379 * @param[in] Pst *pst, Post structure of the primitive.
380 * @param[in] Buffer *mBuf, Packed primitive parameters in the
382 * @return ROK - success
385 ***************************************************************************/
386 uint8_t duActvTsk(Pst *pst, Buffer *mBuf)
390 #ifdef CALL_FLOW_DEBUG_LOG
391 callFlowduActvTsk(pst);
402 DU_LOG("\n****** Received initial configs at DU APP ******\n");
404 ODU_PUT_MSG_BUF(mBuf);
409 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTDUAPP");
410 ODU_PUT_MSG_BUF(mBuf);
421 case LKW_EVT_CFG_CFM:
423 ret = unpackRlcConfigCfm(DuHdlRlcCfgComplete, pst, mBuf);
426 case LKW_EVT_CNTRL_CFM:
428 ret = cmUnpkLkwCntrlCfm(duHdlRlcCntrlCfgComplete, pst, mBuf);
431 case LKW_EVT_STA_IND:
435 case EVENT_RLC_UE_CREATE_RSP:
437 ret = unpackRlcUeCreateRsp(DuProcRlcUeCreateRsp, pst, mBuf);
440 case EVENT_RLC_UE_RECONFIG_RSP:
442 ret = unpackRlcUeReconfigRsp(DuProcRlcUeReconfigRsp, pst, mBuf);
445 case EVENT_RLC_UE_DELETE_RSP:
447 ret = unpackRlcUeDeleteRsp(DuProcRlcUeDeleteRsp, pst, mBuf);
450 case EVENT_UL_RRC_MSG_TRANS_TO_DU:
452 ret = unpackRlcUlRrcMsgToDu(DuProcRlcUlRrcMsgTrans, pst, mBuf);
455 case EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU:
457 ret = unpackRrcDeliveryReportToDu(DuProcRlcRrcDeliveryReport, pst, mBuf);
460 case EVENT_DL_RRC_MSG_RSP_TO_DU:
462 ret = unpackRlcDlRrcMsgRspToDu(DuProcRlcDlRrcMsgRsp, pst, mBuf);
465 case EVENT_RLC_MAX_RETRANSMISSION:
467 ret = unpackRlcMaxRetransInd(DuProcRlcMaxRetransInd, pst, mBuf);
470 case EVENT_UL_USER_DATA_TRANS_TO_DU:
472 ret = unpackRlcUlUserDataToDu(DuProcRlcUlUserDataTrans, pst, mBuf);
475 case EVENT_RLC_SLICE_PM_TO_DU:
477 ret = unpackRlcSlicePm(DuProcRlcSliceMetrics, pst, mBuf);
480 case EVENT_RLC_UE_REESTABLISH_RSP:
482 ret = unpackRlcUeReestablishRsp(DuProcRlcUeReestablishRsp, pst, mBuf);
487 DU_LOG("\nERROR --> DU_APP : Invalid event %d received at duActvTsk from ENTRLC", \
489 ODU_PUT_MSG_BUF(mBuf);
502 ODU_PUT_MSG_BUF(mBuf);
507 ret = cmUnpkLrgCfgCfm(duHdlMacCfgComplete, pst, mBuf);
510 case EVTMACSCHGENCFGCFM:
512 ret = cmUnpkLrgSchCfgCfm(duHdlSchCfgComplete, pst, mBuf);
515 case EVENT_MAC_CELL_CONFIG_CFM:
517 ret = unpackMacCellCfgCfm(duHandleMacCellCfgCfm, pst, mBuf);
520 case EVENT_MAC_CELL_UP_IND:
522 ret = unpackMacCellUpInd(duHandleCellUpInd, pst, mBuf);
525 case EVENT_MAC_SLOT_IND:
527 ret = unpackDuMacSlotInd(duHandleSlotInd, pst, mBuf);
530 case EVENT_MAC_STOP_IND:
532 ret = unpackMacStopInd(duHandleStopInd, pst, mBuf);
535 case EVENT_MAC_UL_CCCH_IND:
537 ret = unpackMacUlCcchInd(duHandleUlCcchInd, pst, mBuf);
540 case EVENT_MAC_UE_CREATE_RSP:
542 ret = unpackDuMacUeCreateRsp(DuProcMacUeCreateRsp, pst, mBuf);
545 case EVENT_MAC_UE_RECONFIG_RSP:
547 ret = unpackDuMacUeRecfgRsp(DuProcMacUeRecfgRsp, pst, mBuf);
550 case EVENT_MAC_UE_DELETE_RSP:
552 ret = unpackDuMacUeDeleteRsp(DuProcMacUeDeleteRsp, pst, mBuf);
555 case EVENT_MAC_CELL_DELETE_RSP:
557 ret = unpackDuMacCellDeleteRsp(DuProcMacCellDeleteRsp, pst, mBuf);
560 case EVENT_MAC_SLICE_CFG_RSP:
562 ret = unpackDuMacSliceCfgRsp(DuProcMacSliceCfgRsp, pst, mBuf);
565 case EVENT_MAC_UE_SYNC_STATUS_IND:
567 ret = unpackDuMacUeSyncStatusInd(DuProcMacUeSyncStatusInd, pst, mBuf);
570 case EVENT_MAC_SLICE_RECFG_RSP:
572 ret = unpackDuMacSliceRecfgRsp(DuProcMacSliceRecfgRsp, pst, mBuf);
575 case EVENT_MAC_RACH_RESOURCE_RSP:
577 ret = unpackDuMacRachRsrcRsp(DuProcMacRachRsrcRsp, pst, mBuf);
580 case EVENT_MAC_UE_RESET_RSP:
582 ret = unpackDuMacUeResetRsp(DuProcMacUeResetRsp, pst, mBuf);
587 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTMAC");
588 ODU_PUT_MSG_BUF(mBuf);
604 case EVENT_SCTP_NTFY:
606 ret = cmUnpkSctpNtfy(duSctpNtfyHdl, pst, mBuf);
616 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTSCTP");
621 ODU_PUT_MSG_BUF(mBuf);
630 unpackEgtpCfgCfm(duHdlEgtpCfgComplete, mBuf);
635 unpackEgtpSrvOpenCfm(duHdlEgtpSrvOpenComplete, mBuf);
640 unpackEgtpTnlMgmtCfm(duHdlEgtpTnlMgmtCfm, mBuf);
645 DU_LOG("\nERROR --> DU_APP : Invalid event[%d] received at duActvTsk from ENTEGTP", pst->event);
649 ODU_PUT_MSG_BUF(mBuf);
654 DU_LOG("\nERROR --> DU_APP : DU APP can not process message from Entity %d", pst->srcEnt);
655 ODU_PUT_MSG_BUF(mBuf);
664 /**********************************************************************
666 **********************************************************************/