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 *******************************************************************************/
19 /************************************************************************
25 Desc: C source code SSI Interface Implementation
27 File: mac_msg_router.c
29 **********************************************************************/
31 /** @file mac_msg_router.c
32 @brief This file contains the implementation of callback functions
33 registered with SSI during the LTE MAC Task initialization.
35 /* header include files -- defines (.h) */
36 #include "common_def.h"
37 #include "rgu.h" /* RGU defines */
38 #include "tfu.h" /* RGU defines */
39 #include "lrg.h" /* layer management defines for LTE-MAC */
40 #include "rgr.h" /* layer management defines for LTE-MAC */
41 #include "crg.h" /* CRG interface includes */
42 #include "rg_sch_inf.h" /* SCH interface includes */
43 #include "rg_prg.h" /* PRG interface includes */
44 #include "rg_env.h" /* customisable defines and macros for LTE-MAC */
45 #include "rg.h" /* defines and macros for MAC */
46 #include "rgr.h" /* defines and macros for SCH */
49 /* header/extern include files (.x) */
50 #include "rgu.x" /* RGU types */
51 #include "tfu.x" /* RGU types */
52 #include "lrg.x" /* layer management typedefs for MAC */
53 #include "rgr.x" /* layer management typedefs for MAC */
54 #include "crg.x" /* CRG interface typedes */
55 #include "rg_sch_inf.x" /* SCH interface typedefs */
56 #include "rg_prg.x" /*PRG interface includes*/
57 #include "du_app_mac_inf.h"
58 #include "rg.x" /* typedefs for MAC */
59 #include "rlc_mac_inf.h"
60 #include "lwr_mac_upr_inf.h"
63 * @brief Task Activation callback function Entity SM.
67 * Function : rgHdlSMEvents
69 * Process Messages received from Entity SM
71 * @param[in] Pst *pst, Post structure of the primitive.
72 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
73 * @param[in] Reason reason.
76 static inline void rgHdlSMEvents
78 Pst *pst, /* post structure */
79 Buffer *mBuf /* message buffer */
86 /* Process a config. request */
87 cmUnpkLrgCfgReq(RgMiLrgCfgReq, pst, mBuf);
89 case EVTMACSCHGENCFGREQ:
90 /* Process a config. request */
91 cmUnpkLrgSchCfgReq(MacSchGenCfgReq, pst, mBuf);
94 /* Process a control request */
95 cmUnpkLrgCntrlReq(RgMiLrgCntrlReq, pst, mBuf);
98 /* Process a status request */
99 cmUnpkLrgStaReq(RgMiLrgStaReq, pst, mBuf);
102 /* Process a statistics request */
103 cmUnpkLrgStsReq(RgMiLrgStsReq, pst, mBuf);
105 #endif /* LCRGMILRG */
106 case EVENT_MAC_CELL_CONFIG_REQ:
108 /* Process MAC cell config */
109 unpackDuMacCellCfg(MacProcCellCfgReq, pst, mBuf);
112 case EVENT_MAC_CELL_START:
114 /* Process MAC cell start request */
115 unpackMacCellStart(MacProcCellStart, pst, mBuf);
118 case EVENT_MAC_CELL_STOP:
120 /* Process MAC cell stop request */
121 unpackMacCellStop(MacProcCellStop, pst, mBuf);
124 case EVENT_MAC_DL_CCCH_IND:
126 /* Process DL CCCH Ind */
127 unpackMacDlCcchInd(MacProcDlCcchInd, pst, mBuf);
130 case EVENT_MAC_UE_CREATE_REQ:
132 /* Process Ue Create Request */
133 unpackMacUeCreateReq(MacProcUeCreateReq, pst, mBuf);
136 case EVENT_MAC_UE_RECONFIG_REQ:
138 /* Process Ue Reconfig Request */
139 unpackMacUeReconfigReq(MacProcUeReconfigReq, pst, mBuf);
142 case EVENT_MAC_UE_DELETE_REQ:
144 /* Process UE Delete Request */
145 unpackMacUeDeleteReq(MacProcUeDeleteReq, pst, mBuf);
148 case EVENT_MAC_CELL_DELETE_REQ:
150 /* Process Cell Delete Request */
151 unpackMacCellDeleteReq(MacProcCellDeleteReq, pst, mBuf);
154 case EVENT_MAC_SLICE_CFG_REQ:
156 /* Process Slice Configuration Request */
157 unpackMacSliceCfgReq(MacProcSliceCfgReq, pst, mBuf);
160 case EVENT_MAC_SLICE_RECFG_REQ:
162 /* Process Slice Reconfiguration Request */
163 unpackMacSliceCfgReq(MacProcSliceReCfgReq, pst, mBuf);
166 case EVENT_MAC_RACH_RESOURCE_REQ:
168 /* Process Rach Resource Request */
169 unpackMacRachRsrcReq(MacProcRachRsrcReq, pst, mBuf);
181 * @brief Task Activation callback function Entity NH.
185 * Function : rgHdlNHEvents
187 * Process Messages received from Entity NH
189 * @param[in] Pst *pst, Post structure of the primitive.
190 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
191 * @param[in] Reason reason.
194 static inline void rgHdlNHEvents
196 Pst *pst, /* post structure */
197 Buffer *mBuf /* message buffer */
204 cmUnpkCrgBndReq(RgUiCrgBndReq, pst, mBuf);
207 cmUnpkCrgUbndReq(RgUiCrgUbndReq, pst, mBuf);
210 cmUnpkCrgCfgReq(RgUiCrgCfgReq, pst, mBuf);
220 * @brief Task Activation callback function Entity KW.
224 * Function : rgHdlKWEvents
226 * Process Messages received from Entity KW
228 * @param[in] Pst *pst, Post structure of the primitive.
229 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
230 * @param[in] Reason reason.
233 static inline void rgHdlKWEvents
235 Pst *pst, /* post structure */
236 Buffer *mBuf /* message buffer */
243 cmUnpkRguBndReq(RgUiRguBndReq, pst, mBuf);
246 cmUnpkRguUbndReq(RgUiRguUbndReq, pst, mBuf);
248 case EVENT_DL_DATA_TO_MAC:
249 unpackRlcDlData(MacProcRlcDlData, pst, mBuf);
251 case EVENT_BO_STATUS_TO_MAC:
252 unpackRlcBoStatus(MacProcRlcBoStatus, pst, mBuf);
256 case EVTRGUL2MULTHRPMEASREQ:
257 cmUnpkRguL2MUlThrpMeasReq(RgUiRguL2MUlThrpMeasReq, pst,mBuf);
269 * @brief Task Activation callback function Entity TF.
273 * Function : rgHdlTFEvents
275 * Process Messages received from Entity TF
277 * @param[in] Pst *pst, Post structure of the primitive.
278 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
279 * @param[in] Reason reason.
282 static inline void rgHdlTFEvents
284 Pst *pst, /* post structure */
285 Buffer *mBuf /* message buffer */
290 case EVENT_SLOT_IND_TO_MAC:
291 unpackSlotInd(fapiMacSlotInd, pst, mBuf);
293 case EVENT_STOP_IND_TO_MAC:
294 unpackStopInd(fapiMacStopInd, pst, mBuf);
296 case EVENT_RACH_IND_TO_MAC:
297 unpackRachInd(fapiMacRachInd, pst, mBuf);
299 case EVENT_CRC_IND_TO_MAC:
300 unpackCrcInd(fapiMacCrcInd, pst, mBuf);
302 case EVENT_RX_DATA_IND_TO_MAC:
303 unpackRxDataInd(fapiMacRxDataInd, pst, mBuf);
305 case EVENT_UCI_IND_TO_MAC:
306 unpackUciInd(FapiMacUciInd, pst, mBuf);
316 * @brief Task Activation callback function Entity RG SCH.
320 * Function : rgHdlRGEvents
322 * Process Messages received from Entity RG SCH
324 * @param[in] Pst *pst, Post structure of the primitive.
325 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
326 * @param[in] Reason reason.
329 static inline void rgHdlRGEvents
331 Pst *pst, /* post structure */
332 Buffer *mBuf /* message buffer */
338 case EVTINFCELLREGREQ:
339 cmUnpkSchMacCellRegReq(RgSchMacCellRegReq, pst, mBuf);
341 case EVTINFSFALLOCREQ:
342 cmUnpkSchMacSfAllocReq(RgSchMacSfAllocReq, pst, mBuf);
345 cmUnpkSchMacRlsHqReq(RgSchMacRlsHqReq, pst, mBuf);
347 case EVTINFHQENTRESET:
348 cmUnpkSchMacRstHqEntReq(RgSchMacRstHqEntReq, pst, mBuf);
350 case EVTINFRLSRNTIREQ:
351 cmUnpkSchMacRlsRntiReq(RgSchMacRlsRntiReq, pst, mBuf);
355 cmUnpkSchMacSpsLcRegReq(RgSchMacSpsLcRegReq, pst, mBuf);
357 case EVTINFSPSLCDEREG:
358 cmUnpkSchMacSpsLcDeregReq(RgSchMacSpsLcDeregReq, pst, mBuf);
361 cmUnpkSchMacUlSpsResetReq(RgSchMacUlSpsResetReq, pst, mBuf);
363 #endif /* LTEMAC_SPS */
365 case EVTINFL2MEASREQ:
366 cmUnpkSchMacL2MeasReq(RgSchMacL2MeasReq, pst, mBuf);
368 case EVTINFL2MEASSENDREQ :
369 cmUnpkSchMacL2MeasSendReq(RgSchMacL2MeasSendReq, pst , mBuf);
371 case EVTINFL2MEASSTOPREQ:
372 cmUnpkSchMacL2MeasStopReq(RgSchMacL2MeasStopReq, pst , mBuf);
374 #endif/* LTE_L2_MEAS */
376 cmUnpkSchMacLcgRegReq(RgSchMacLcgRegReq, pst, mBuf);
379 #if defined(LTE_ADV) && defined(LCPRG)
380 case EVTPRGUESCELLCFGREQ:
382 cmUnpkPrgPMacSMacUeSCellCfgReq(RgPrgPMacSMacUeSCellCfgReq, pst, mBuf);
385 case EVTPRGUESCELLCFGCFM:
386 case EVTPRGUESCELLLCHMODCFM:
387 case EVTPRGUESCELLLCHDELCFMDEL:
388 case EVTPRGUESCELLLCHADDCFM:
390 cmUnpkPrgSMacPMacCfgCfm(RgPrgSMacPMacCfgCfm, pst, mBuf);
393 case EVTPRGUESCELLDELREQ:
395 cmUnpkPrgPMacSMacUeSCellDelReq(RgPrgPMacSMacUeSCellDelReq, pst, mBuf);
398 case EVTPRGUESCELLLCHMODREQ:
400 cmUnpkPrgPMacSMacUeSCellLchModReq(RgPrgPMacSMacUeSCellLchModReq, pst,
404 case EVTPRGUESCELLLCHDELREQ:
406 cmUnpkPrgPMacSMacUeSCellLchDelReq(RgPrgPMacSMacUeSCellLchDelReq, pst,
410 case EVTPRGUESCELLLCHADDREQ:
412 cmUnpkPrgPMacSMacUeSCellLchAddReq(RgPrgPMacSMacUeSCellLchAddReq, pst,
428 * @brief Function prints src, dest, msg infor about all the msgs that received.
432 * Function : callFlowRgActvTsk
434 * Function prints src, dest, msg infor about all the msgs that received
436 * @param[in] Pst *pst, Post structure of the primitive.
441 void callFlowRgActvTsk(Pst *pst)
444 char destTask[50]="ENTMAC";
451 strcpy(sourceTask,"ENTDUAPP");
456 strcpy(message,"EVTLRGCFGREQ");
458 case EVTMACSCHGENCFGREQ:
459 strcpy(message,"EVTMACSCHGENCFGREQ");
462 strcpy(message,"EVTLRGCNTRLREQ");
465 strcpy(message,"EVTLRGSSTAREQ");
468 strcpy(message,"EVTLRGSTSREQ");
470 #endif /* LCRGMILRG */
471 case EVENT_MAC_CELL_CONFIG_REQ:
472 strcpy(message,"EVENT_MAC_CELL_CONFIG_REQ");
474 case EVENT_MAC_CELL_START:
475 strcpy(message,"EVENT_MAC_CELL_START");
477 case EVENT_MAC_CELL_STOP:
478 strcpy(message,"EVENT_MAC_CELL_STOP");
480 case EVENT_MAC_DL_CCCH_IND:
481 strcpy(message,"EVENT_MAC_DL_CCCH_IND");
483 case EVENT_MAC_UE_CREATE_REQ:
484 strcpy(message,"EVENT_MAC_UE_CREATE_REQ");
486 case EVENT_MAC_UE_RECONFIG_REQ:
487 strcpy(message,"EVENT_MAC_UE_RECONFIG_REQ");
489 case EVENT_MAC_UE_DELETE_REQ:
490 strcpy(message,"EVENT_MAC_UE_DELETE_REQ");
492 case EVENT_MAC_CELL_DELETE_REQ:
493 strcpy(message,"EVENT_MAC_CELL_DELETE_REQ");
495 case EVENT_MAC_SLICE_CFG_REQ:
496 strcpy(message,"EVENT_MAC_SLICE_CFG_REQ");
498 case EVENT_MAC_SLICE_RECFG_REQ:
499 strcpy(message,"EVENT_MAC_SLICE_RECFG_REQ");
502 strcpy(message,"Invalid Event");
509 strcpy(sourceTask,"ENTRLC");
514 strcpy(message,"EVTRGUBNDREQ");
517 strcpy(message,"EVTRGUUBNDREQ");
519 case EVENT_DL_DATA_TO_MAC:
520 strcpy(message,"EVENT_DL_DATA_TO_MAC");
522 case EVENT_BO_STATUS_TO_MAC:
523 strcpy(message,"EVENT_BO_STATUS_TO_MAC");
527 strcpy(message,"Invalid Event");
535 strcpy(sourceTask,"ENTLWRMAC");
538 case EVENT_SLOT_IND_TO_MAC:
539 strcpy(message,"EVENT_SLOT_IND_TO_MAC");
541 case EVENT_STOP_IND_TO_MAC:
542 strcpy(message,"EVENT_STOP_IND_TO_MAC");
544 case EVENT_RACH_IND_TO_MAC:
545 strcpy(message,"EVENT_RACH_IND_TO_MAC");
547 case EVENT_CRC_IND_TO_MAC:
548 strcpy(message,"EVENT_CRC_IND_TO_MAC");
550 case EVENT_RX_DATA_IND_TO_MAC:
551 strcpy(message,"EVENT_RX_DATA_IND_TO_MAC");
553 case EVENT_UCI_IND_TO_MAC:
554 strcpy(message,"EVENT_UCI_IND_TO_MAC");
557 strcpy(message,"Invalid Event");
563 case ENTMAC: /* When scheduler instance sends msg to MAC */
565 strcpy(sourceTask,"ENTMAC");
569 case EVTINFCELLREGREQ:
570 strcpy(message,"EVTINFCELLREGREQ");
572 case EVTINFSFALLOCREQ:
573 strcpy(message,"EVTINFSFALLOCREQ");
576 strcpy(message,"EVTINFRLSHQREQ");
578 case EVTINFHQENTRESET:
579 strcpy(message,"EVTINFHQENTRESET");
581 case EVTINFRLSRNTIREQ:
582 strcpy(message,"EVTINFRLSRNTIREQ");
586 strcpy(message,"EVTINFSPSLCREG");
588 case EVTINFSPSLCDEREG:
589 strcpy(message,"EVTINFSPSLCDEREG");
592 strcpy(message,"EVTINFSPSRESET");
594 #endif /* LTEMAC_SPS */
596 strcpy(message,"EVTINFLCGREG");
599 #if defined(LTE_ADV) && defined(LCPRG)
600 case EVTPRGUESCELLCFGREQ:
601 strcpy(message,"EVTPRGUESCELLCFGREQ");
603 case EVTPRGUESCELLCFGCFM:
604 strcpy(message,"EVTPRGUESCELLCFGCFM");
606 case EVTPRGUESCELLLCHMODCFM:
607 strcpy(message,"EVTPRGUESCELLLCHMODCFM");
609 case EVTPRGUESCELLLCHDELCFMDEL:
610 strcpy(message,"EVTPRGUESCELLLCHDELCFMDEL");
612 case EVTPRGUESCELLLCHADDCFM:
613 strcpy(message,"EVTPRGUESCELLLCHADDCFM");
615 case EVTPRGUESCELLDELREQ:
616 strcpy(message,"EVTPRGUESCELLDELREQ");
618 case EVTPRGUESCELLLCHMODREQ:
619 strcpy(message,"EVTPRGUESCELLLCHMODREQ");
621 case EVTPRGUESCELLLCHDELREQ:
622 strcpy(message,"EVTPRGUESCELLLCHDELREQ");
624 case EVTPRGUESCELLLCHADDREQ:
625 strcpy(message,"EVTPRGUESCELLLCHADDREQ");
630 strcpy(message,"Invalid Event");
638 strcpy(sourceTask,"Invalid Source Entity Id");
642 DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
646 /**********************************************************************
649 * @brief Task Activation callback function.
653 * Function : rgActvTsk
655 * Primitives invoked by MAC's users/providers through
656 * a loosely coupled interface arrive here by means of
657 * SSI's message handling. This API is registered with
658 * SSI during the Task Registration of MAC.
660 * @param[in] Pst *pst, Post structure of the primitive.
661 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
662 * @param[in] Reason reason.
668 Pst *pst, /* post structure */
669 Buffer *mBuf /* message buffer */
673 #ifdef CALL_FLOW_DEBUG_LOG
674 callFlowRgActvTsk(pst);
679 /* The originator of this message is the stack manager,
680 * unpack and go to the respective primitive processing function */
682 rgHdlSMEvents(pst, mBuf);
685 rgHdlNHEvents(pst, mBuf);
688 rgHdlKWEvents(pst, mBuf);
691 rgHdlTFEvents(pst, mBuf);
693 case ENTMAC: /* When scheduler instance sends msg to MAC */
694 rgHdlRGEvents(pst, mBuf);
702 }/* end of rgActvTsk */
705 /**********************************************************************
708 **********************************************************************/