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 duCb.gnbDuUeF1apIdGenerator = 0;
100 cmLListInit(&duCb.reservedF1apPduList);
101 ODU_SET_PROC_ID(DU_PROC);
107 #ifdef CALL_FLOW_DEBUG_LOG
108 /**************************************************************************
109 * @brief Function prints the src dest and msg reached to egtp.
113 * Function : callFlowduActvTsk
116 * Function prints the src dest and msg reached to egtp.
118 * @param[in] Pst *pst, Post structure of the primitive.
122 +***************************************************************************/
124 void callFlowduActvTsk(Pst *pst)
127 char destTask[50]="ENTDUAPP";
134 strcpy(sourceTask,"ENTDUAPP");
139 strcpy(message,"EVTCFG");
144 strcpy(message,"Invalid Event");
153 strcpy(sourceTask,"ENTRLC");
156 case LKW_EVT_CFG_CFM:
158 strcpy(message,"LKW_EVT_CFG_CFM");
161 case LKW_EVT_CNTRL_CFM:
163 strcpy(message,"LKW_EVT_CNTRL_CFM");
166 case LKW_EVT_STA_IND:
168 strcpy(message,"LKW_EVT_STA_IND");
171 case EVENT_RLC_UE_CREATE_RSP:
173 strcpy(message,"EVENT_RLC_UE_CREATE_RSP");
176 case EVENT_RLC_UE_RECONFIG_RSP:
178 strcpy(message,"EVENT_RLC_UE_RECONFIG_RSP");
181 case EVENT_RLC_UE_DELETE_RSP:
183 strcpy(message,"EVENT_RLC_UE_DELETE_RSP");
186 case EVENT_UL_RRC_MSG_TRANS_TO_DU:
188 strcpy(message,"EVENT_UL_RRC_MSG_TRANS_TO_DU");
191 case EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU:
193 strcpy(message,"EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU");
196 case EVENT_DL_RRC_MSG_RSP_TO_DU:
198 strcpy(message,"EVENT_DL_RRC_MSG_RSP_TO_DU");
201 case EVENT_UL_USER_DATA_TRANS_TO_DU:
203 strcpy(message,"EVENT_UL_USER_DATA_TRANS_TO_DU");
208 strcpy(message,"Invalid Event");
215 strcpy(sourceTask,"ENTMAC");
220 strcpy(message,"EVTCFG");
225 strcpy(message,"EVTLRGCFGCFM");
228 case EVTMACSCHGENCFGCFM:
230 strcpy(message,"EVTMACSCHGENCFGCFM");
233 case EVENT_MAC_CELL_CONFIG_CFM:
235 strcpy(message,"EVENT_MAC_CELL_CONFIG_CFM");
238 case EVENT_MAC_CELL_UP_IND:
240 strcpy(message,"EVENT_MAC_CELL_UP_IND");
243 case EVENT_MAC_SLOT_IND:
245 strcpy(message,"EVENT_MAC_SLOT_IND");
248 case EVENT_MAC_STOP_IND:
250 strcpy(message,"EVENT_MAC_STOP_IND");
253 case EVENT_MAC_UL_CCCH_IND:
255 strcpy(message,"EVENT_MAC_UL_CCCH_IND");
258 case EVENT_MAC_UE_CREATE_RSP:
260 strcpy(message,"EVENT_MAC_UE_CREATE_RSP");
263 case EVENT_MAC_UE_RECONFIG_RSP:
265 strcpy(message,"EVENT_MAC_UE_RECONFIG_RSP");
268 case EVENT_MAC_UE_DELETE_RSP:
270 strcpy(message,"EVENT_MAC_UE_DELETE_RSP");
273 case EVENT_MAC_CELL_DELETE_RSP:
275 strcpy(message,"EVENT_MAC_CELL_DELETE_RSP");
278 case EVENT_MAC_SLICE_CFG_RSP:
280 strcpy(message,"EVENT_MAC_SLICE_CFG_RSP");
283 case EVENT_MAC_SLICE_RECFG_RSP:
285 strcpy(message,"EVENT_MAC_SLICE_RECFG_RSP");
290 strcpy(message,"Invalid Event");
299 strcpy(sourceTask,"ENTSCTP");
304 strcpy(message,"EVENT_CU_DATA");
307 case EVENT_SCTP_NTFY:
309 strcpy(message,"EVENT_SCTP_NTFY");
314 strcpy(message,"EVENT_RIC_DATA");
319 strcpy(message,"Invalid Event");
328 strcpy(sourceTask,"ENTEGTP");
333 strcpy(message,"EVTCFGCFM");
338 strcpy(message,"EVTSRVOPENCFM");
343 strcpy(message,"EVTTNLMGMTCFM");
348 strcpy(message,"Invalid Event");
356 strcpy(sourceTask,"Invalid Source Entity Id");
360 DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
364 /**************************************************************************
365 * @brief Task Activation callback function.
369 * Function : duActvTsk
372 * Primitives invoked by DU APP's users/providers through
373 * a loosely coupled interface arrive here by means of
374 * SSI's message handling. This API is registered with
375 * SSI during the Task Registration of DU APP.
377 * @param[in] Pst *pst, Post structure of the primitive.
378 * @param[in] Buffer *mBuf, Packed primitive parameters in the
380 * @return ROK - success
383 ***************************************************************************/
384 uint8_t duActvTsk(Pst *pst, Buffer *mBuf)
388 #ifdef CALL_FLOW_DEBUG_LOG
389 callFlowduActvTsk(pst);
400 DU_LOG("\n****** Received initial configs at DU APP ******\n");
402 ODU_PUT_MSG_BUF(mBuf);
407 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTDUAPP");
408 ODU_PUT_MSG_BUF(mBuf);
419 case LKW_EVT_CFG_CFM:
421 ret = unpackRlcConfigCfm(DuHdlRlcCfgComplete, pst, mBuf);
424 case LKW_EVT_CNTRL_CFM:
426 ret = cmUnpkLkwCntrlCfm(duHdlRlcCntrlCfgComplete, pst, mBuf);
429 case LKW_EVT_STA_IND:
433 case EVENT_RLC_UE_CREATE_RSP:
435 ret = unpackRlcUeCreateRsp(DuProcRlcUeCreateRsp, pst, mBuf);
438 case EVENT_RLC_UE_RECONFIG_RSP:
440 ret = unpackRlcUeReconfigRsp(DuProcRlcUeReconfigRsp, pst, mBuf);
443 case EVENT_RLC_UE_DELETE_RSP:
445 ret = unpackRlcUeDeleteRsp(DuProcRlcUeDeleteRsp, pst, mBuf);
448 case EVENT_UL_RRC_MSG_TRANS_TO_DU:
450 ret = unpackRlcUlRrcMsgToDu(DuProcRlcUlRrcMsgTrans, pst, mBuf);
453 case EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU:
455 ret = unpackRrcDeliveryReportToDu(DuProcRlcRrcDeliveryReport, pst, mBuf);
458 case EVENT_DL_RRC_MSG_RSP_TO_DU:
460 ret = unpackRlcDlRrcMsgRspToDu(DuProcRlcDlRrcMsgRsp, pst, mBuf);
463 case EVENT_RLC_MAX_RETRANSMISSION:
465 ret = unpackRlcMaxRetransInd(DuProcRlcMaxRetransInd, pst, mBuf);
468 case EVENT_UL_USER_DATA_TRANS_TO_DU:
470 ret = unpackRlcUlUserDataToDu(DuProcRlcUlUserDataTrans, pst, mBuf);
473 case EVENT_RLC_SLICE_PM_TO_DU:
475 ret = unpackRlcSlicePm(DuProcRlcSliceMetrics, pst, mBuf);
478 case EVENT_RLC_UE_REESTABLISH_RSP:
480 ret = unpackRlcUeReestablishRsp(DuProcRlcUeReestablishRsp, pst, mBuf);
485 DU_LOG("\nERROR --> DU_APP : Invalid event %d received at duActvTsk from ENTRLC", \
487 ODU_PUT_MSG_BUF(mBuf);
500 ODU_PUT_MSG_BUF(mBuf);
505 ret = cmUnpkLrgCfgCfm(duHdlMacCfgComplete, pst, mBuf);
508 case EVTMACSCHGENCFGCFM:
510 ret = cmUnpkLrgSchCfgCfm(duHdlSchCfgComplete, pst, mBuf);
513 case EVENT_MAC_CELL_CONFIG_CFM:
515 ret = unpackMacCellCfgCfm(duHandleMacCellCfgCfm, pst, mBuf);
518 case EVENT_MAC_CELL_UP_IND:
520 ret = unpackMacCellUpInd(duHandleCellUpInd, pst, mBuf);
523 case EVENT_MAC_SLOT_IND:
525 ret = unpackDuMacSlotInd(duHandleSlotInd, pst, mBuf);
528 case EVENT_MAC_STOP_IND:
530 ret = unpackMacStopInd(duHandleStopInd, pst, mBuf);
533 case EVENT_MAC_UL_CCCH_IND:
535 ret = unpackMacUlCcchInd(duHandleUlCcchInd, pst, mBuf);
538 case EVENT_MAC_UE_CREATE_RSP:
540 ret = unpackDuMacUeCreateRsp(DuProcMacUeCreateRsp, pst, mBuf);
543 case EVENT_MAC_UE_RECONFIG_RSP:
545 ret = unpackDuMacUeRecfgRsp(DuProcMacUeRecfgRsp, pst, mBuf);
548 case EVENT_MAC_UE_DELETE_RSP:
550 ret = unpackDuMacUeDeleteRsp(DuProcMacUeDeleteRsp, pst, mBuf);
553 case EVENT_MAC_CELL_DELETE_RSP:
555 ret = unpackDuMacCellDeleteRsp(DuProcMacCellDeleteRsp, pst, mBuf);
558 case EVENT_MAC_SLICE_CFG_RSP:
560 ret = unpackDuMacSliceCfgRsp(DuProcMacSliceCfgRsp, pst, mBuf);
563 case EVENT_MAC_UE_SYNC_STATUS_IND:
565 ret = unpackDuMacUeSyncStatusInd(DuProcMacUeSyncStatusInd, pst, mBuf);
568 case EVENT_MAC_SLICE_RECFG_RSP:
570 ret = unpackDuMacSliceRecfgRsp(DuProcMacSliceRecfgRsp, pst, mBuf);
573 case EVENT_MAC_RACH_RESOURCE_RSP:
575 ret = unpackDuMacRachRsrcRsp(DuProcMacRachRsrcRsp, pst, mBuf);
578 case EVENT_MAC_UE_RESET_RSP:
580 ret = unpackDuMacUeResetRsp(DuProcMacUeResetRsp, pst, mBuf);
585 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTMAC");
586 ODU_PUT_MSG_BUF(mBuf);
602 case EVENT_SCTP_NTFY:
604 ret = cmUnpkSctpNtfy(duSctpNtfyHdl, pst, mBuf);
614 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTSCTP");
619 ODU_PUT_MSG_BUF(mBuf);
628 unpackEgtpCfgCfm(duHdlEgtpCfgComplete, mBuf);
633 unpackEgtpSrvOpenCfm(duHdlEgtpSrvOpenComplete, mBuf);
638 unpackEgtpTnlMgmtCfm(duHdlEgtpTnlMgmtCfm, mBuf);
643 DU_LOG("\nERROR --> DU_APP : Invalid event[%d] received at duActvTsk from ENTEGTP", pst->event);
647 ODU_PUT_MSG_BUF(mBuf);
652 DU_LOG("\nERROR --> DU_APP : DU APP can not process message from Entity %d", pst->srcEnt);
653 ODU_PUT_MSG_BUF(mBuf);
662 /**********************************************************************
664 **********************************************************************/