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 Round Robin functions
29 **********************************************************************/
32 @brief This module handles the round robin scheduler functionality
35 /* header include files -- defines (.h) */
36 #include "common_def.h"
42 #include "rg_sch_inf.h"
43 #include "rg_sch_err.h"
45 #include "rg_sch_cmn.h"
47 /* header/extern include files (.x) */
48 #include "tfu.x" /* RGU types */
49 #include "lrg.x" /* layer management typedefs for MAC */
50 #include "rgr.x" /* layer management typedefs for MAC */
51 #include "rgm.x" /* layer management typedefs for MAC */
52 #include "rg_sch_inf.x" /* typedefs for Scheduler */
53 #include "rg_sch.x" /* typedefs for Scheduler */
54 #include "rg_sch_cmn.x"
58 Void rgSCHSCellActivation ARGS((
59 RgSchUeCellInfo *sCell
62 Void rgSCHSCellSchdActDeactCe ARGS((
66 Void rgSCHSCellAddToActDeactLst ARGS((
71 Void rgSCHSCellRmvFrmActLst ARGS((
75 S16 rgSCHSCellIsActive ARGS((
80 Void rgSCHSCellHndlFdbkInd ARGS((
88 Void rgSCHSCellDeactTmrExpry ARGS((
89 RgSchUeCellInfo *sCell
93 Void rgSCHSCellDelUeSCell ARGS((
99 S16 rgSCHSCellDelUe ARGS((
104 S16 rgSCHSCellPCqiCfg ARGS((
105 RgSchCellCb *priCellCb,
106 RgSchCellCb *secCellCb,
108 RgrUePrdDlCqiCfg *cqiCfg,
109 CmLteUeCategory ueCat,
113 static S16 rgSCHSCellTrgMacHqEReset ARGS((
121 /** * @brief Handler for scheduling Scell Activation CE.
125 * Function : rgSCHDhmShcdSCellActCe
127 * This function is called by scheduler when resource allocation
128 * for SCell Activation CE transmission is done.
130 * @param[in] RgSchUeCb *ue
131 * @param[out] RgSchDlHqTbCb *tbInfo
135 Void rgSCHSCellSchdActDeactCe(RgSchUeCb *ueCb,RgSchDlHqTbCb *tbInfo)
139 uint8_t sCellActDeactBitMask = 0;
141 /* Change the state of all Scells waiting for
144 /* -------------------------
145 * | C7|C6|C5|C4|C3|C2|C1|R|
146 * -------------------------*/
151 for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
153 if(ueCb->cellInfo[idx] != NULLP)
155 switch(ueCb->cellInfo[idx]->sCellState)
157 case RG_SCH_SCELL_TOBE_ACTIVATED:
158 case RG_SCH_SCELL_ACTVTN_IN_PROG:
160 ueCb->cellInfo[idx]->sCellState = RG_SCH_SCELL_ACTVTN_IN_PROG;
164 case RG_SCH_SCELL_ACTIVE:
169 case RG_SCH_SCELL_TOBE_DEACTIVATED:
170 case RG_SCH_SCELL_DEACTVTN_IN_PROG:
172 ueCb->cellInfo[idx]->sCellState = RG_SCH_SCELL_DEACTVTN_IN_PROG;
176 case RG_SCH_SCELL_INACTIVE:
177 case RG_SCH_SCELL_READY:
186 sCellActDeactBitMask |= 1 << (idx);/* servCellIdx = idx + 1 */
190 tbInfo->schdSCellActCe.pres = PRSNT_NODEF;
191 tbInfo->schdSCellActCe.val = sCellActDeactBitMask;
194 } /* rgSCHSCellSchdActDeactCe */
198 * @brief Adds an UE to the Cell's SCell Activation list
202 * Function: rgSCHSCellAddToActDeactLst
203 * Purpose: Adds an UE to Cell's SCEll Act list
205 * Invoked by: Common Scheduler
207 * @param[in] RgSchCellCb* cell
208 * @param[in] RgSchUeCb* ue
212 Void rgSCHSCellAddToActDeactLst(RgSchCellCb *cell,RgSchUeCb *ue)
214 RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell);
216 if(NULLP == ue->sCellActLnk.node)
217 {/* Ue is not present in the list */
218 cmLListAdd2Tail(&cellCmnDl->secCellActCeLst, &ue->sCellActLnk);
219 ue->sCellActLnk.node = (PTR)ue;
223 DU_LOG("\nINFO --> SCH : SCell is already added in the Act List: ueId(%u)\n", ue->ueId);
231 * @brief Removes an UE from Cell's SCell Activation list
235 * Function: rgSCHSCellRmvFrmActLst
236 * Purpose: Removes an UE from Cell's SCEll Act list
238 * Invoked by: Specific Scheduler
240 * @param[in] RgSchCellCb* cell
241 * @param[in] RgSchUeCb* ue
245 Void rgSCHSCellRmvFrmActLst(RgSchCellCb *cell,RgSchUeCb *ue)
247 RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell);
248 if (NULLP != ue->sCellActLnk.node)
250 cmLListDelFrm(&cellCmnDl->secCellActCeLst, &ue->sCellActLnk);
252 ue->sCellActLnk.node = (PTR)NULLP;
258 * @brief Handling of SCell Activation
262 * Function: rgSCHSCellActivation
263 * Purpose : Perform Activation of secondary cell
264 * : Move the state to ACTIVE
265 * : Start the procedure for PCQI/SRS for this scell
267 * Invoked by:Cfg/Commn Scheduler
269 * @param[in] RgSchUeCellInfo *sCellInfo
271 * @return ROK/RFAILED
274 Void rgSCHSCellActivation(RgSchUeCellInfo *sCellInfo)
276 RgSchCellCb *sCell = sCellInfo->cell;
277 RgSchUeCb *ueCb = sCellInfo->ue;
278 RgSchCmnCell *cellSch;
281 Inst inst = ueCb->cell->instIdx;
284 RgrUePrdDlCqiCfg *cqiCfg;
285 uint8_t j; /*Bandwidth Parts*/
286 uint16_t riTrInsTime;
287 uint16_t periodicity;
288 uint16_t cqiTrInstTime;
289 RgSchUePCqiCb *cqiCb = NULLP;
290 CmLteTimingInfo timingInfo;
295 sCellInfo->sCellState = RG_SCH_SCELL_ACTIVE;
297 ueCb->tenbStats->stats.persistent.numActivation++;
301 DU_LOG("\nDEBUG --> SCH : ueId is SCELL_ACTIVE\n ueCb->ueId = %d sCell->sCellIdx =%d,\
302 sCell->sCellId=%d, sCell->sCellState=%d \n", ueCb->ueId, sCellInfo->sCellIdx, sCellInfo->sCellId, sCellInfo->sCellState);
304 /* Start the sCellDeactivation timer if cfgd */
305 if(PRSNT_NODEF == ueCb->sCellDeactTmrVal.pres)
307 //rgSCHTmrStartTmr (sCell,sCellInfo ,RG_SCH_TMR_SCELL_DEACT,
308 // ueCb->sCellDeactTmrVal.val);
312 /* Start receiving CQI for this SCell for this UE */
313 crntTime = (ueCb->cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)+
314 (ueCb->cell->crntTime.slot);
316 cqiCb = &sCellInfo->cqiCb;
317 cqiCfg = &cqiCb->cqiCfg;
318 if (cqiCfg->type == RGR_SCH_PCQI_SETUP)
320 cqiTrInstTime = ((cqiCb->cqiPeri+crntTime) - cqiCb->cqiOffset)
322 cqiCb->nCqiTrIdx = (crntTime +
323 (cqiCb->cqiPeri - cqiTrInstTime));
324 /* Introduced timing delta for reception req
326 if(cqiCb->nCqiTrIdx <= (crntTime + TFU_RECPREQ_DLDELTA))
328 cqiCb->nCqiTrIdx = cqiCb->nCqiTrIdx + cqiCb->cqiPeri;
331 timingInfo.sfn = cqiCb->nCqiTrIdx/RGSCH_NUM_SUB_FRAMES_5G;
332 timingInfo.slot = cqiCb->nCqiTrIdx%RGSCH_NUM_SUB_FRAMES_5G;
333 if(cqiCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP)
335 rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ueCb,cqiCb);
338 cqiCb->nCqiTrIdx = cqiCb->nCqiTrIdx
339 %RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
340 DU_LOG("\nINFO --> SCH : CQI Config: idx(%u) Periodicity %u"
341 "Offset %u uePosInQ (%u)\n", cqiCfg->cqiSetup.cqiPCfgIdx,
342 cqiCb->cqiPeri, cqiCb->cqiOffset,cqiCb->nCqiTrIdx);
344 cmLListAdd2Tail(&ueCb->cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,
347 rgSCHUtlSCellHndlCqiCollsn(cqiCb);
349 DU_LOG("\nINFO --> SCH : rgSCHCfgPCqiUeCfg():"
350 " CrntTime=%d Next CqiTrInstTime=%d Index Stored at=%d ",
351 crntTime, cqiTrInstTime, cqiCb->nCqiTrIdx);
353 if(cqiCfg->cqiSetup.riEna)
356 cqiCb->invalidateCqi = FALSE;
358 if(RGR_UE_PCQI_WB_REP == cqiCfg->cqiSetup.cqiRepType)
361 1. wideband RI reporting is configured
363 (10*sfn+floor(subframe)-Noffsetcqi-NoffsetRI )Mod(NCqiperiod
366 periodicity = cqiCb->cqiPeri * cqiCb->riPeri;
371 * Where Widesband and Subband RI reporting is configured
373 * (10*sfn+floor(subframe)-Noffsetcqi-NoffsetRI )
374 * Mod(H. NCqiperiod *MriPeriod )=0
375 * where H= J * K +1; J=Number of bandwidth parts(BW/subsize).
376 * K is RGR interf input
379 RG_SCH_GET_CQI_J_VAL(sCell->bwCfg.dlTotalBw, j);
380 cqiCb->h = (cqiCb->cqiCfg.cqiSetup.k *j )+1;
381 periodicity = cqiCb->h * cqiCb->cqiPeri *
386 /* In case of SFN wraparound, the SB CQI reporting cycle breaks
387 * and RI->WB CQI->SBCQI.. should resume. RI is repositioned
388 * accordingly. WBCQI handling is naturally accomplished */
389 if (periodicity >= RGSCH_MAX_SUBFRM_5G)
391 periodicity = cqiCb->cqiOffset - cqiCb->riOffset +
392 RGSCH_MAX_SUBFRM_5G - (crntTime);
393 tempIdx = crntTime + periodicity;
397 riTrInsTime = ((periodicity +crntTime )- \
398 cqiCb->cqiOffset + cqiCb->riOffset)\
400 tempIdx = (crntTime + (periodicity -riTrInsTime));
402 if (tempIdx <= (crntTime + TFU_RECPREQ_DLDELTA))
404 tempIdx = tempIdx + periodicity;
406 cqiCb->nRiTrIdx = tempIdx
407 % RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
408 if(periodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
410 cqiCb->riDist = rgSCHUtlFindDist((uint16_t)(crntTime + TFU_RECPREQ_DLDELTA),
419 /* Start receiving RI for this SCell for this UE */
420 cmLListAdd2Tail(&ueCb->cell->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst,
422 RG_SCH_RECORD(&cqiCb->histElem,RGSCH_ACTION_ADD,
423 &ueCb->cell->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst);
425 rgSCHUtlSCellHndlRiCollsn(cqiCb);
428 DU_LOG("\nINFO --> SCH : SCel RI cfg:"
429 "idx %u period %u Offset %u posInQ(%u) riDist(%u)lst count"
430 "%lu\n", cqiCfg->cqiSetup.riCfgIdx, cqiCb->riPeri,
431 cqiCb->riOffset, cqiCb->nRiTrIdx, cqiCb->riDist,
432 ueCb->cell->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst.count);
434 DU_LOG("\nINFO --> SCH : SCel RI cfg:"
435 "idx %u period %u Offset %u posInQ(%u) riDist(%u)lst count"
436 "%u\n", cqiCfg->cqiSetup.riCfgIdx, cqiCb->riPeri,
437 cqiCb->riOffset, cqiCb->nRiTrIdx, cqiCb->riDist,
438 ueCb->cell->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst.count);
443 DU_LOG("\nINFO --> SCH : \n rgSCHSCellActivation(): CrntTime=%d Next RiTrInstTime=%d"
444 "Index Stored at=%d riDis=%d ",
445 crntTime, riTrInsTime, cqiCb->nRiTrIdx, cqiCb->riDist);
450 cellSch = RG_SCH_CMN_GET_CELL(sCellInfo->cell);
451 cellSch->apisDl->rgSCHDlSCellActv(sCellInfo->cell, sCellInfo->ue);
459 * @brief Remove CQI from Scell Lst
463 * Function: rgSCHCellClearScellLstOfCQI
464 * Purpose : Remove CQI from Scell Lst
469 * @param[in] RgSchUeCellInfo *sCellInfo
473 static Void rgSCHCellClearScellLstOfCQI(RgSchUeCellInfo *sCellInfo)
476 RgSchUePCqiCb *cqiRiCb = NULLP;
478 ueCb = sCellInfo->ue;
479 /* Clear CQI/RI entry for this SCELL */
480 cqiRiCb = &sCellInfo->cqiCb;
481 /* Delete Periodic CQI/PMI Transmission Instance */
482 if (cqiRiCb->nCqiTrIdx != RG_SCH_INVALID_IDX)
484 cmLListDelFrm(&ueCb->cell->pCqiSrsSrLst[cqiRiCb->nCqiTrIdx].cqiLst,
485 &cqiRiCb->cqiLstEnt);
486 cqiRiCb->nCqiTrIdx = RG_SCH_INVALID_IDX;
488 if (ueCb->nPCqiCb == cqiRiCb)
490 rgSCHUtlSCellHndlCqiCollsn(&ueCb->cellInfo[RGSCH_PCELL_INDEX]->cqiCb);
492 /* Delete Periodic RI Transmission Instance */
494 if (cqiRiCb->nRiTrIdx != RG_SCH_INVALID_IDX)
496 cmLListDelFrm(&ueCb->cell->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst,
498 RG_SCH_RECORD(&cqiRiCb->histElem,RGSCH_ACTION_DEL,
499 &ueCb->cell->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst);
500 cqiRiCb->nRiTrIdx = RG_SCH_INVALID_IDX;
501 if (ueCb->nPRiCb == cqiRiCb)
503 rgSCHUtlSCellHndlRiCollsn(&ueCb->cellInfo[RGSCH_PCELL_INDEX]->cqiCb);
510 #endif/*TFU_UPGRADE*/
513 * @brief Handling of SCell DeActivation
517 * Function: rgSCHSCellDeActivation
518 * Purpose : Perform Deactivation of secondary cell
519 * : Move the state to IN_ACTIVE
520 * : Flush the harqEntity
521 * : Trigger harqEntity flushing to MAC
522 * : Remove PCQI/SRS for this scell
523 * : Stop Deactivation timer if running
525 * Invoked by:Cfg/Commn Scheduler
527 * @param[in] RgSchUeCellInfo *sCellInfo
529 * @return ROK/RFAILED
532 static S16 rgSCHSCellDeActivation(RgSchUeCellInfo *sCellInfo)
535 RgSchCmnCell *cellSch;
536 Inst inst = sCellInfo->cell->instIdx;
538 /* Stop the timer if running */
540 if(sCellInfo->deactTmr.tmrEvnt != TMR_NONE)
542 rgSCHTmrStopTmr(sCellInfo->cell, RG_SCH_TMR_SCELL_DEACT, sCellInfo);
545 if (sCellInfo->actDelayTmr.tmrEvnt != TMR_NONE)
547 rgSCHTmrStopTmr(sCellInfo->cell, RG_SCH_TMR_SCELL_ACT_DELAY, sCellInfo);
550 cellSch = RG_SCH_CMN_GET_CELL(sCellInfo->cell);
551 cellSch->apisDl->rgSCHDlUeReset(sCellInfo->cell, sCellInfo->ue);
553 if(sCellInfo->ue->isDrxEnabled)
555 rgSCHDrxUeHqReset(sCellInfo->ue->cell, sCellInfo->ue,
556 sCellInfo->hqEnt, sCellInfo->sCellIdx);
559 /* Flush the harqEntity at scheduler */
560 if(sCellInfo->hqEnt != NULLP)
562 rgSCHDhmHqEntReset(sCellInfo->hqEnt);
564 /* Trigger harq flush req to MAC */
567 rgSCHSCellTrgMacHqEReset(inst,sCellInfo->sCellId,sCellInfo->ue->ueId);
569 sCellInfo->sCellState = RG_SCH_SCELL_READY;
571 rgSCHCellClearScellLstOfCQI(sCellInfo);
575 sCellInfo->ue->tenbStats->stats.persistent.numDeactivation++;
578 cellSch->apisDl->rgSCHDlSCellDeactv(sCellInfo->cell, sCellInfo->ue);
581 DU_LOG("\nDEBUG --> SCH : SCELL DEATIVATED sCellInfo->ue->ueId =%d, sCellInfo->sCellId =%d\n",\
582 sCellInfo->ue->ueId, sCellInfo->sCellId);
583 //MSPD_DBG("SCELL DEATIVATED sCellInfo->ue->ueId =%d, sCellInfo->sCellId =%d\n", sCellInfo->ue->ueId, sCellInfo->sCellId);
590 * @brief Triggering hqEntity reset to mac
594 * Function: rgSCHSCellTrgMacHqEReset
595 * Purpose: Frame the interface for mac to reset
597 * Derive the macInstance corresponding
598 * to the secondary cell going to be deactivated.
599 * Triiger the msg to that macInstance
601 * Invoked by: CommonScheduler
603 * @param[in] uint16_t sCellId
604 * @param[in] uint16_t rnti
608 static S16 rgSCHSCellTrgMacHqEReset(Inst inst,uint16_t secCellId,uint16_ rnti)
611 RgSchCellCb *secCellCb = NULLP;
612 RgInfResetHqEnt hqEntRstInfo;
614 if((secCellCb = (RgSchCellCb *)rgSchUtlGetCellCb(inst, secCellId)) == NULLP)
616 DU_LOG("\nERROR --> SCH : SCell doesnt exists");
620 hqEntRstInfo.cellId = secCellId;
621 hqEntRstInfo.crnti = rnti;
623 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[inst], secCellCb->macInst);
625 RgSchMacRstHqEnt(&pst, &hqEntRstInfo);
634 * @brief Handling of harq feeback for SCell act CE txion
638 * Function: rgSCHSCellHndlFdbkInd
639 * Purpose: Handling the harq feedback for SCell ACT ce txion
640 * ACK:: Set the state as active for the Scells for which
642 * HQ FAILURE/DTX/NACK:: Perform retxion. Add to Act CE list
643 * Set the state to TOBE_SCHEDULED
646 * Invoked by: CommonScheduler
648 * @param[in] RgSchCellCb* cell
649 * @param[in] RgSchUeCb* ue
653 Void rgSCHSCellHndlFdbkInd(RgSchDlHqProcCb *hqP,uint8_t tbIdx,uint8_t fdbk,Bool maxHqRetxReached)
658 RgSchUeCellInfo *sCellInfo;
667 hqP->tbInfo[tbIdx].schdSCellActCe.pres = FALSE;
669 for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
671 if(ueCb->cellInfo[idx] != NULLP)
673 if(ueCb->cellInfo[idx]->sCellState == RG_SCH_SCELL_ACTVTN_IN_PROG)
676 DU_LOG("\nINFO --> SCH : starting delay timer...\n");
678 rgSCHTmrStartTmr (cell,ueCb->cellInfo[idx] ,RG_SCH_TMR_SCELL_ACT_DELAY,
679 RG_SCH_CMN_SCELL_ACT_DELAY_TMR);
683 if(ueCb->cellInfo[idx]->sCellState == RG_SCH_SCELL_DEACTVTN_IN_PROG)
685 sCellInfo = ueCb->cellInfo[idx];
686 rgSCHSCellDeActivation(sCellInfo);
696 if(TRUE == maxHqRetxReached)
698 hqP->tbInfo[tbIdx].schdSCellActCe.pres = FALSE;
699 for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
701 if(ueCb->cellInfo[idx] != NULLP)
703 if(ueCb->cellInfo[idx]->sCellState == RG_SCH_SCELL_ACTVTN_IN_PROG)
705 ueCb->cellInfo[idx]->sCellState = RG_SCH_SCELL_TOBE_ACTIVATED;
709 if(ueCb->cellInfo[idx]->sCellState == RG_SCH_SCELL_DEACTVTN_IN_PROG)
711 ueCb->cellInfo[idx]->sCellState = RG_SCH_SCELL_TOBE_DEACTIVATED;
715 /* Add to actDeactCe lst */
716 rgSCHSCellAddToActDeactLst(cell,ueCb);
729 * @brief Handling of SCell Deactivation Tmr Expiry
733 * Function: rgSCHSCellDeactTmrExpry
734 * Purpose : Deactivating the SCell. a
735 * Clear all the Harq Procs associated with this
737 * Trigger Harq Reset to the respective MAC
738 * Set the state of the cell to Inactive
743 * @param[in] RgSchUeCellInfo *sCellInfo
747 Void rgSCHSCellDeactTmrExpry(RgSchUeCellInfo *sCellInfo)
750 if (sCellInfo->ue->isScellExplicitDeAct == TRUE)
752 /* Deactivation Timer is not configured (infinity), thus send deactivation CE explicitly */
753 /* No doing Deactivaiton of LAA Cell */
754 if (FALSE == rgSCHLaaSCellEnabled(sCellInfo->cell))
756 rgSCHSCellTrigActDeact(sCellInfo->ue->cell, sCellInfo->ue, sCellInfo->sCellIdx, RGR_SCELL_DEACT);
760 DU_LOG("\nERROR --> SCH : !!!!!! Avoiding DEACT for UE %d because of LAA Cell !!!!!!!!!!!!! \n",
761 sCellInfo->ue->ueId);
767 /* Deactivation Timer is configured, thus assume that UE has deactivated */
768 rgSCHSCellDeActivation(sCellInfo);
775 * @brief This function handles the action of the SCell
779 * Function: rgSCHSCellTrigActDeact
781 * 1) Prepares SCELL ready for activation OR
782 * 2) Initiates activation of SCELL OR
783 * 3) Initiate deactivation of SCELL OR
785 * Invoked by:Cfg/Commn Scheduler
787 * @param[in] RgSchCellCb *cellCb
788 * @param[in] RgSchUeCb *ueCb
789 * @param[in] uint8_t sCellIdx
790 * @param[in] uint8_t action
792 * @return ROK/RFAILED
795 S16 rgSCHSCellTrigActDeact(RgSchCellCb *cell,RgSchUeCb *ueCb,uint8_t sCellIdx,uint8_t action)
797 Inst inst = cell->instIdx;
801 (sCellIdx > RGR_MAX_SCELL_PER_UE))
803 DU_LOG("\nERROR --> SCH : Invalid Serv Cell Idx %d\n", sCellIdx);
807 if(ueCb->cellInfo[sCellIdx] == NULLP)
809 DU_LOG("\nERROR --> SCH : Serv Cell not added to this Ue Scell Idx %d ueId %d\n", \
810 sCellIdx,ueCb->ueId);
816 case RGR_SCELL_READY:
818 if(ueCb->cellInfo[sCellIdx]->sCellState != RG_SCH_SCELL_INACTIVE)
820 DU_LOG("\nERROR --> SCH : Invalid state %u for preparing SCell Idx %u for UE %u\n", \
821 ueCb->cellInfo[sCellIdx]->sCellState, sCellIdx, ueCb->ueId);
826 ueCb->cellInfo[sCellIdx]->sCellState = RG_SCH_SCELL_READY;
827 //TODO_SID Activating the cell directly. Ignoring the ActCe procedure.
828 rgSCHSCellActivation(ueCb->cellInfo[sCellIdx]);
829 /* Setting allocCmnUlPdcch flag to FALSE, So that PDCCH allocation will be done
830 from UE Searchspace */
831 ueCb->allocCmnUlPdcch = FALSE;
832 DU_LOG("\nINFO --> SCH : ***** SCellIdx=%d state Changed to %d State \n",sCellIdx,\
833 ueCb->cellInfo[sCellIdx]->sCellState);
834 DU_LOG("\nINFO --> SCH : ***** SCellInfo Addr=%p state Changed to RG_SCH_SCELL_READY\n",\
835 (void*)ueCb->cellInfo[sCellIdx]);
841 if(ueCb->cellInfo[sCellIdx]->sCellState != RG_SCH_SCELL_READY)
843 DU_LOG("\nERROR --> SCH : Invalid state %u for activating SCell Idx %u for UE %u\n", \
844 ueCb->cellInfo[sCellIdx]->sCellState, sCellIdx, ueCb->ueId);
849 ueCb->cellInfo[sCellIdx]->sCellState = RG_SCH_SCELL_TOBE_ACTIVATED;
850 if (NULLP == ueCb->sCellActLnk.node)
852 /* Add only if UE is not already present in the activation/deactivation list */
853 rgSCHSCellAddToActDeactLst(cell,ueCb);
858 case RGR_SCELL_DEACT:
860 if(ueCb->cellInfo[sCellIdx]->sCellState != RG_SCH_SCELL_ACTIVE)
862 DU_LOG("\nERROR --> SCH : Invalid state %u for deactivating SCell Idx %u for UE %u\n", \
863 ueCb->cellInfo[sCellIdx]->sCellState, sCellIdx, ueCb->ueId);
868 ueCb->cellInfo[sCellIdx]->sCellState = RG_SCH_SCELL_TOBE_DEACTIVATED;
869 if (NULLP == ueCb->sCellActLnk.node)
871 /* Add only if UE is not already present in the activation/deactivation list */
872 rgSCHSCellAddToActDeactLst(cell,ueCb);
879 DU_LOG("\nERROR --> SCH : Invalid action received for SCell Idx %u for UE %u\n", \
880 sCellIdx, ueCb->ueId);
890 * @brief SCell Activation of selected cell
894 * Function: rgSCHSCellSelectForAct
895 * Purpose : Perform Selection of secondary cell for activation
897 * Invoked by:Cfg/Commn Scheduler
899 * @param[in] RgSchCellCb *cellCb
900 * @param[in] RgSchUeCb *ueCb
902 * @return ROK/RFAILED
905 static S16 rgSCHSCellSelectForAct(RgSchCellCb *cell,RgSchUeCb *ueCb,uint8_t *sCellIdx)
908 for((*sCellIdx) = 1; (*sCellIdx) <= RG_SCH_MAX_SCELL; (*sCellIdx)++)
910 if((ueCb->cellInfo[(*sCellIdx)] != NULLP) &&
911 (ueCb->cellInfo[(*sCellIdx)]->sCellState == RG_SCH_SCELL_READY))
920 * @brief SCell Activation of selected cell
924 * Function: rgSCHSCellSelectAndActDeAct
925 * Purpose : Perform Selection and Activation/Deactivation of secondary cell
927 * Invoked by:Cfg/Commn Scheduler
929 * @param[in] RgSchCellCb *cellCb
930 * @param[in] RgSchUeCb *ueCb
931 * @param[in] uint8_t action
936 Void rgSCHSCellSelectAndActDeAct(RgSchCellCb *pCell,RgSchUeCb *ueCb,uint8_t action)
938 uint8_t sCellIdx = 0;
946 if(((ret = rgSCHSCellSelectForAct(pCell, ueCb, &sCellIdx)) == ROK)
955 (ROK != (rgSCHSCellTrigActDeact(pCell, ueCb, sCellIdx, action))))
957 DU_LOG("\nERROR --> SCH : SCell Actication failed"
958 "for UE [%d] with SCellIdx [%d]\n", ueCb->ueId, sCellIdx);
965 * @brief Handling of Scell Deletion
969 * Function: rgSCHSCellDelUeSCell
970 * Purpose : Perform Scell Deletion for an UE
971 * : flush harqEnttiy of the given scell associated
975 * Invoked by:Cfg module
977 * @param[in] RgSchCellCb *cellCb
978 * @param[in] RgSchUeCb *ueCb
979 * @param[in] uint8_t idx
980 * @return ROK/RFAILED
983 Void rgSCHSCellDelUeSCell(RgSchCellCb *cellCb,RgSchUeCb *ueCb,uint8_t sCellIdx)
986 Inst inst = cellCb->instIdx;
987 RgSchUeCellInfo *sCellInfo;
990 sCellInfo = ueCb->cellInfo[sCellIdx];
993 if(sCellInfo == NULLP)
995 DU_LOG("\nERROR --> SCH : Serv Cell not added to this Ue Scell Idx %d\
997 sCellIdx,ueCb->ueId);
1001 rgSCHDbmDelUeCb(sCellInfo->cell, ueCb);
1002 ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, sCellInfo->cell);
1004 if (NULLP != sCellInfo->sCellLnk.node)
1006 cmLListDelFrm(&sCellInfo->cell->sCellUeLst, &sCellInfo->sCellLnk);
1009 /* Clear Scheduler specific list for this UE from the
1010 * corresponding CELL */
1012 /*Updating 1BCS Value*/
1013 ueCb->f1bCsAVal = (ueCb->f1bCsAVal -
1014 rgSCHUtlGetMaxTbSupp(sCellInfo->txMode.txModeEnum));
1017 rgSCHUtlDelUeANFdbkInfo(ueCb,sCellIdx);
1020 rgSCHSCellDeActivation(sCellInfo);
1021 /* Release hqEnt mem */
1022 rgSCHDhmDelHqEnt(cellCb, &sCellInfo->hqEnt);
1024 ulHqEnt = &(ueUl->hqEnt);
1026 cellCb->sc.apis->rgSCHRgrSCellUeDel(sCellInfo, sCellInfo->ue);
1028 rgSCHUhmFreeUe(sCellInfo->cell, ulHqEnt);
1030 rgSCHUtlFreeSBuf(cellCb->instIdx,
1031 (Data**)(&(sCellInfo)), (sizeof(RgSchUeCellInfo)));
1033 ueCb->cellInfo[sCellIdx] = NULLP;
1039 * @brief Handling of UE Deletion
1043 * Function: rgSCHSCellDelUe
1044 * Purpose : Perform UE Deletion
1045 * : Delete all the SCells added for this UE
1046 * : flush harqEnttiy of all scells associated
1050 * Invoked by:Cfg module
1052 * @param[in] RgSchCellCb *cellCb
1053 * @param[in] RgSchUeCb *ueCb
1054 * @return ROK/RFAILED
1057 S16 rgSCHSCellDelUe(RgSchCellCb *cellCb,RgSchUeCb *ueCb)
1061 for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
1063 rgSCHSCellDelUeSCell(cellCb,ueCb,idx);
1072 * @brief Handling of PCqi cfg fro a scell
1076 * Function: rgSCHSCellPCqiCfg
1078 * : Delete all the SCells added for this UE
1079 * : flush harqEnttiy of all scells associated
1082 * - For SCell-specific Periodic CQI related configuration,
1083 * - If Periodic CQI/PMI is configured,
1084 * - Update SCell with the configured values.
1085 * - Update the CQI offset and CQI perodicity information
1088 * - For SCell-specific Periodic RI related configuration,
1089 * - If Periodic RI is configured,
1090 * - Update SCell with the configured values.
1091 * - Update the RI offset and RI perodicity information
1094 * Invoked by:Cfg module
1096 * @param[in] RgSchCellCb *cellCb
1097 * @param[in] RgSchUeCb *ueCb
1098 * @return ROK/RFAILED
1101 S16 rgSCHSCellPCqiCfg
1103 RgSchCellCb *priCellCb,
1104 RgSchCellCb *secCellCb,
1106 RgrUePrdDlCqiCfg *cqiCfg,
1107 CmLteUeCategory ueCat,
1111 uint8_t j; /*Bandwidth Parts*/
1114 Inst inst = priCellCb->instIdx;
1116 RgSchUeCellInfo *sCellInfo;
1117 RgSchUePCqiCb *cqiCb = NULLP;
1119 DU_LOG("\nINFO --> SCH : rgSCHSCellPCqiCfg cellId =%d, ueId = %d, CfgType =%d\n",
1120 secCellCb->cellId, ueCb->ueId, cqiCfg->type);
1122 if((sCellIdx < 1) ||
1123 (sCellIdx > RGR_MAX_SCELL_PER_UE))
1125 DU_LOG("\nERROR --> SCH : Invalid Serv Cell Idx %d\n",
1130 sCellInfo = ueCb->cellInfo[sCellIdx];
1132 cqiCb = &ueCb->cellInfo[sCellIdx]->cqiCb;
1133 cqiCb->servCellInfo = sCellInfo;
1135 /* Periodic CQI is setup */
1136 if (cqiCfg->type == RGR_SCH_PCQI_SETUP)
1138 /* 1. Copy the Received CQI Cfg parameters to ueCb */
1139 memcpy(&cqiCb->cqiCfg, cqiCfg,
1140 sizeof(RgrUePrdDlCqiCfg));
1142 /* 2. Compute Periodic CQI Periodicity and subframe offset */
1144 rgSCHUtlGetCfgPerOff(RG_SCH_FDD_PCQI_TBL, cqiCfg->cqiSetup.cqiPCfgIdx,
1145 &cqiCb->cqiPeri, &cqiCb->cqiOffset);
1147 rgSCHUtlGetCfgPerOff( RG_SCH_TDD_PCQI_TBL,
1148 cqiCfg->cqiSetup.cqiPCfgIdx,
1149 &cqiCb->cqiPeri, &cqiCb->cqiOffset);
1153 DU_LOG("\nDEBUG --> SCH : rgSCHSCellPCqiCfg(): CQI Peri=%d, CQI Offset=%d",
1154 cqiCb->cqiPeri,cqiCb->cqiOffset);
1156 if(RGR_UE_PCQI_SB_REP == cqiCfg->cqiSetup.cqiRepType)
1158 uint8_t k; /*SubBand Size (RB) */
1159 RG_SCH_GET_CQI_J_VAL(secCellCb->bwCfg.dlTotalBw, j);
1160 RG_SCH_GET_CQI_K_VAL(secCellCb->bwCfg.dlTotalBw, k);
1161 cqiCb->J = j; /*Number of Bandwidth Parts*/
1162 /*h: reporting instances required for a complete CQI/PMI report */
1163 /*j:Number of bandwidth parts; k: Subband Size*/
1164 cqiCb->h = (cqiCb->cqiCfg.cqiSetup.k *j )+1;
1165 /* ccpu00140905- L-size is coming as 3 for 100Rbs where it should be 2*/
1166 temp = RGSCH_CEIL(secCellCb->bwCfg.dlTotalBw, (j*k));
1167 cqiCb->label = (temp & (temp-1)) ?
1168 (1+ rgSCHUtlLog32bitNbase2(temp)) : rgSCHUtlLog32bitNbase2(temp);
1172 /* Wideband Cqi Rep Type */
1173 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1;
1175 cqiCb->cqiLstEnt.node=(PTR)cqiCb;
1176 cqiCb->isCqiIgnoByCollsn = FALSE;
1179 /* 4. Rank Indicator Cfg handler */
1180 /* 1. Rank Indicator is enabled */
1181 if(cqiCfg->cqiSetup.riEna)
1183 rgSCHUtlGetCfgPerOff(RG_SCH_RI_TBL,
1184 cqiCfg->cqiSetup.riCfgIdx,
1185 &cqiCb->riPeri, &cqiCb->riOffset);
1187 DU_LOG("\nDEBUG --> SCH : rgSCHSCellPCqiCfg(): RI Peri=%d, RI Offset=%d",
1188 cqiCb->riPeri,cqiCb->riOffset);
1190 if(ueCb->cellInfo[sCellIdx]->txMode.txModeEnum == RGR_UE_TM_3
1191 || ueCb->cellInfo[sCellIdx]->txMode.txModeEnum == RGR_UE_TM_4)
1193 if (secCellCb->numTxAntPorts ==2)
1195 cqiCb->riNumBits = 1;
1197 else if(secCellCb->numTxAntPorts ==4)
1199 if(ueCat == CM_LTE_UE_CAT_8)
1201 cqiCb->riNumBits = 3;
1203 else if((ueCat == CM_LTE_UE_CAT_5) ||
1204 (ueCat == CM_LTE_UE_CAT_6) || CM_LTE_UE_CAT_7)
1206 cqiCb->riNumBits = 2;
1210 cqiCb->riNumBits = 1;
1214 cqiCb->riLstEnt.node=(PTR) cqiCb;
1215 cqiCb->isRiIgnoByCollsn = FALSE;
1221 sCellInfo->cqiCb.cqiCfg.type = RGR_SCH_PCQI_REL;
1223 /* Setting the indices to invalid during
1224 scell addition. These indices will be set during
1226 cqiCb->nRiTrIdx = RG_SCH_INVALID_IDX;
1227 cqiCb->riDist = RG_SCH_INVALID_IDX;
1228 cqiCb->nCqiTrIdx = RG_SCH_INVALID_IDX;
1235 * @brief Handling of Ue Reset from common scheduler
1239 * Function: rgSCHSCellDlUeReset
1240 * Purpose: Call scheudler type spcefic UE RESET
1241 * for all the secondary cells
1243 * Invoked by: CommonScheduler
1245 * @param[in] RgSchCellCb* cell
1246 * @param[in] RgSchUeCb* ue
1250 Void rgSCHSCellDlUeReset(RgSchCellCb *cell,RgSchUeCb *ue)
1252 RgSchCmnCell *cellSch;
1254 for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
1256 if(ue->cellInfo[idx] != NULLP)
1258 cellSch = RG_SCH_CMN_GET_CELL(ue->cellInfo[idx]->cell);
1259 cellSch->apisDl->rgSCHDlUeReset(ue->cellInfo[idx]->cell, ue);
1260 rgSCHSCellDeActivation(ue->cellInfo[idx]);
1261 ue->cellInfo[idx]->sCellState = RG_SCH_SCELL_INACTIVE;
1269 * @brief Handling of LC Cfg from common scheduler
1273 * Function: rgSCHSCellDlLcCfg
1274 * Purpose: Call scheudler type spcefic LC config
1275 * for all the secondary cells
1277 * Invoked by: CommonScheduler
1279 * @param[in] RgSchCellCb* cell
1280 * @param[in] RgSchUeCb* ue
1284 Void rgSCHSCellDlLcCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
1286 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
1287 for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
1289 if(ue->cellInfo[idx] != NULLP)
1291 cellSch->apisDl->rgSCHRgrDlLcCfg(ue->cellInfo[idx]->cell, ue, svc,NULLP,NULLP);
1298 * @brief Handling of LC Delete from common scheduler
1302 * Function: rgSCHSCellDlLcDel
1303 * Purpose: Call scheudler type spcefic bo update handler
1304 * for all the secondary cells
1306 * Invoked by: CommonScheduler
1308 * @param[in] RgSchCellCb* cell
1309 * @param[in] RgSchUeCb* ue
1313 Void rgSCHSCellDlLcDel(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
1315 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
1316 for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
1318 if(ue->cellInfo[idx] != NULLP)
1320 cellSch->apisDl->rgSCHFreeDlLc(ue->cellInfo[idx]->cell, ue, svc);
1327 * @brief Handling of Bo update from common scheduler
1331 * Function: rgSCHSCellDlDedBoUpd
1332 * Purpose: Call scheudler type spcefic bo update handler
1333 * for all the secondary cells
1335 * Invoked by: CommonScheduler
1337 * @param[in] RgSchCellCb* cell
1338 * @param[in] RgSchUeCb* ue
1342 Void rgSCHSCellDlDedBoUpd(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
1344 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
1346 /* If this is not invoked by PCell, then
1347 invoke the call to PCell handler
1348 This happens during finalization if LC Bo becomes zero*/
1349 if (ue->cell != cell)
1351 cellSch->apisDl->rgSCHDlDedBoUpd(ue->cell, ue, svc);
1353 for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
1355 if((ue->cellInfo[idx] != NULLP) &&
1356 (ue->cellInfo[idx]->sCellState == RG_SCH_SCELL_ACTIVE) &&
1357 (ue->cellInfo[idx]->cell != cell))
1359 cellSch->apisDl->rgSCHDlDedBoUpd(ue->cellInfo[idx]->cell, ue, svc);
1366 * @brief Compare two CQI CB configs are return the result
1370 * Function: rgSCHUtlSCellCmpCqiCfg
1371 * Purpose : Compare priority levels of cqiCb1 and cqiCb2
1372 * and set the isCqiIgnoByCollsn to TRUE for the
1373 * cqiCb which has lower priority
1374 * Invoked by:scell module
1376 * @param[in] RgSchUePCqiCb *cqiCb1
1377 * @param[in] RgSchUePCqiCb *cqiCb2
1378 * @return uint8_t cqiCb cell idx which has the higher priority
1381 static uint8_t rgSCHUtlSCellCmpCqiCfg(RgSchUePCqiCb *cqiCb1,RgSchUePCqiCb *cqiCb2)
1383 RgSchUePCqiCb *retCqiCb;
1384 /* Collision rules are defined in TS 36.213,7.2.2 */
1385 /* RI, WB first PMI > WB CQI > SB CQI */
1386 /* As of now only taking care of RI > WB CQI > SB CQI */
1388 if (cqiCb1->prioLvl > cqiCb2->prioLvl)
1390 cqiCb2->isCqiIgnoByCollsn = TRUE;
1391 cqiCb1->isCqiIgnoByCollsn = FALSE;
1394 else if (cqiCb2->prioLvl > cqiCb1->prioLvl)
1396 cqiCb1->isCqiIgnoByCollsn = TRUE;
1397 cqiCb2->isCqiIgnoByCollsn = FALSE;
1402 if (cqiCb1->servCellInfo->sCellIdx > cqiCb2->servCellInfo->sCellIdx)
1404 cqiCb1->isCqiIgnoByCollsn = TRUE;
1405 cqiCb2->isCqiIgnoByCollsn = FALSE;
1410 cqiCb2->isCqiIgnoByCollsn = TRUE;
1411 cqiCb1->isCqiIgnoByCollsn = FALSE;
1416 return (retCqiCb->servCellInfo->sCellIdx);
1420 * @brief Handling of collision of CQI types between serving cells
1424 * Function: rgSCHUtlSCellHndlCqiCollsn
1425 * Purpose : Takes care of collision clauses specified in 36.213 7.2.2 Rel 10
1426 * and selects next nearest cqiCb
1427 * Invoked by:Cfg module
1429 * @param[in] RgSchCellCb *cellCb
1430 * @param[in] RgSchUeCb *ueCb
1431 * @return ROK/RFAILED
1434 S16 rgSCHUtlSCellHndlCqiCollsn(RgSchUePCqiCb *cqiCb)
1436 uint32_t nPCqiServCellIdx;
1437 uint32_t minPCqiTrIdx;
1438 uint32_t scellPCqiTrIdx;
1440 RgSchCellCb *priCellCb = cqiCb->servCellInfo->ue->cell;
1441 RgSchUeCb *ueCb = cqiCb->servCellInfo->ue;
1444 uint32_t sCellCnt = 0;
1445 CmLteTimingInfo timingInfo;
1449 RG_SCH_ADD_TO_CRNT_TIME(priCellCb->crntTime, timingInfo, TFU_DELTA);
1451 RG_SCH_ADD_TO_CRNT_TIME(priCellCb->crntTime, timingInfo,
1452 TFU_RECPREQ_DLDELTA);
1455 RG_SCH_GET_IDX_PCQISRSSR(timingInfo, crntSfIdx);
1457 cqiCb->isCqiIgnoByCollsn = FALSE;
1459 pCqiTrIdx = cqiCb->nCqiTrIdx;
1460 nPCqiServCellIdx = cqiCb->servCellInfo->sCellIdx;
1461 /* Handle wrap around case */
1462 if (pCqiTrIdx < crntSfIdx)
1464 pCqiTrIdx += RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1466 minPCqiTrIdx = pCqiTrIdx;
1468 for (cellIdx =0; cellIdx <= RG_SCH_MAX_SCELL; cellIdx++)
1470 /* If a serving cell is configured */
1471 if(ueCb->cellInfo[cellIdx] != NULLP)
1473 /* If the serving cell is in ACTIVE state and
1474 If it is not the same serving cell as cqiCb for which
1475 collision is being checked */
1476 if ((ueCb->cellInfo[cellIdx]->sCellState == RG_SCH_SCELL_ACTIVE)&&
1477 (cellIdx != cqiCb->servCellInfo->sCellIdx))
1479 scellPCqiTrIdx = ueCb->cellInfo[cellIdx]->cqiCb.nCqiTrIdx;
1481 /* Handle wrap around case */
1482 if (scellPCqiTrIdx < crntSfIdx)
1484 scellPCqiTrIdx += RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1487 /* If cqiCb->isCqiIgnoByCollsn is TRUE then a higher prio cqiCb
1488 is already found so need to compare */
1489 if ((FALSE == ueCb->cellInfo[cellIdx]->cqiCb.isCqiIgnoByCollsn) &&
1490 (FALSE == cqiCb->isCqiIgnoByCollsn) &&
1491 (scellPCqiTrIdx == pCqiTrIdx))
1493 /* Handle Collision */
1494 /* set isCqiIgnoByCollsn to TRUE for low prio CQI Rep type */
1495 nPCqiServCellIdx = rgSCHUtlSCellCmpCqiCfg(&ueCb->cellInfo[cellIdx]->cqiCb,cqiCb);
1497 else if (scellPCqiTrIdx < minPCqiTrIdx)
1499 minPCqiTrIdx = scellPCqiTrIdx;
1500 nPCqiServCellIdx = cellIdx;
1504 /* If all of the num of configured scells are checked then break */
1505 if (sCellCnt == ueCb->numSCells)
1513 /* Set the next expected Cqi into nPCqiCb */
1514 idx = ((nPCqiServCellIdx)& (CM_LTE_MAX_CELLS -1));
1515 ueCb->nPCqiCb = &ueCb->cellInfo[idx]->cqiCb;
1522 * @brief Handling of collision of RI types between serving cells
1526 * Function: rgSCHUtlSCellHndlRiCollsn
1527 * Purpose : Takes care of collision clauses specified in 36.213 7.2.2 Rel 10
1528 * and selects next nearest cqiCb
1529 * Invoked by:Cfg module
1531 * @param[in] RgSchCellCb *cellCb
1532 * @param[in] RgSchUeCb *ueCb
1533 * @return ROK/RFAILED
1536 S16 rgSCHUtlSCellHndlRiCollsn(RgSchUePCqiCb *cqiCb)
1538 uint32_t nPRiServCellIdx;
1539 uint32_t minPRiTrIdx;
1540 uint32_t scellPRiTrIdx;
1542 RgSchCellCb *priCellCb = cqiCb->servCellInfo->ue->cell;
1543 RgSchUeCb *ueCb = cqiCb->servCellInfo->ue;
1546 uint32_t sCellCnt = 0;
1547 CmLteTimingInfo timingInfo;
1550 RG_SCH_ADD_TO_CRNT_TIME(priCellCb->crntTime, timingInfo, TFU_DELTA);
1552 RG_SCH_ADD_TO_CRNT_TIME(priCellCb->crntTime, timingInfo,
1553 TFU_RECPREQ_DLDELTA);
1556 RG_SCH_GET_IDX_PCQISRSSR(timingInfo, crntSfIdx);
1558 pRiTrIdx = cqiCb->nRiTrIdx + cqiCb->riDist * RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1560 /* Handle wrap around case */
1561 if (pRiTrIdx < crntSfIdx)
1563 pRiTrIdx += RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1566 cqiCb->isRiIgnoByCollsn = FALSE;
1567 nPRiServCellIdx = cqiCb->servCellInfo->sCellIdx;
1568 minPRiTrIdx = pRiTrIdx;
1570 for (cellIdx =0; cellIdx <= RG_SCH_MAX_SCELL; cellIdx++)
1572 /* If a serving cell is configured */
1573 if(ueCb->cellInfo[cellIdx] != NULLP)
1575 /* If the serving cell is in ACTIVE state and
1576 If it is not the same serving cell as cqiCb for which
1577 collision is being checked */
1578 if ((ueCb->cellInfo[cellIdx]->sCellState == RG_SCH_SCELL_ACTIVE)&&
1579 (cellIdx != cqiCb->servCellInfo->sCellIdx))
1581 scellPRiTrIdx = ueCb->cellInfo[cellIdx]->cqiCb.nRiTrIdx +
1582 ueCb->cellInfo[cellIdx]->cqiCb.riDist * RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1584 /* Handle wrap around case */
1585 if (scellPRiTrIdx < crntSfIdx)
1587 scellPRiTrIdx += RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1590 /* If cqiCb->isRiIgnoByCollsn is TRUE then a higher prio cqiCb
1591 is already found so need to compare */
1592 if ((FALSE == ueCb->cellInfo[cellIdx]->cqiCb.isRiIgnoByCollsn) &&
1593 (FALSE == cqiCb->isRiIgnoByCollsn) &&
1594 (scellPRiTrIdx == pRiTrIdx))
1596 /* Handle Collision */
1597 /* set isRiIgnoByCollsn to TRUE for low prio CQI Rep type */
1598 if (cqiCb->servCellInfo->sCellIdx < (ueCb->cellInfo[cellIdx]->sCellIdx))
1600 ueCb->cellInfo[cellIdx]->cqiCb.isRiIgnoByCollsn = TRUE;
1604 cqiCb->isRiIgnoByCollsn = TRUE;
1607 else if (scellPRiTrIdx < minPRiTrIdx)
1609 minPRiTrIdx = scellPRiTrIdx;
1610 nPRiServCellIdx = cellIdx;
1614 /* If all of the num of configured scells are checked then break */
1615 if (sCellCnt == ueCb->numSCells)
1623 /* Set the next expected Cqi into nPCqiCb */
1624 ueCb->nPRiCb = &ueCb->cellInfo[nPRiServCellIdx]->cqiCb;
1628 #endif/*TFU_UPGRADE*/
1631 * @brief Checking whethter the scell is active or not
1635 * Function: rgSCHSCellIsActive
1636 * Purpose: Check the Scell is in active state or not
1639 * Invoked by: SpecificScheduler
1641 * @param[in] RgSchCellCb* cell
1642 * @param[in] RgSchUeCb* ue
1646 S16 rgSCHSCellIsActive(RgSchCellCb *cell,RgSchUeCb *ue)
1648 S16 retVal = RFAILED;
1650 for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
1652 if((ue->cellInfo[idx] != NULLP) &&
1653 (ue->cellInfo[idx]->cell->cellId == cell->cellId)&&
1654 (ue->cellInfo[idx]->sCellState == RG_SCH_SCELL_ACTIVE))
1664 * @brief Function to check for Acell Activation Trigered.
1668 * Function : rgSCHIsActvReqd
1669 * This function will check for Secondary cell activation criteria
1670 * If met this will return TRUE else FALSE
1672 * @param[in] RgSchCellCb *cell
1673 * @param[in] RgSchUeCb *ue
1677 Bool rgSCHIsActvReqd(RgSchCellCb *cell,RgSchUeCb *ue)
1679 /* Check if remBoCnt in this UE is greater than ZERO for sufficient number of
1680 * Scheduling TTIs. If yes then We should activate a secondary cell to handle
1682 if(ue->remBoCnt == RG_SCH_ACTIVATION_COUNT)
1692 /**********************************************************************
1695 **********************************************************************/