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 for Entry point fucntions
29 **********************************************************************/
31 /** @file rg_sch_tmr.c
32 @brief This module does processing related to timers for the scheduler.
34 static const char* RLOG_MODULE_NAME="MAC";
35 static int RLOG_MODULE_ID=4096;
36 static int RLOG_FILE_ID=175;
38 /* header include files -- defines (.h) */
39 #include "envopt.h" /* environment options */
40 #include "envdep.h" /* environment dependent */
41 #include "envind.h" /* environment independent */
42 #include "gen.h" /* general layer */
43 #include "ssi.h" /* system services */
44 #include "cm5.h" /* common timers defines */
45 #include "cm_hash.h" /* common hash list defines */
46 #include "cm_llist.h" /* common linked list defines */
47 #include "cm_mblk.h" /* memory management */
48 #include "cm_tkns.h" /* common tokens */
49 #include "cm_lte.h" /* common tokens */
50 #include "tfu.h" /* RGU defines */
51 #include "lrg.h" /* layer management defines for LTE-MAC */
52 #include "rgr.h" /* layer management defines for LTE-MAC */
53 #include "rg_env.h" /* defines and macros for MAC */
54 #include "rg_sch_err.h" /* defines and macros for MAC */
55 #include "rg_sch_inf.h" /* defines and macros for MAC */
56 #include "rg_sch.h" /* defines and macros for MAC */
57 #include "rl_interface.h"
58 #include "rl_common.h"
61 /* header/extern include files (.x) */
62 #include "gen.x" /* general layer typedefs */
63 #include "ssi.x" /* system services typedefs */
64 #include "cm5.x" /* common timers */
65 #include "cm_hash.x" /* common hash list */
66 #include "cm_lib.x" /* common library */
67 #include "cm_llist.x" /* common linked list */
68 #include "cm_mblk.x" /* memory management */
69 #include "cm_tkns.x" /* common tokens */
70 #include "cm_lte.x" /* common tokens */
71 #include "tfu.x" /* RGU types */
72 #include "lrg.x" /* layer management typedefs for MAC */
73 #include "rgr.x" /* layer management typedefs for MAC */
74 #include "rg_sch_inf.x" /* typedefs for MAC */
75 #include "rg_sch.x" /* typedefs for MAC */
78 EXTERN PUBLIC Void rgSCHSCellActivation ARGS((
79 RgSchUeCellInfo *sCell
82 /** @brief This function is a utility function to start timers, it is a
87 * Function: rgSCHTmrStartTmr
90 * - Starts timer at scheduler
92 * @param[in] RgSchCellCb *cell
94 * @param[in] S16 tmrEvnt
95 * @param[in] U32 tmrVal
99 PUBLIC Void rgSCHTmrStartTmr
107 PUBLIC Void rgSCHTmrStartTmr (cell, cb, tmrEvnt, tmrVal)
117 RgSchUeCellInfo *sCellCb = NULLP;
120 TRC2(rgSCHTmrStartTmr);
126 if(tmrEvnt == RG_SCH_TMR_SCELL_DEACT)
128 sCellCb = (RgSchUeCellInfo *)cb;
138 case RG_SCH_TMR_ACKNACK_REP:
139 arg.timers = &(ue->ackNakRepCb.ackNakRepTmr);
140 RLOG_ARG0(L_ERROR,DBG_INSTID,cell->instIdx,
141 "Hit AckNackRep timer");
143 case RG_SCH_TMR_MEASGAP:
144 arg.timers = &(ue->measGapCb.measGapTmr);
146 case RG_SCH_TMR_UL_ACKNACK:
147 arg.timers = &(ue->ackNakRepCb.ackNakRepUlInactvTmr);
149 case RG_SCH_TMR_DL_ACKNACK:
150 arg.timers = &(ue->ackNakRepCb.ackNakRepDlInactvTmr);
152 case RG_SCH_TMR_UL_MEASGAP:
153 arg.timers = &(ue->measGapCb.measGapUlInactvTmr);
155 case RG_SCH_TMR_DL_MEASGAP:
156 arg.timers = &(ue->measGapCb.measGapDlInactvTmr);
159 arg.timers = &(ue->taTmr);
161 /*MS_WORKAROUND for CR FIXME */
165 arg.timers = &(ue->bsrTmr);
171 #ifdef NO_BSR_SR_5GTF
174 arg.timers = &(ue->bsrTmr);
178 case RG_SCH_TMR_TXMODE_TRNSTN:
180 arg.timers = &(ue->txModeTransTmr);
184 case RG_SCH_TMR_SCELL_DEACT:
186 arg.timers = &(sCellCb->deactTmr);
189 case RG_SCH_TMR_SCELL_ACT_DELAY:
191 sCellCb = (RgSchUeCellInfo *)cb;
192 arg.timers = &(sCellCb->actDelayTmr);
197 RLOG_ARG0(L_ERROR,DBG_INSTID,cell->instIdx,
198 "rgSCHTmrStartTmr() Incorrect Timer event");
202 arg.tqCp = &(cell->tqCp);
214 /** @brief This function stops the timer.
218 * Function: rgSCHTmrStopTmr
221 * - Stops timer at scheduler.
223 * @param[in] RgSchCellCb *cell
224 * @param[in] S16 tmrEvnt
229 PUBLIC Void rgSCHTmrStopTmr
236 PUBLIC Void rgSCHTmrStopTmr (cell, tmrEvnt, cb)
245 RgSchUeCellInfo *sCellCb = NULLP;
248 TRC2(rgSCHTmrStopTmr);
254 if(tmrEvnt == RG_SCH_TMR_SCELL_DEACT)
256 sCellCb = (RgSchUeCellInfo *)cb;
266 case RG_SCH_TMR_ACKNACK_REP:
267 arg.timers = &(ue->ackNakRepCb.ackNakRepTmr);
269 case RG_SCH_TMR_MEASGAP:
270 arg.timers = &(ue->measGapCb.measGapTmr);
272 case RG_SCH_TMR_UL_ACKNACK:
273 arg.timers = &(ue->ackNakRepCb.ackNakRepUlInactvTmr);
275 case RG_SCH_TMR_DL_ACKNACK:
276 arg.timers = &(ue->ackNakRepCb.ackNakRepDlInactvTmr);
278 case RG_SCH_TMR_UL_MEASGAP:
279 arg.timers = &(ue->measGapCb.measGapUlInactvTmr);
281 case RG_SCH_TMR_DL_MEASGAP:
282 arg.timers = &(ue->measGapCb.measGapDlInactvTmr);
285 arg.timers = &(ue->taTmr);
287 /*MS_WORKAROUND for CR FIXME */
292 arg.timers = &(ue->bsrTmr);
298 #ifdef NO_BSR_SR_5GTF
301 arg.timers = &(ue->bsrTmr);
306 case RG_SCH_TMR_TXMODE_TRNSTN:
308 arg.timers = &(ue->txModeTransTmr);
312 case RG_SCH_TMR_SCELL_DEACT:
314 arg.timers = &(sCellCb->deactTmr);
317 case RG_SCH_TMR_SCELL_ACT_DELAY:
319 sCellCb = (RgSchUeCellInfo *)cb;
320 arg.timers = &(sCellCb->actDelayTmr);
326 RLOG_ARG0(L_ERROR,DBG_INSTID,cell->instIdx,
327 "rgSCHTmrStopTmr() Incorrect Timer event");
331 arg.tqCp = &(cell->tqCp);
342 /** @brief This function handles timer expiry.
346 * Function: rgSCHTmrProcTmr
349 * - Handles processing on timer expiry at scheduler.
352 * @param[in] S16 tmrEvnt
356 PUBLIC Void rgSCHTmrProcTmr
362 PUBLIC Void rgSCHTmrProcTmr (cb, tmrEvnt)
367 RgSchUeCb *ue = NULLP;
369 RgSchUeCellInfo *sCellCb = NULLP;
372 TRC2(rgSCHTmrProcTmr);
377 if(tmrEvnt == RG_SCH_TMR_SCELL_DEACT)
379 sCellCb = (RgSchUeCellInfo *)cb;
390 case RG_SCH_TMR_ACKNACK_REP:
391 rgSCHAckNakRepTmrExpry (ue);
393 case RG_SCH_TMR_MEASGAP:
394 rgSCHMeasGapANRepTmrExpry (ue);
396 case RG_SCH_TMR_UL_MEASGAP:
397 case RG_SCH_TMR_UL_ACKNACK:
398 rgSCHMeasGapANRepUlInactvTmrExpry (ue, (U8)tmrEvnt);
400 case RG_SCH_TMR_DL_ACKNACK:
401 case RG_SCH_TMR_DL_MEASGAP:
402 rgSCHMeasGapANRepDlInactvTmrExpry (ue, (U8)tmrEvnt);
406 /*TODO Needto handle TA Timer expiry for EMTC UE*/
407 if(TRUE == ue->isEmtcUe)
409 RLOG0(L_INFO,"TA Timer Expiry is not handled for EMTC UE\n");
413 rgSCHDhmProcTAExp (ue);
415 /*MS_WORKAROUND for CR FIXME */
419 rgSCHCmnBsrTmrExpry(ue);
425 rgSCHCmnBsrTmrExpry(ue);
430 case RG_SCH_TMR_TXMODE_TRNSTN:
432 ue->txModeTransCmplt = TRUE;
436 case RG_SCH_TMR_SCELL_DEACT:
438 rgSCHSCellDeactTmrExpry(sCellCb);
441 case RG_SCH_TMR_SCELL_ACT_DELAY:
443 sCellCb = (RgSchUeCellInfo *)cb;
444 rgSCHSCellActivation(sCellCb);
451 RLOG_ARG0(L_ERROR,DBG_INSTID,ue->cell->instIdx,
452 "rgSCHTmrProcTmr() Incorrect Timer event");
460 /**********************************************************************
463 **********************************************************************/