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:
107 /* Process MAC cell config */
108 unpackDuMacCellCfg(MacProcCellCfgReq, pst, mBuf);
110 case EVENT_MAC_CELL_START:
111 /* Process MAC cell start request */
112 unpackMacCellStart(MacProcCellStart, pst, mBuf);
114 case EVENT_MAC_CELL_STOP:
115 /* Process MAC cell stop request */
116 unpackMacCellStop(MacProcCellStop, pst, mBuf);
118 case EVENT_MAC_DL_CCCH_IND:
119 /* Process DL CCCH Ind */
120 unpackMacDlCcchInd(MacProcDlCcchInd, pst, mBuf);
122 case EVENT_MAC_UE_CREATE_REQ:
123 /* Process Ue Create Request */
124 unpackMacUeCreateReq(MacProcUeCreateReq, pst, mBuf);
126 case EVENT_MAC_UE_RECONFIG_REQ:
127 /* Process Ue Reconfig Request */
128 unpackMacUeReconfigReq(MacProcUeReconfigReq, pst, mBuf);
130 case EVENT_MAC_UE_DELETE_REQ:
132 unpackMacUeDeleteReq(MacProcUeDeleteReq, pst, mBuf);
135 case EVENT_MAC_CELL_DELETE_REQ:
137 unpackMacCellDeleteReq(MacProcCellDeleteReq, pst, mBuf);
140 case EVENT_MAC_SLICE_CFG_REQ:
142 unpackMacSliceCfgReq(MacProcSliceCfgReq, pst, mBuf);
145 case EVENT_MAC_SLICE_RECFG_REQ:
147 unpackMacSliceCfgReq(MacProcSliceReCfgReq, pst, mBuf);
158 * @brief Task Activation callback function Entity NH.
162 * Function : rgHdlNHEvents
164 * Process Messages received from Entity NH
166 * @param[in] Pst *pst, Post structure of the primitive.
167 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
168 * @param[in] Reason reason.
171 static inline void rgHdlNHEvents
173 Pst *pst, /* post structure */
174 Buffer *mBuf /* message buffer */
181 cmUnpkCrgBndReq(RgUiCrgBndReq, pst, mBuf);
184 cmUnpkCrgUbndReq(RgUiCrgUbndReq, pst, mBuf);
187 cmUnpkCrgCfgReq(RgUiCrgCfgReq, pst, mBuf);
197 * @brief Task Activation callback function Entity KW.
201 * Function : rgHdlKWEvents
203 * Process Messages received from Entity KW
205 * @param[in] Pst *pst, Post structure of the primitive.
206 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
207 * @param[in] Reason reason.
210 static inline void rgHdlKWEvents
212 Pst *pst, /* post structure */
213 Buffer *mBuf /* message buffer */
220 cmUnpkRguBndReq(RgUiRguBndReq, pst, mBuf);
223 cmUnpkRguUbndReq(RgUiRguUbndReq, pst, mBuf);
225 case EVENT_DL_DATA_TO_MAC:
226 unpackRlcDlData(MacProcRlcDlData, pst, mBuf);
228 case EVENT_BO_STATUS_TO_MAC:
229 unpackRlcBoStatus(MacProcRlcBoStatus, pst, mBuf);
233 case EVTRGUL2MULTHRPMEASREQ:
234 cmUnpkRguL2MUlThrpMeasReq(RgUiRguL2MUlThrpMeasReq, pst,mBuf);
246 * @brief Task Activation callback function Entity TF.
250 * Function : rgHdlTFEvents
252 * Process Messages received from Entity TF
254 * @param[in] Pst *pst, Post structure of the primitive.
255 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
256 * @param[in] Reason reason.
259 static inline void rgHdlTFEvents
261 Pst *pst, /* post structure */
262 Buffer *mBuf /* message buffer */
267 case EVENT_SLOT_IND_TO_MAC:
268 unpackSlotInd(fapiMacSlotInd, pst, mBuf);
270 case EVENT_STOP_IND_TO_MAC:
271 unpackStopInd(fapiMacStopInd, pst, mBuf);
273 case EVENT_RACH_IND_TO_MAC:
274 unpackRachInd(fapiMacRachInd, pst, mBuf);
276 case EVENT_CRC_IND_TO_MAC:
277 unpackCrcInd(fapiMacCrcInd, pst, mBuf);
279 case EVENT_RX_DATA_IND_TO_MAC:
280 unpackRxDataInd(fapiMacRxDataInd, pst, mBuf);
282 case EVENT_UCI_IND_TO_MAC:
283 unpackUciInd(FapiMacUciInd, pst, mBuf);
293 * @brief Task Activation callback function Entity RG SCH.
297 * Function : rgHdlRGEvents
299 * Process Messages received from Entity RG SCH
301 * @param[in] Pst *pst, Post structure of the primitive.
302 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
303 * @param[in] Reason reason.
306 static inline void rgHdlRGEvents
308 Pst *pst, /* post structure */
309 Buffer *mBuf /* message buffer */
315 case EVTINFCELLREGREQ:
316 cmUnpkSchMacCellRegReq(RgSchMacCellRegReq, pst, mBuf);
318 case EVTINFSFALLOCREQ:
319 cmUnpkSchMacSfAllocReq(RgSchMacSfAllocReq, pst, mBuf);
322 cmUnpkSchMacRlsHqReq(RgSchMacRlsHqReq, pst, mBuf);
324 case EVTINFHQENTRESET:
325 cmUnpkSchMacRstHqEntReq(RgSchMacRstHqEntReq, pst, mBuf);
327 case EVTINFRLSRNTIREQ:
328 cmUnpkSchMacRlsRntiReq(RgSchMacRlsRntiReq, pst, mBuf);
332 cmUnpkSchMacSpsLcRegReq(RgSchMacSpsLcRegReq, pst, mBuf);
334 case EVTINFSPSLCDEREG:
335 cmUnpkSchMacSpsLcDeregReq(RgSchMacSpsLcDeregReq, pst, mBuf);
338 cmUnpkSchMacUlSpsResetReq(RgSchMacUlSpsResetReq, pst, mBuf);
340 #endif /* LTEMAC_SPS */
342 case EVTINFL2MEASREQ:
343 cmUnpkSchMacL2MeasReq(RgSchMacL2MeasReq, pst, mBuf);
345 case EVTINFL2MEASSENDREQ :
346 cmUnpkSchMacL2MeasSendReq(RgSchMacL2MeasSendReq, pst , mBuf);
348 case EVTINFL2MEASSTOPREQ:
349 cmUnpkSchMacL2MeasStopReq(RgSchMacL2MeasStopReq, pst , mBuf);
351 #endif/* LTE_L2_MEAS */
353 cmUnpkSchMacLcgRegReq(RgSchMacLcgRegReq, pst, mBuf);
356 #if defined(LTE_ADV) && defined(LCPRG)
357 case EVTPRGUESCELLCFGREQ:
359 cmUnpkPrgPMacSMacUeSCellCfgReq(RgPrgPMacSMacUeSCellCfgReq, pst, mBuf);
362 case EVTPRGUESCELLCFGCFM:
363 case EVTPRGUESCELLLCHMODCFM:
364 case EVTPRGUESCELLLCHDELCFMDEL:
365 case EVTPRGUESCELLLCHADDCFM:
367 cmUnpkPrgSMacPMacCfgCfm(RgPrgSMacPMacCfgCfm, pst, mBuf);
370 case EVTPRGUESCELLDELREQ:
372 cmUnpkPrgPMacSMacUeSCellDelReq(RgPrgPMacSMacUeSCellDelReq, pst, mBuf);
375 case EVTPRGUESCELLLCHMODREQ:
377 cmUnpkPrgPMacSMacUeSCellLchModReq(RgPrgPMacSMacUeSCellLchModReq, pst,
381 case EVTPRGUESCELLLCHDELREQ:
383 cmUnpkPrgPMacSMacUeSCellLchDelReq(RgPrgPMacSMacUeSCellLchDelReq, pst,
387 case EVTPRGUESCELLLCHADDREQ:
389 cmUnpkPrgPMacSMacUeSCellLchAddReq(RgPrgPMacSMacUeSCellLchAddReq, pst,
405 * @brief Function prints src, dest, msg infor about all the msgs that received.
409 * Function : callFlowRgActvTsk
411 * Function prints src, dest, msg infor about all the msgs that received
413 * @param[in] Pst *pst, Post structure of the primitive.
418 void callFlowRgActvTsk(Pst *pst)
421 char destTask[50]="ENTMAC";
428 strcpy(sourceTask,"ENTDUAPP");
433 strcpy(message,"EVTLRGCFGREQ");
435 case EVTMACSCHGENCFGREQ:
436 strcpy(message,"EVTMACSCHGENCFGREQ");
439 strcpy(message,"EVTLRGCNTRLREQ");
442 strcpy(message,"EVTLRGSSTAREQ");
445 strcpy(message,"EVTLRGSTSREQ");
447 #endif /* LCRGMILRG */
448 case EVENT_MAC_CELL_CONFIG_REQ:
449 strcpy(message,"EVENT_MAC_CELL_CONFIG_REQ");
451 case EVENT_MAC_CELL_START:
452 strcpy(message,"EVENT_MAC_CELL_START");
454 case EVENT_MAC_CELL_STOP:
455 strcpy(message,"EVENT_MAC_CELL_STOP");
457 case EVENT_MAC_DL_CCCH_IND:
458 strcpy(message,"EVENT_MAC_DL_CCCH_IND");
460 case EVENT_MAC_UE_CREATE_REQ:
461 strcpy(message,"EVENT_MAC_UE_CREATE_REQ");
463 case EVENT_MAC_UE_RECONFIG_REQ:
464 strcpy(message,"EVENT_MAC_UE_RECONFIG_REQ");
466 case EVENT_MAC_UE_DELETE_REQ:
467 strcpy(message,"EVENT_MAC_UE_DELETE_REQ");
469 case EVENT_MAC_CELL_DELETE_REQ:
470 strcpy(message,"EVENT_MAC_CELL_DELETE_REQ");
472 case EVENT_MAC_SLICE_CFG_REQ:
473 strcpy(message,"EVENT_MAC_SLICE_CFG_REQ");
475 case EVENT_MAC_SLICE_RECFG_REQ:
476 strcpy(message,"EVENT_MAC_SLICE_CFG_REQ");
479 strcpy(message,"Invalid Event");
486 strcpy(sourceTask,"ENTRLC");
491 strcpy(message,"EVTRGUBNDREQ");
494 strcpy(message,"EVTRGUUBNDREQ");
496 case EVENT_DL_DATA_TO_MAC:
497 strcpy(message,"EVENT_DL_DATA_TO_MAC");
499 case EVENT_BO_STATUS_TO_MAC:
500 strcpy(message,"EVENT_BO_STATUS_TO_MAC");
504 strcpy(message,"Invalid Event");
512 strcpy(sourceTask,"ENTLWRMAC");
515 case EVENT_SLOT_IND_TO_MAC:
516 strcpy(message,"EVENT_SLOT_IND_TO_MAC");
518 case EVENT_STOP_IND_TO_MAC:
519 strcpy(message,"EVENT_STOP_IND_TO_MAC");
521 case EVENT_RACH_IND_TO_MAC:
522 strcpy(message,"EVENT_RACH_IND_TO_MAC");
524 case EVENT_CRC_IND_TO_MAC:
525 strcpy(message,"EVENT_CRC_IND_TO_MAC");
527 case EVENT_RX_DATA_IND_TO_MAC:
528 strcpy(message,"EVENT_RX_DATA_IND_TO_MAC");
530 case EVENT_UCI_IND_TO_MAC:
531 strcpy(message,"EVENT_UCI_IND_TO_MAC");
534 strcpy(message,"Invalid Event");
540 case ENTMAC: /* When scheduler instance sends msg to MAC */
542 strcpy(sourceTask,"ENTMAC");
546 case EVTINFCELLREGREQ:
547 strcpy(message,"EVTINFCELLREGREQ");
549 case EVTINFSFALLOCREQ:
550 strcpy(message,"EVTINFSFALLOCREQ");
553 strcpy(message,"EVTINFRLSHQREQ");
555 case EVTINFHQENTRESET:
556 strcpy(message,"EVTINFHQENTRESET");
558 case EVTINFRLSRNTIREQ:
559 strcpy(message,"EVTINFRLSRNTIREQ");
563 strcpy(message,"EVTINFSPSLCREG");
565 case EVTINFSPSLCDEREG:
566 strcpy(message,"EVTINFSPSLCDEREG");
569 strcpy(message,"EVTINFSPSRESET");
571 #endif /* LTEMAC_SPS */
573 strcpy(message,"EVTINFLCGREG");
576 #if defined(LTE_ADV) && defined(LCPRG)
577 case EVTPRGUESCELLCFGREQ:
578 strcpy(message,"EVTPRGUESCELLCFGREQ");
580 case EVTPRGUESCELLCFGCFM:
581 strcpy(message,"EVTPRGUESCELLCFGCFM");
583 case EVTPRGUESCELLLCHMODCFM:
584 strcpy(message,"EVTPRGUESCELLLCHMODCFM");
586 case EVTPRGUESCELLLCHDELCFMDEL:
587 strcpy(message,"EVTPRGUESCELLLCHDELCFMDEL");
589 case EVTPRGUESCELLLCHADDCFM:
590 strcpy(message,"EVTPRGUESCELLLCHADDCFM");
592 case EVTPRGUESCELLDELREQ:
593 strcpy(message,"EVTPRGUESCELLDELREQ");
595 case EVTPRGUESCELLLCHMODREQ:
596 strcpy(message,"EVTPRGUESCELLLCHMODREQ");
598 case EVTPRGUESCELLLCHDELREQ:
599 strcpy(message,"EVTPRGUESCELLLCHDELREQ");
601 case EVTPRGUESCELLLCHADDREQ:
602 strcpy(message,"EVTPRGUESCELLLCHADDREQ");
607 strcpy(message,"Invalid Event");
615 strcpy(sourceTask,"Invalid Source Entity Id");
619 DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
623 /**********************************************************************
626 * @brief Task Activation callback function.
630 * Function : rgActvTsk
632 * Primitives invoked by MAC's users/providers through
633 * a loosely coupled interface arrive here by means of
634 * SSI's message handling. This API is registered with
635 * SSI during the Task Registration of MAC.
637 * @param[in] Pst *pst, Post structure of the primitive.
638 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
639 * @param[in] Reason reason.
645 Pst *pst, /* post structure */
646 Buffer *mBuf /* message buffer */
650 #ifdef CALL_FLOW_DEBUG_LOG
651 callFlowRgActvTsk(pst);
656 /* The originator of this message is the stack manager,
657 * unpack and go to the respective primitive processing function */
659 rgHdlSMEvents(pst, mBuf);
662 rgHdlNHEvents(pst, mBuf);
665 rgHdlKWEvents(pst, mBuf);
668 rgHdlTFEvents(pst, mBuf);
670 case ENTMAC: /* When scheduler instance sends msg to MAC */
671 rgHdlRGEvents(pst, mBuf);
679 }/* end of rgActvTsk */
682 /**********************************************************************
685 **********************************************************************/