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"
32 #include "du_e2ap_mgr.h"
33 #include "du_e2ap_msg_hdl.h"
39 #include "du_f1ap_msg_hdl.h"
40 #include "du_app_mac_inf.h"
41 #include "du_ue_mgr.h"
44 uint8_t unpackRlcConfigCfm(RlcConfigCfm func,Pst *pst, Buffer *mBuf);
45 uint8_t cmUnpkLkwCntrlCfm(LkwCntrlCfm func,Pst *pst, Buffer *mBuf);
46 uint8_t cmUnpkLrgCfgCfm(LrgCfgCfm func,Pst *pst, Buffer *mBuf);
47 uint8_t cmUnpkKwuDatInd(KwuDatInd func,Pst *pst, Buffer *mBuf);
48 uint8_t cmUnpkLrgSchCfgCfm(LrgSchCfgCfm func,Pst *pst,Buffer *mBuf);
49 /**************************************************************************
50 * @brief Task Initiation callback function.
54 * Function : duActvInit
57 * This function is supplied as one of parameters during DU APP's
58 * task registration. SSI will invoke this function once, after
59 * it creates and attaches this TAPA Task to a system task.
61 * @param[in] Ent entity, the entity ID of this task.
62 * @param[in] Inst inst, the instance ID of this task.
63 * @param[in] Region region, the region ID registered for memory
65 * @param[in] Reason reason.
66 * @return ROK - success
68 ***************************************************************************/
69 uint8_t duActvInit(Ent entity, Inst inst, Region region, Reason reason)
73 memset(&duCb, 0, sizeof(DuCb));
75 duCb.init.procId = ODU_GET_PROCID();
76 duCb.init.ent = entity;
77 duCb.init.inst = inst;
78 duCb.init.region = region;
79 duCb.init.reason = reason;
80 duCb.init.cfgDone = FALSE;
81 duCb.init.pool = DU_POOL;
82 duCb.init.acnt = FALSE;
83 duCb.init.trc = FALSE;
84 duCb.init.usta = TRUE;
85 duCb.mem.region = DFLT_REGION;
86 duCb.mem.pool = DU_POOL;
88 duCb.f1Status = FALSE;
89 duCb.e2Status = FALSE;
91 for(id = 0; id < MAX_NUM_CELL; id ++)
93 duCb.cfgCellLst[id] = NULL;
94 duCb.actvCellLst[id] = NULL;
97 memset(duCb.ueCcchCtxt, 0, MAX_NUM_UE * sizeof(UeCcchCtxt));
99 duCb.numActvCells = 0;
100 duCb.gnbDuUeF1apIdGenerator = 0;
101 cmLListInit(&duCb.reservedF1apPduList);
102 ODU_SET_PROC_ID(DU_PROC);
108 #ifdef CALL_FLOW_DEBUG_LOG
109 /**************************************************************************
110 * @brief Function prints the src dest and msg reached to egtp.
114 * Function : callFlowduActvTsk
117 * Function prints the src dest and msg reached to egtp.
119 * @param[in] Pst *pst, Post structure of the primitive.
123 +***************************************************************************/
125 void callFlowduActvTsk(Pst *pst)
128 char destTask[50]="ENTDUAPP";
135 strcpy(sourceTask,"ENTDUAPP");
140 strcpy(message,"EVTCFG");
145 strcpy(message,"Invalid Event");
154 strcpy(sourceTask,"ENTRLC");
157 case LKW_EVT_CFG_CFM:
159 strcpy(message,"LKW_EVT_CFG_CFM");
162 case LKW_EVT_CNTRL_CFM:
164 strcpy(message,"LKW_EVT_CNTRL_CFM");
167 case LKW_EVT_STA_IND:
169 strcpy(message,"LKW_EVT_STA_IND");
172 case EVENT_RLC_UE_CREATE_RSP:
174 strcpy(message,"EVENT_RLC_UE_CREATE_RSP");
177 case EVENT_RLC_UE_RECONFIG_RSP:
179 strcpy(message,"EVENT_RLC_UE_RECONFIG_RSP");
182 case EVENT_RLC_UE_DELETE_RSP:
184 strcpy(message,"EVENT_RLC_UE_DELETE_RSP");
187 case EVENT_UL_RRC_MSG_TRANS_TO_DU:
189 strcpy(message,"EVENT_UL_RRC_MSG_TRANS_TO_DU");
192 case EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU:
194 strcpy(message,"EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU");
197 case EVENT_DL_RRC_MSG_RSP_TO_DU:
199 strcpy(message,"EVENT_DL_RRC_MSG_RSP_TO_DU");
202 case EVENT_UL_USER_DATA_TRANS_TO_DU:
204 strcpy(message,"EVENT_UL_USER_DATA_TRANS_TO_DU");
209 strcpy(message,"Invalid Event");
216 strcpy(sourceTask,"ENTMAC");
221 strcpy(message,"EVTCFG");
226 strcpy(message,"EVTLRGCFGCFM");
229 case EVTMACSCHGENCFGCFM:
231 strcpy(message,"EVTMACSCHGENCFGCFM");
234 case EVENT_MAC_CELL_CONFIG_CFM:
236 strcpy(message,"EVENT_MAC_CELL_CONFIG_CFM");
239 case EVENT_MAC_CELL_UP_IND:
241 strcpy(message,"EVENT_MAC_CELL_UP_IND");
244 case EVENT_MAC_SLOT_IND:
246 strcpy(message,"EVENT_MAC_SLOT_IND");
249 case EVENT_MAC_STOP_IND:
251 strcpy(message,"EVENT_MAC_STOP_IND");
254 case EVENT_MAC_UL_CCCH_IND:
256 strcpy(message,"EVENT_MAC_UL_CCCH_IND");
259 case EVENT_MAC_UE_CREATE_RSP:
261 strcpy(message,"EVENT_MAC_UE_CREATE_RSP");
264 case EVENT_MAC_UE_RECONFIG_RSP:
266 strcpy(message,"EVENT_MAC_UE_RECONFIG_RSP");
269 case EVENT_MAC_UE_DELETE_RSP:
271 strcpy(message,"EVENT_MAC_UE_DELETE_RSP");
274 case EVENT_MAC_CELL_DELETE_RSP:
276 strcpy(message,"EVENT_MAC_CELL_DELETE_RSP");
279 case EVENT_MAC_SLICE_CFG_RSP:
281 strcpy(message,"EVENT_MAC_SLICE_CFG_RSP");
284 case EVENT_MAC_SLICE_RECFG_RSP:
286 strcpy(message,"EVENT_MAC_SLICE_RECFG_RSP");
291 strcpy(message,"Invalid Event");
300 strcpy(sourceTask,"ENTSCTP");
305 strcpy(message,"EVENT_CU_DATA");
308 case EVENT_SCTP_NTFY:
310 strcpy(message,"EVENT_SCTP_NTFY");
315 strcpy(message,"EVENT_RIC_DATA");
320 strcpy(message,"Invalid Event");
329 strcpy(sourceTask,"ENTEGTP");
334 strcpy(message,"EVTCFGCFM");
339 strcpy(message,"EVTSRVOPENCFM");
344 strcpy(message,"EVTTNLMGMTCFM");
349 strcpy(message,"Invalid Event");
357 strcpy(sourceTask,"Invalid Source Entity Id");
361 DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
365 /**************************************************************************
366 * @brief Task Activation callback function.
370 * Function : duActvTsk
373 * Primitives invoked by DU APP's users/providers through
374 * a loosely coupled interface arrive here by means of
375 * SSI's message handling. This API is registered with
376 * SSI during the Task Registration of DU APP.
378 * @param[in] Pst *pst, Post structure of the primitive.
379 * @param[in] Buffer *mBuf, Packed primitive parameters in the
381 * @return ROK - success
384 ***************************************************************************/
385 uint8_t duActvTsk(Pst *pst, Buffer *mBuf)
389 #ifdef CALL_FLOW_DEBUG_LOG
390 callFlowduActvTsk(pst);
401 DU_LOG("\n****** Received initial configs at DU APP ******\n");
403 ODU_PUT_MSG_BUF(mBuf);
408 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTDUAPP");
409 ODU_PUT_MSG_BUF(mBuf);
420 case LKW_EVT_CFG_CFM:
422 ret = unpackRlcConfigCfm(DuHdlRlcCfgComplete, pst, mBuf);
425 case LKW_EVT_CNTRL_CFM:
427 ret = cmUnpkLkwCntrlCfm(duHdlRlcCntrlCfgComplete, pst, mBuf);
430 case LKW_EVT_STA_IND:
434 case EVENT_RLC_UE_CREATE_RSP:
436 ret = unpackRlcUeCreateRsp(DuProcRlcUeCreateRsp, pst, mBuf);
439 case EVENT_RLC_UE_RECONFIG_RSP:
441 ret = unpackRlcUeReconfigRsp(DuProcRlcUeReconfigRsp, pst, mBuf);
444 case EVENT_RLC_UE_DELETE_RSP:
446 ret = unpackRlcUeDeleteRsp(DuProcRlcUeDeleteRsp, pst, mBuf);
449 case EVENT_UL_RRC_MSG_TRANS_TO_DU:
451 ret = unpackRlcUlRrcMsgToDu(DuProcRlcUlRrcMsgTrans, pst, mBuf);
454 case EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU:
456 ret = unpackRrcDeliveryReportToDu(DuProcRlcRrcDeliveryReport, pst, mBuf);
459 case EVENT_DL_RRC_MSG_RSP_TO_DU:
461 ret = unpackRlcDlRrcMsgRspToDu(DuProcRlcDlRrcMsgRsp, pst, mBuf);
464 case EVENT_RLC_MAX_RETRANSMISSION:
466 ret = unpackRlcMaxRetransInd(DuProcRlcMaxRetransInd, pst, mBuf);
469 case EVENT_UL_USER_DATA_TRANS_TO_DU:
471 ret = unpackRlcUlUserDataToDu(DuProcRlcUlUserDataTrans, pst, mBuf);
474 case EVENT_RLC_SLICE_PM_TO_DU:
476 ret = unpackRlcSlicePm(DuProcRlcSliceMetrics, pst, mBuf);
479 case EVENT_RLC_UE_REESTABLISH_RSP:
481 ret = unpackRlcUeReestablishRsp(DuProcRlcUeReestablishRsp, pst, mBuf);
486 DU_LOG("\nERROR --> DU_APP : Invalid event %d received at duActvTsk from ENTRLC", \
488 ODU_PUT_MSG_BUF(mBuf);
501 ODU_PUT_MSG_BUF(mBuf);
506 ret = cmUnpkLrgCfgCfm(duHdlMacCfgComplete, pst, mBuf);
509 case EVTMACSCHGENCFGCFM:
511 ret = cmUnpkLrgSchCfgCfm(duHdlSchCfgComplete, pst, mBuf);
514 case EVENT_MAC_CELL_CONFIG_CFM:
516 ret = unpackMacCellCfgCfm(duHandleMacCellCfgCfm, pst, mBuf);
519 case EVENT_MAC_CELL_UP_IND:
521 ret = unpackMacCellUpInd(duHandleCellUpInd, pst, mBuf);
524 case EVENT_MAC_SLOT_IND:
526 ret = unpackDuMacSlotInd(duHandleSlotInd, pst, mBuf);
529 case EVENT_MAC_STOP_IND:
531 ret = unpackMacStopInd(duHandleStopInd, pst, mBuf);
534 case EVENT_MAC_UL_CCCH_IND:
536 ret = unpackMacUlCcchInd(duHandleUlCcchInd, pst, mBuf);
539 case EVENT_MAC_UE_CREATE_RSP:
541 ret = unpackDuMacUeCreateRsp(DuProcMacUeCreateRsp, pst, mBuf);
544 case EVENT_MAC_UE_RECONFIG_RSP:
546 ret = unpackDuMacUeRecfgRsp(DuProcMacUeRecfgRsp, pst, mBuf);
549 case EVENT_MAC_UE_DELETE_RSP:
551 ret = unpackDuMacUeDeleteRsp(DuProcMacUeDeleteRsp, pst, mBuf);
554 case EVENT_MAC_CELL_DELETE_RSP:
556 ret = unpackDuMacCellDeleteRsp(DuProcMacCellDeleteRsp, pst, mBuf);
559 case EVENT_MAC_SLICE_CFG_RSP:
561 ret = unpackDuMacSliceCfgRsp(DuProcMacSliceCfgRsp, pst, mBuf);
564 case EVENT_MAC_UE_SYNC_STATUS_IND:
566 ret = unpackDuMacUeSyncStatusInd(DuProcMacUeSyncStatusInd, pst, mBuf);
569 case EVENT_MAC_SLICE_RECFG_RSP:
571 ret = unpackDuMacSliceRecfgRsp(DuProcMacSliceRecfgRsp, pst, mBuf);
574 case EVENT_MAC_RACH_RESOURCE_RSP:
576 ret = unpackDuMacRachRsrcRsp(DuProcMacRachRsrcRsp, pst, mBuf);
579 case EVENT_MAC_UE_RESET_RSP:
581 ret = unpackDuMacUeResetRsp(DuProcMacUeResetRsp, pst, mBuf);
586 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTMAC");
587 ODU_PUT_MSG_BUF(mBuf);
603 case EVENT_SCTP_NTFY:
605 ret = cmUnpkSctpNtfy(duSctpNtfyHdl, pst, mBuf);
615 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTSCTP");
620 ODU_PUT_MSG_BUF(mBuf);
629 unpackEgtpCfgCfm(duHdlEgtpCfgComplete, mBuf);
634 unpackEgtpSrvOpenCfm(duHdlEgtpSrvOpenComplete, mBuf);
639 unpackEgtpTnlMgmtCfm(duHdlEgtpTnlMgmtCfm, mBuf);
644 DU_LOG("\nERROR --> DU_APP : Invalid event[%d] received at duActvTsk from ENTEGTP", pst->event);
648 ODU_PUT_MSG_BUF(mBuf);
653 DU_LOG("\nERROR --> DU_APP : DU APP can not process message from Entity %d", pst->srcEnt);
654 ODU_PUT_MSG_BUF(mBuf);
663 /**********************************************************************
665 **********************************************************************/