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 unpackMacSliceRecfgReq(MacProcSliceRecfgReq, pst, mBuf);
166 case EVENT_MAC_RACH_RESOURCE_REQ:
168 /* Process Rach Resource Request */
169 unpackMacRachRsrcReq(MacProcRachRsrcReq, pst, mBuf);
172 case EVENT_MAC_RACH_RESOURCE_REL:
174 /* Process Rach Resource Release */
175 unpackMacRachRsrcRel(MacProcRachRsrcRel, pst, mBuf);
178 case EVENT_MAC_DL_PCCH_IND:
180 /* Process Pcch indication */
181 unpackMacDlPcchInd(MacProcDlPcchInd, pst, mBuf);
193 * @brief Task Activation callback function Entity NH.
197 * Function : rgHdlNHEvents
199 * Process Messages received from Entity NH
201 * @param[in] Pst *pst, Post structure of the primitive.
202 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
203 * @param[in] Reason reason.
206 static inline void rgHdlNHEvents
208 Pst *pst, /* post structure */
209 Buffer *mBuf /* message buffer */
216 cmUnpkCrgBndReq(RgUiCrgBndReq, pst, mBuf);
219 cmUnpkCrgUbndReq(RgUiCrgUbndReq, pst, mBuf);
222 cmUnpkCrgCfgReq(RgUiCrgCfgReq, pst, mBuf);
232 * @brief Task Activation callback function Entity KW.
236 * Function : rgHdlKWEvents
238 * Process Messages received from Entity KW
240 * @param[in] Pst *pst, Post structure of the primitive.
241 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
242 * @param[in] Reason reason.
245 static inline void rgHdlKWEvents
247 Pst *pst, /* post structure */
248 Buffer *mBuf /* message buffer */
255 cmUnpkRguBndReq(RgUiRguBndReq, pst, mBuf);
258 cmUnpkRguUbndReq(RgUiRguUbndReq, pst, mBuf);
260 case EVENT_DL_DATA_TO_MAC:
261 unpackRlcDlData(MacProcRlcDlData, pst, mBuf);
263 case EVENT_BO_STATUS_TO_MAC:
264 unpackRlcBoStatus(MacProcRlcBoStatus, pst, mBuf);
268 case EVTRGUL2MULTHRPMEASREQ:
269 cmUnpkRguL2MUlThrpMeasReq(RgUiRguL2MUlThrpMeasReq, pst,mBuf);
281 * @brief Task Activation callback function Entity TF.
285 * Function : rgHdlTFEvents
287 * Process Messages received from Entity TF
289 * @param[in] Pst *pst, Post structure of the primitive.
290 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
291 * @param[in] Reason reason.
294 static inline void rgHdlTFEvents
296 Pst *pst, /* post structure */
297 Buffer *mBuf /* message buffer */
302 case EVENT_SLOT_IND_TO_MAC:
303 unpackSlotInd(fapiMacSlotInd, pst, mBuf);
305 case EVENT_STOP_IND_TO_MAC:
306 unpackStopInd(fapiMacStopInd, pst, mBuf);
308 case EVENT_RACH_IND_TO_MAC:
309 unpackRachInd(fapiMacRachInd, pst, mBuf);
311 case EVENT_CRC_IND_TO_MAC:
312 unpackCrcInd(fapiMacCrcInd, pst, mBuf);
314 case EVENT_RX_DATA_IND_TO_MAC:
315 unpackRxDataInd(fapiMacRxDataInd, pst, mBuf);
317 case EVENT_UCI_IND_TO_MAC:
318 unpackUciInd(FapiMacUciInd, pst, mBuf);
328 * @brief Task Activation callback function Entity RG SCH.
332 * Function : rgHdlRGEvents
334 * Process Messages received from Entity RG SCH
336 * @param[in] Pst *pst, Post structure of the primitive.
337 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
338 * @param[in] Reason reason.
341 static inline void rgHdlRGEvents
343 Pst *pst, /* post structure */
344 Buffer *mBuf /* message buffer */
350 case EVTINFCELLREGREQ:
351 cmUnpkSchMacCellRegReq(RgSchMacCellRegReq, pst, mBuf);
353 case EVTINFSFALLOCREQ:
354 cmUnpkSchMacSfAllocReq(RgSchMacSfAllocReq, pst, mBuf);
357 cmUnpkSchMacRlsHqReq(RgSchMacRlsHqReq, pst, mBuf);
359 case EVTINFHQENTRESET:
360 cmUnpkSchMacRstHqEntReq(RgSchMacRstHqEntReq, pst, mBuf);
362 case EVTINFRLSRNTIREQ:
363 cmUnpkSchMacRlsRntiReq(RgSchMacRlsRntiReq, pst, mBuf);
367 cmUnpkSchMacSpsLcRegReq(RgSchMacSpsLcRegReq, pst, mBuf);
369 case EVTINFSPSLCDEREG:
370 cmUnpkSchMacSpsLcDeregReq(RgSchMacSpsLcDeregReq, pst, mBuf);
373 cmUnpkSchMacUlSpsResetReq(RgSchMacUlSpsResetReq, pst, mBuf);
375 #endif /* LTEMAC_SPS */
377 case EVTINFL2MEASREQ:
378 cmUnpkSchMacL2MeasReq(RgSchMacL2MeasReq, pst, mBuf);
380 case EVTINFL2MEASSENDREQ :
381 cmUnpkSchMacL2MeasSendReq(RgSchMacL2MeasSendReq, pst , mBuf);
383 case EVTINFL2MEASSTOPREQ:
384 cmUnpkSchMacL2MeasStopReq(RgSchMacL2MeasStopReq, pst , mBuf);
386 #endif/* LTE_L2_MEAS */
388 cmUnpkSchMacLcgRegReq(RgSchMacLcgRegReq, pst, mBuf);
391 #if defined(LTE_ADV) && defined(LCPRG)
392 case EVTPRGUESCELLCFGREQ:
394 cmUnpkPrgPMacSMacUeSCellCfgReq(RgPrgPMacSMacUeSCellCfgReq, pst, mBuf);
397 case EVTPRGUESCELLCFGCFM:
398 case EVTPRGUESCELLLCHMODCFM:
399 case EVTPRGUESCELLLCHDELCFMDEL:
400 case EVTPRGUESCELLLCHADDCFM:
402 cmUnpkPrgSMacPMacCfgCfm(RgPrgSMacPMacCfgCfm, pst, mBuf);
405 case EVTPRGUESCELLDELREQ:
407 cmUnpkPrgPMacSMacUeSCellDelReq(RgPrgPMacSMacUeSCellDelReq, pst, mBuf);
410 case EVTPRGUESCELLLCHMODREQ:
412 cmUnpkPrgPMacSMacUeSCellLchModReq(RgPrgPMacSMacUeSCellLchModReq, pst,
416 case EVTPRGUESCELLLCHDELREQ:
418 cmUnpkPrgPMacSMacUeSCellLchDelReq(RgPrgPMacSMacUeSCellLchDelReq, pst,
422 case EVTPRGUESCELLLCHADDREQ:
424 cmUnpkPrgPMacSMacUeSCellLchAddReq(RgPrgPMacSMacUeSCellLchAddReq, pst,
440 * @brief Function prints src, dest, msg infor about all the msgs that received.
444 * Function : callFlowRgActvTsk
446 * Function prints src, dest, msg infor about all the msgs that received
448 * @param[in] Pst *pst, Post structure of the primitive.
453 void callFlowRgActvTsk(Pst *pst)
456 char destTask[50]="ENTMAC";
463 strcpy(sourceTask,"ENTDUAPP");
468 strcpy(message,"EVTLRGCFGREQ");
470 case EVTMACSCHGENCFGREQ:
471 strcpy(message,"EVTMACSCHGENCFGREQ");
474 strcpy(message,"EVTLRGCNTRLREQ");
477 strcpy(message,"EVTLRGSSTAREQ");
480 strcpy(message,"EVTLRGSTSREQ");
482 #endif /* LCRGMILRG */
483 case EVENT_MAC_CELL_CONFIG_REQ:
484 strcpy(message,"EVENT_MAC_CELL_CONFIG_REQ");
486 case EVENT_MAC_CELL_START:
487 strcpy(message,"EVENT_MAC_CELL_START");
489 case EVENT_MAC_CELL_STOP:
490 strcpy(message,"EVENT_MAC_CELL_STOP");
492 case EVENT_MAC_DL_CCCH_IND:
493 strcpy(message,"EVENT_MAC_DL_CCCH_IND");
495 case EVENT_MAC_UE_CREATE_REQ:
496 strcpy(message,"EVENT_MAC_UE_CREATE_REQ");
498 case EVENT_MAC_UE_RECONFIG_REQ:
499 strcpy(message,"EVENT_MAC_UE_RECONFIG_REQ");
501 case EVENT_MAC_UE_DELETE_REQ:
502 strcpy(message,"EVENT_MAC_UE_DELETE_REQ");
504 case EVENT_MAC_CELL_DELETE_REQ:
505 strcpy(message,"EVENT_MAC_CELL_DELETE_REQ");
507 case EVENT_MAC_SLICE_CFG_REQ:
508 strcpy(message,"EVENT_MAC_SLICE_CFG_REQ");
510 case EVENT_MAC_SLICE_RECFG_REQ:
511 strcpy(message,"EVENT_MAC_SLICE_RECFG_REQ");
514 strcpy(message,"Invalid Event");
521 strcpy(sourceTask,"ENTRLC");
526 strcpy(message,"EVTRGUBNDREQ");
529 strcpy(message,"EVTRGUUBNDREQ");
531 case EVENT_DL_DATA_TO_MAC:
532 strcpy(message,"EVENT_DL_DATA_TO_MAC");
534 case EVENT_BO_STATUS_TO_MAC:
535 strcpy(message,"EVENT_BO_STATUS_TO_MAC");
539 strcpy(message,"Invalid Event");
547 strcpy(sourceTask,"ENTLWRMAC");
550 case EVENT_SLOT_IND_TO_MAC:
551 strcpy(message,"EVENT_SLOT_IND_TO_MAC");
553 case EVENT_STOP_IND_TO_MAC:
554 strcpy(message,"EVENT_STOP_IND_TO_MAC");
556 case EVENT_RACH_IND_TO_MAC:
557 strcpy(message,"EVENT_RACH_IND_TO_MAC");
559 case EVENT_CRC_IND_TO_MAC:
560 strcpy(message,"EVENT_CRC_IND_TO_MAC");
562 case EVENT_RX_DATA_IND_TO_MAC:
563 strcpy(message,"EVENT_RX_DATA_IND_TO_MAC");
565 case EVENT_UCI_IND_TO_MAC:
566 strcpy(message,"EVENT_UCI_IND_TO_MAC");
569 strcpy(message,"Invalid Event");
575 case ENTMAC: /* When scheduler instance sends msg to MAC */
577 strcpy(sourceTask,"ENTMAC");
581 case EVTINFCELLREGREQ:
582 strcpy(message,"EVTINFCELLREGREQ");
584 case EVTINFSFALLOCREQ:
585 strcpy(message,"EVTINFSFALLOCREQ");
588 strcpy(message,"EVTINFRLSHQREQ");
590 case EVTINFHQENTRESET:
591 strcpy(message,"EVTINFHQENTRESET");
593 case EVTINFRLSRNTIREQ:
594 strcpy(message,"EVTINFRLSRNTIREQ");
598 strcpy(message,"EVTINFSPSLCREG");
600 case EVTINFSPSLCDEREG:
601 strcpy(message,"EVTINFSPSLCDEREG");
604 strcpy(message,"EVTINFSPSRESET");
606 #endif /* LTEMAC_SPS */
608 strcpy(message,"EVTINFLCGREG");
611 #if defined(LTE_ADV) && defined(LCPRG)
612 case EVTPRGUESCELLCFGREQ:
613 strcpy(message,"EVTPRGUESCELLCFGREQ");
615 case EVTPRGUESCELLCFGCFM:
616 strcpy(message,"EVTPRGUESCELLCFGCFM");
618 case EVTPRGUESCELLLCHMODCFM:
619 strcpy(message,"EVTPRGUESCELLLCHMODCFM");
621 case EVTPRGUESCELLLCHDELCFMDEL:
622 strcpy(message,"EVTPRGUESCELLLCHDELCFMDEL");
624 case EVTPRGUESCELLLCHADDCFM:
625 strcpy(message,"EVTPRGUESCELLLCHADDCFM");
627 case EVTPRGUESCELLDELREQ:
628 strcpy(message,"EVTPRGUESCELLDELREQ");
630 case EVTPRGUESCELLLCHMODREQ:
631 strcpy(message,"EVTPRGUESCELLLCHMODREQ");
633 case EVTPRGUESCELLLCHDELREQ:
634 strcpy(message,"EVTPRGUESCELLLCHDELREQ");
636 case EVTPRGUESCELLLCHADDREQ:
637 strcpy(message,"EVTPRGUESCELLLCHADDREQ");
642 strcpy(message,"Invalid Event");
650 strcpy(sourceTask,"Invalid Source Entity Id");
654 DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
658 /**********************************************************************
661 * @brief Task Activation callback function.
665 * Function : rgActvTsk
667 * Primitives invoked by MAC's users/providers through
668 * a loosely coupled interface arrive here by means of
669 * SSI's message handling. This API is registered with
670 * SSI during the Task Registration of MAC.
672 * @param[in] Pst *pst, Post structure of the primitive.
673 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
674 * @param[in] Reason reason.
680 Pst *pst, /* post structure */
681 Buffer *mBuf /* message buffer */
685 #ifdef CALL_FLOW_DEBUG_LOG
686 callFlowRgActvTsk(pst);
691 /* The originator of this message is the stack manager,
692 * unpack and go to the respective primitive processing function */
694 rgHdlSMEvents(pst, mBuf);
697 rgHdlNHEvents(pst, mBuf);
700 rgHdlKWEvents(pst, mBuf);
703 rgHdlTFEvents(pst, mBuf);
705 case ENTMAC: /* When scheduler instance sends msg to MAC */
706 rgHdlRGEvents(pst, mBuf);
714 }/* end of rgActvTsk */
717 /**********************************************************************
720 **********************************************************************/