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 /**************************************************************************
108 * @brief Function prints the src dest and msg reached to egtp.
112 * Function : callFlowduActvTsk
115 * Function prints the src dest and msg reached to egtp.
117 * @param[in] Pst *pst, Post structure of the primitive.
121 +***************************************************************************/
123 void callFlowduActvTsk(Pst *pst)
126 char destTask[50]="ENTDUAPP";
133 strcpy(sourceTask,"ENTDUAPP");
138 strcpy(message,"EVTCFG");
143 strcpy(message,"Invalid Event");
152 strcpy(sourceTask,"ENTRLC");
155 case LKW_EVT_CFG_CFM:
157 strcpy(message,"LKW_EVT_CFG_CFM");
160 case LKW_EVT_CNTRL_CFM:
162 strcpy(message,"LKW_EVT_CNTRL_CFM");
165 case LKW_EVT_STA_IND:
167 strcpy(message,"LKW_EVT_STA_IND");
170 case EVENT_RLC_UE_CREATE_RSP:
172 strcpy(message,"EVENT_RLC_UE_CREATE_RSP");
175 case EVENT_RLC_UE_RECONFIG_RSP:
177 strcpy(message,"EVENT_RLC_UE_RECONFIG_RSP");
180 case EVENT_RLC_UE_DELETE_RSP:
182 strcpy(message,"EVENT_RLC_UE_DELETE_RSP");
185 case EVENT_UL_RRC_MSG_TRANS_TO_DU:
187 strcpy(message,"EVENT_UL_RRC_MSG_TRANS_TO_DU");
190 case EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU:
192 strcpy(message,"EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU");
195 case EVENT_DL_RRC_MSG_RSP_TO_DU:
197 strcpy(message,"EVENT_DL_RRC_MSG_RSP_TO_DU");
200 case EVENT_UL_USER_DATA_TRANS_TO_DU:
202 strcpy(message,"EVENT_UL_USER_DATA_TRANS_TO_DU");
207 strcpy(message,"Invalid Event");
214 strcpy(sourceTask,"ENTMAC");
219 strcpy(message,"EVTCFG");
224 strcpy(message,"EVTLRGCFGCFM");
229 strcpy(message,"EVTLRGCNTRLCFM");
232 case EVTMACSCHGENCFGCFM:
234 strcpy(message,"EVTMACSCHGENCFGCFM");
237 case EVENT_MAC_CELL_CONFIG_CFM:
239 strcpy(message,"EVENT_MAC_CELL_CONFIG_CFM");
242 case EVENT_MAC_CELL_UP_IND:
244 strcpy(message,"EVENT_MAC_CELL_UP_IND");
247 case EVENT_MAC_SLOT_IND:
249 strcpy(message,"EVENT_MAC_SLOT_IND");
252 case EVENT_MAC_STOP_IND:
254 strcpy(message,"EVENT_MAC_STOP_IND");
257 case EVENT_MAC_UL_CCCH_IND:
259 strcpy(message,"EVENT_MAC_UL_CCCH_IND");
262 case EVENT_MAC_UE_CREATE_RSP:
264 strcpy(message,"EVENT_MAC_UE_CREATE_RSP");
267 case EVENT_MAC_UE_RECONFIG_RSP:
269 strcpy(message,"EVENT_MAC_UE_RECONFIG_RSP");
272 case EVENT_MAC_UE_DELETE_RSP:
274 strcpy(message,"EVENT_MAC_UE_DELETE_RSP");
277 case EVENT_MAC_CELL_DELETE_RSP:
279 strcpy(message,"EVENT_MAC_CELL_DELETE_RSP");
282 case EVENT_MAC_SLICE_CFG_RSP:
284 strcpy(message,"EVENT_MAC_SLICE_CFG_RSP");
287 case EVENT_MAC_SLICE_RECFG_RSP:
289 strcpy(message,"EVENT_MAC_SLICE_RECFG_RSP");
294 strcpy(message,"Invalid Event");
303 strcpy(sourceTask,"ENTSCTP");
308 strcpy(message,"EVENT_CU_DATA");
311 case EVENT_SCTP_NTFY:
313 strcpy(message,"EVENT_SCTP_NTFY");
318 strcpy(message,"EVENT_RIC_DATA");
323 strcpy(message,"Invalid Event");
332 strcpy(sourceTask,"ENTEGTP");
337 strcpy(message,"EVTCFGCFM");
342 strcpy(message,"EVTSRVOPENCFM");
347 strcpy(message,"EVTTNLMGMTCFM");
352 strcpy(message,"Invalid Event");
360 strcpy(sourceTask,"Invalid Source Entity Id");
364 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 = unpackRlcUeCfgRsp(DuProcRlcUeCfgRsp, pst, mBuf);
440 case EVENT_RLC_UE_RECONFIG_RSP:
442 ret = unpackRlcUeCfgRsp(DuProcRlcUeCfgRsp, 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_UL_USER_DATA_TRANS_TO_DU:
467 ret = unpackRlcUlUserDataToDu(DuProcRlcUlUserDataTrans, pst, mBuf);
470 case EVENT_RLC_SLICE_PM_TO_DU:
472 ret = unpackRlcSlicePm(DuProcRlcSliceMetrics, pst, mBuf);
477 DU_LOG("\nERROR --> DU_APP : Invalid event %d received at duActvTsk from ENTRLC", \
479 ODU_PUT_MSG_BUF(mBuf);
492 ODU_PUT_MSG_BUF(mBuf);
497 ret = cmUnpkLrgCfgCfm(duHdlMacCfgComplete, pst, mBuf);
504 case EVTMACSCHGENCFGCFM:
506 ret = cmUnpkLrgSchCfgCfm(duHdlSchCfgComplete, pst, mBuf);
509 case EVENT_MAC_CELL_CONFIG_CFM:
511 ret = unpackMacCellCfgCfm(duHandleMacCellCfgCfm, pst, mBuf);
514 case EVENT_MAC_CELL_UP_IND:
516 ret = unpackMacCellUpInd(duHandleCellUpInd, pst, mBuf);
519 case EVENT_MAC_SLOT_IND:
521 ret = unpackDuMacSlotInd(duHandleSlotInd, pst, mBuf);
524 case EVENT_MAC_STOP_IND:
526 ret = unpackMacStopInd(duHandleStopInd, pst, mBuf);
529 case EVENT_MAC_UL_CCCH_IND:
531 ret = unpackMacUlCcchInd(duHandleUlCcchInd, pst, mBuf);
534 case EVENT_MAC_UE_CREATE_RSP:
536 ret = unpackDuMacUeCfgRsp(DuProcMacUeCfgRsp, pst, mBuf);
539 case EVENT_MAC_UE_RECONFIG_RSP:
541 ret = unpackDuMacUeCfgRsp(DuProcMacUeCfgRsp, pst, mBuf);
544 case EVENT_MAC_UE_DELETE_RSP:
546 ret = unpackDuMacUeDeleteRsp(DuProcMacUeDeleteRsp, pst, mBuf);
549 case EVENT_MAC_CELL_DELETE_RSP:
551 ret = unpackDuMacCellDeleteRsp(DuProcMacCellDeleteRsp, pst, mBuf);
554 case EVENT_MAC_SLICE_CFG_RSP:
556 ret = unpackDuMacSliceCfgRsp(DuProcMacSliceCfgRsp, pst, mBuf);
559 case EVENT_MAC_SLICE_RECFG_RSP:
561 ret = unpackDuMacSliceRecfgRsp(DuProcMacSliceRecfgRsp, pst, mBuf);
564 case EVENT_MAC_RACH_RESOURCE_RSP:
566 ret = unpackDuMacRachRsrcRsp(DuProcMacRachRsrcRsp, pst, mBuf);
571 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTMAC");
572 ODU_PUT_MSG_BUF(mBuf);
588 case EVENT_SCTP_NTFY:
590 ret = cmUnpkSctpNtfy(duSctpNtfyHdl, pst, mBuf);
600 DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTSCTP");
605 ODU_PUT_MSG_BUF(mBuf);
614 unpackEgtpCfgCfm(duHdlEgtpCfgComplete, mBuf);
619 unpackEgtpSrvOpenCfm(duHdlEgtpSrvOpenComplete, mBuf);
624 unpackEgtpTnlMgmtCfm(duHdlEgtpTnlMgmtCfm, mBuf);
629 DU_LOG("\nERROR --> DU_APP : Invalid event[%d] received at duActvTsk from ENTEGTP", pst->event);
633 ODU_PUT_MSG_BUF(mBuf);
638 DU_LOG("\nERROR --> DU_APP : DU APP can not process message from Entity %d", pst->srcEnt);
639 ODU_PUT_MSG_BUF(mBuf);
648 /**********************************************************************
650 **********************************************************************/