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);
172 case EVENT_MAC_DL_PCCH_IND:
174 /* Process Pcch indication */
175 unpackMacDlPcchInd(MacProcDlPcchInd, pst, mBuf);
187 * @brief Task Activation callback function Entity NH.
191 * Function : rgHdlNHEvents
193 * Process Messages received from Entity NH
195 * @param[in] Pst *pst, Post structure of the primitive.
196 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
197 * @param[in] Reason reason.
200 static inline void rgHdlNHEvents
202 Pst *pst, /* post structure */
203 Buffer *mBuf /* message buffer */
210 cmUnpkCrgBndReq(RgUiCrgBndReq, pst, mBuf);
213 cmUnpkCrgUbndReq(RgUiCrgUbndReq, pst, mBuf);
216 cmUnpkCrgCfgReq(RgUiCrgCfgReq, pst, mBuf);
226 * @brief Task Activation callback function Entity KW.
230 * Function : rgHdlKWEvents
232 * Process Messages received from Entity KW
234 * @param[in] Pst *pst, Post structure of the primitive.
235 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
236 * @param[in] Reason reason.
239 static inline void rgHdlKWEvents
241 Pst *pst, /* post structure */
242 Buffer *mBuf /* message buffer */
249 cmUnpkRguBndReq(RgUiRguBndReq, pst, mBuf);
252 cmUnpkRguUbndReq(RgUiRguUbndReq, pst, mBuf);
254 case EVENT_DL_DATA_TO_MAC:
255 unpackRlcDlData(MacProcRlcDlData, pst, mBuf);
257 case EVENT_BO_STATUS_TO_MAC:
258 unpackRlcBoStatus(MacProcRlcBoStatus, pst, mBuf);
262 case EVTRGUL2MULTHRPMEASREQ:
263 cmUnpkRguL2MUlThrpMeasReq(RgUiRguL2MUlThrpMeasReq, pst,mBuf);
275 * @brief Task Activation callback function Entity TF.
279 * Function : rgHdlTFEvents
281 * Process Messages received from Entity TF
283 * @param[in] Pst *pst, Post structure of the primitive.
284 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
285 * @param[in] Reason reason.
288 static inline void rgHdlTFEvents
290 Pst *pst, /* post structure */
291 Buffer *mBuf /* message buffer */
296 case EVENT_SLOT_IND_TO_MAC:
297 unpackSlotInd(fapiMacSlotInd, pst, mBuf);
299 case EVENT_STOP_IND_TO_MAC:
300 unpackStopInd(fapiMacStopInd, pst, mBuf);
302 case EVENT_RACH_IND_TO_MAC:
303 unpackRachInd(fapiMacRachInd, pst, mBuf);
305 case EVENT_CRC_IND_TO_MAC:
306 unpackCrcInd(fapiMacCrcInd, pst, mBuf);
308 case EVENT_RX_DATA_IND_TO_MAC:
309 unpackRxDataInd(fapiMacRxDataInd, pst, mBuf);
311 case EVENT_UCI_IND_TO_MAC:
312 unpackUciInd(FapiMacUciInd, pst, mBuf);
322 * @brief Task Activation callback function Entity RG SCH.
326 * Function : rgHdlRGEvents
328 * Process Messages received from Entity RG SCH
330 * @param[in] Pst *pst, Post structure of the primitive.
331 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
332 * @param[in] Reason reason.
335 static inline void rgHdlRGEvents
337 Pst *pst, /* post structure */
338 Buffer *mBuf /* message buffer */
344 case EVTINFCELLREGREQ:
345 cmUnpkSchMacCellRegReq(RgSchMacCellRegReq, pst, mBuf);
347 case EVTINFSFALLOCREQ:
348 cmUnpkSchMacSfAllocReq(RgSchMacSfAllocReq, pst, mBuf);
351 cmUnpkSchMacRlsHqReq(RgSchMacRlsHqReq, pst, mBuf);
353 case EVTINFHQENTRESET:
354 cmUnpkSchMacRstHqEntReq(RgSchMacRstHqEntReq, pst, mBuf);
356 case EVTINFRLSRNTIREQ:
357 cmUnpkSchMacRlsRntiReq(RgSchMacRlsRntiReq, pst, mBuf);
361 cmUnpkSchMacSpsLcRegReq(RgSchMacSpsLcRegReq, pst, mBuf);
363 case EVTINFSPSLCDEREG:
364 cmUnpkSchMacSpsLcDeregReq(RgSchMacSpsLcDeregReq, pst, mBuf);
367 cmUnpkSchMacUlSpsResetReq(RgSchMacUlSpsResetReq, pst, mBuf);
369 #endif /* LTEMAC_SPS */
371 case EVTINFL2MEASREQ:
372 cmUnpkSchMacL2MeasReq(RgSchMacL2MeasReq, pst, mBuf);
374 case EVTINFL2MEASSENDREQ :
375 cmUnpkSchMacL2MeasSendReq(RgSchMacL2MeasSendReq, pst , mBuf);
377 case EVTINFL2MEASSTOPREQ:
378 cmUnpkSchMacL2MeasStopReq(RgSchMacL2MeasStopReq, pst , mBuf);
380 #endif/* LTE_L2_MEAS */
382 cmUnpkSchMacLcgRegReq(RgSchMacLcgRegReq, pst, mBuf);
385 #if defined(LTE_ADV) && defined(LCPRG)
386 case EVTPRGUESCELLCFGREQ:
388 cmUnpkPrgPMacSMacUeSCellCfgReq(RgPrgPMacSMacUeSCellCfgReq, pst, mBuf);
391 case EVTPRGUESCELLCFGCFM:
392 case EVTPRGUESCELLLCHMODCFM:
393 case EVTPRGUESCELLLCHDELCFMDEL:
394 case EVTPRGUESCELLLCHADDCFM:
396 cmUnpkPrgSMacPMacCfgCfm(RgPrgSMacPMacCfgCfm, pst, mBuf);
399 case EVTPRGUESCELLDELREQ:
401 cmUnpkPrgPMacSMacUeSCellDelReq(RgPrgPMacSMacUeSCellDelReq, pst, mBuf);
404 case EVTPRGUESCELLLCHMODREQ:
406 cmUnpkPrgPMacSMacUeSCellLchModReq(RgPrgPMacSMacUeSCellLchModReq, pst,
410 case EVTPRGUESCELLLCHDELREQ:
412 cmUnpkPrgPMacSMacUeSCellLchDelReq(RgPrgPMacSMacUeSCellLchDelReq, pst,
416 case EVTPRGUESCELLLCHADDREQ:
418 cmUnpkPrgPMacSMacUeSCellLchAddReq(RgPrgPMacSMacUeSCellLchAddReq, pst,
434 * @brief Function prints src, dest, msg infor about all the msgs that received.
438 * Function : callFlowRgActvTsk
440 * Function prints src, dest, msg infor about all the msgs that received
442 * @param[in] Pst *pst, Post structure of the primitive.
447 void callFlowRgActvTsk(Pst *pst)
450 char destTask[50]="ENTMAC";
457 strcpy(sourceTask,"ENTDUAPP");
462 strcpy(message,"EVTLRGCFGREQ");
464 case EVTMACSCHGENCFGREQ:
465 strcpy(message,"EVTMACSCHGENCFGREQ");
468 strcpy(message,"EVTLRGCNTRLREQ");
471 strcpy(message,"EVTLRGSSTAREQ");
474 strcpy(message,"EVTLRGSTSREQ");
476 #endif /* LCRGMILRG */
477 case EVENT_MAC_CELL_CONFIG_REQ:
478 strcpy(message,"EVENT_MAC_CELL_CONFIG_REQ");
480 case EVENT_MAC_CELL_START:
481 strcpy(message,"EVENT_MAC_CELL_START");
483 case EVENT_MAC_CELL_STOP:
484 strcpy(message,"EVENT_MAC_CELL_STOP");
486 case EVENT_MAC_DL_CCCH_IND:
487 strcpy(message,"EVENT_MAC_DL_CCCH_IND");
489 case EVENT_MAC_UE_CREATE_REQ:
490 strcpy(message,"EVENT_MAC_UE_CREATE_REQ");
492 case EVENT_MAC_UE_RECONFIG_REQ:
493 strcpy(message,"EVENT_MAC_UE_RECONFIG_REQ");
495 case EVENT_MAC_UE_DELETE_REQ:
496 strcpy(message,"EVENT_MAC_UE_DELETE_REQ");
498 case EVENT_MAC_CELL_DELETE_REQ:
499 strcpy(message,"EVENT_MAC_CELL_DELETE_REQ");
501 case EVENT_MAC_SLICE_CFG_REQ:
502 strcpy(message,"EVENT_MAC_SLICE_CFG_REQ");
504 case EVENT_MAC_SLICE_RECFG_REQ:
505 strcpy(message,"EVENT_MAC_SLICE_RECFG_REQ");
508 strcpy(message,"Invalid Event");
515 strcpy(sourceTask,"ENTRLC");
520 strcpy(message,"EVTRGUBNDREQ");
523 strcpy(message,"EVTRGUUBNDREQ");
525 case EVENT_DL_DATA_TO_MAC:
526 strcpy(message,"EVENT_DL_DATA_TO_MAC");
528 case EVENT_BO_STATUS_TO_MAC:
529 strcpy(message,"EVENT_BO_STATUS_TO_MAC");
533 strcpy(message,"Invalid Event");
541 strcpy(sourceTask,"ENTLWRMAC");
544 case EVENT_SLOT_IND_TO_MAC:
545 strcpy(message,"EVENT_SLOT_IND_TO_MAC");
547 case EVENT_STOP_IND_TO_MAC:
548 strcpy(message,"EVENT_STOP_IND_TO_MAC");
550 case EVENT_RACH_IND_TO_MAC:
551 strcpy(message,"EVENT_RACH_IND_TO_MAC");
553 case EVENT_CRC_IND_TO_MAC:
554 strcpy(message,"EVENT_CRC_IND_TO_MAC");
556 case EVENT_RX_DATA_IND_TO_MAC:
557 strcpy(message,"EVENT_RX_DATA_IND_TO_MAC");
559 case EVENT_UCI_IND_TO_MAC:
560 strcpy(message,"EVENT_UCI_IND_TO_MAC");
563 strcpy(message,"Invalid Event");
569 case ENTMAC: /* When scheduler instance sends msg to MAC */
571 strcpy(sourceTask,"ENTMAC");
575 case EVTINFCELLREGREQ:
576 strcpy(message,"EVTINFCELLREGREQ");
578 case EVTINFSFALLOCREQ:
579 strcpy(message,"EVTINFSFALLOCREQ");
582 strcpy(message,"EVTINFRLSHQREQ");
584 case EVTINFHQENTRESET:
585 strcpy(message,"EVTINFHQENTRESET");
587 case EVTINFRLSRNTIREQ:
588 strcpy(message,"EVTINFRLSRNTIREQ");
592 strcpy(message,"EVTINFSPSLCREG");
594 case EVTINFSPSLCDEREG:
595 strcpy(message,"EVTINFSPSLCDEREG");
598 strcpy(message,"EVTINFSPSRESET");
600 #endif /* LTEMAC_SPS */
602 strcpy(message,"EVTINFLCGREG");
605 #if defined(LTE_ADV) && defined(LCPRG)
606 case EVTPRGUESCELLCFGREQ:
607 strcpy(message,"EVTPRGUESCELLCFGREQ");
609 case EVTPRGUESCELLCFGCFM:
610 strcpy(message,"EVTPRGUESCELLCFGCFM");
612 case EVTPRGUESCELLLCHMODCFM:
613 strcpy(message,"EVTPRGUESCELLLCHMODCFM");
615 case EVTPRGUESCELLLCHDELCFMDEL:
616 strcpy(message,"EVTPRGUESCELLLCHDELCFMDEL");
618 case EVTPRGUESCELLLCHADDCFM:
619 strcpy(message,"EVTPRGUESCELLLCHADDCFM");
621 case EVTPRGUESCELLDELREQ:
622 strcpy(message,"EVTPRGUESCELLDELREQ");
624 case EVTPRGUESCELLLCHMODREQ:
625 strcpy(message,"EVTPRGUESCELLLCHMODREQ");
627 case EVTPRGUESCELLLCHDELREQ:
628 strcpy(message,"EVTPRGUESCELLLCHDELREQ");
630 case EVTPRGUESCELLLCHADDREQ:
631 strcpy(message,"EVTPRGUESCELLLCHADDREQ");
636 strcpy(message,"Invalid Event");
644 strcpy(sourceTask,"Invalid Source Entity Id");
648 DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
652 /**********************************************************************
655 * @brief Task Activation callback function.
659 * Function : rgActvTsk
661 * Primitives invoked by MAC's users/providers through
662 * a loosely coupled interface arrive here by means of
663 * SSI's message handling. This API is registered with
664 * SSI during the Task Registration of MAC.
666 * @param[in] Pst *pst, Post structure of the primitive.
667 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
668 * @param[in] Reason reason.
674 Pst *pst, /* post structure */
675 Buffer *mBuf /* message buffer */
679 #ifdef CALL_FLOW_DEBUG_LOG
680 callFlowRgActvTsk(pst);
685 /* The originator of this message is the stack manager,
686 * unpack and go to the respective primitive processing function */
688 rgHdlSMEvents(pst, mBuf);
691 rgHdlNHEvents(pst, mBuf);
694 rgHdlKWEvents(pst, mBuf);
697 rgHdlTFEvents(pst, mBuf);
699 case ENTMAC: /* When scheduler instance sends msg to MAC */
700 rgHdlRGEvents(pst, mBuf);
708 }/* end of rgActvTsk */
711 /**********************************************************************
714 **********************************************************************/