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 PUBLIC Void rgSCHSCellActivation ARGS((
59 RgSchUeCellInfo *sCell
62 PUBLIC Void rgSCHSCellSchdActDeactCe ARGS((
66 PUBLIC Void rgSCHSCellAddToActDeactLst ARGS((
71 PUBLIC Void rgSCHSCellRmvFrmActLst ARGS((
75 PUBLIC S16 rgSCHSCellIsActive ARGS((
80 PUBLIC Void rgSCHSCellHndlFdbkInd ARGS((
88 PUBLIC Void rgSCHSCellDeactTmrExpry ARGS((
89 RgSchUeCellInfo *sCell
93 PUBLIC Void rgSCHSCellDelUeSCell ARGS((
99 PUBLIC S16 rgSCHSCellDelUe ARGS((
104 PUBLIC S16 rgSCHSCellPCqiCfg ARGS((
105 RgSchCellCb *priCellCb,
106 RgSchCellCb *secCellCb,
108 RgrUePrdDlCqiCfg *cqiCfg,
109 CmLteUeCategory ueCat,
113 PRIVATE 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
136 PUBLIC Void rgSCHSCellSchdActDeactCe
139 RgSchDlHqTbCb *tbInfo
142 PUBLIC Void rgSCHSCellSchdActDeactCe(ueCb, tbInfo)
144 RgSchDlHqTbCb *tbInfo;
149 U8 sCellActDeactBitMask = 0;
150 TRC3(rgSCHSCellSchdActDeactCe);
152 /* Change the state of all Scells waiting for
155 /* -------------------------
156 * | C7|C6|C5|C4|C3|C2|C1|R|
157 * -------------------------*/
162 for(U8 idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
164 if(ueCb->cellInfo[idx] != NULLP)
166 switch(ueCb->cellInfo[idx]->sCellState)
168 case RG_SCH_SCELL_TOBE_ACTIVATED:
169 case RG_SCH_SCELL_ACTVTN_IN_PROG:
171 ueCb->cellInfo[idx]->sCellState = RG_SCH_SCELL_ACTVTN_IN_PROG;
175 case RG_SCH_SCELL_ACTIVE:
180 case RG_SCH_SCELL_TOBE_DEACTIVATED:
181 case RG_SCH_SCELL_DEACTVTN_IN_PROG:
183 ueCb->cellInfo[idx]->sCellState = RG_SCH_SCELL_DEACTVTN_IN_PROG;
187 case RG_SCH_SCELL_INACTIVE:
188 case RG_SCH_SCELL_READY:
197 sCellActDeactBitMask |= 1 << (idx);/* servCellIdx = idx + 1 */
201 tbInfo->schdSCellActCe.pres = PRSNT_NODEF;
202 tbInfo->schdSCellActCe.val = sCellActDeactBitMask;
205 } /* rgSCHSCellSchdActDeactCe */
209 * @brief Adds an UE to the Cell's SCell Activation list
213 * Function: rgSCHSCellAddToActDeactLst
214 * Purpose: Adds an UE to Cell's SCEll Act list
216 * Invoked by: Common Scheduler
218 * @param[in] RgSchCellCb* cell
219 * @param[in] RgSchUeCb* ue
224 PUBLIC Void rgSCHSCellAddToActDeactLst
230 PUBLIC Void rgSCHSCellAddToActDeactLst(cell, ue)
235 RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell);
236 TRC3(rgSCHSCellAddToActDeactLst);
238 if(NULLP == ue->sCellActLnk.node)
239 {/* Ue is not present in the list */
240 cmLListAdd2Tail(&cellCmnDl->secCellActCeLst, &ue->sCellActLnk);
241 ue->sCellActLnk.node = (PTR)ue;
245 RGSCHDBGINFONEW(cell->instIdx,(rgSchPBuf(cell->instIdx),
246 "SCell is already added in the Act List: ueId(%u)\n", ue->ueId));
254 * @brief Removes an UE from Cell's SCell Activation list
258 * Function: rgSCHSCellRmvFrmActLst
259 * Purpose: Removes an UE from Cell's SCEll Act list
261 * Invoked by: Specific Scheduler
263 * @param[in] RgSchCellCb* cell
264 * @param[in] RgSchUeCb* ue
269 PUBLIC Void rgSCHSCellRmvFrmActLst
275 PUBLIC Void rgSCHSCellRmvFrmActLst(cell, ue)
280 RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell);
281 TRC3(rgSCHSCellRmvFrmActLst);
282 if (NULLP != ue->sCellActLnk.node)
284 cmLListDelFrm(&cellCmnDl->secCellActCeLst, &ue->sCellActLnk);
286 ue->sCellActLnk.node = (PTR)NULLP;
292 * @brief Handling of SCell Activation
296 * Function: rgSCHSCellActivation
297 * Purpose : Perform Activation of secondary cell
298 * : Move the state to ACTIVE
299 * : Start the procedure for PCQI/SRS for this scell
301 * Invoked by:Cfg/Commn Scheduler
303 * @param[in] RgSchUeCellInfo *sCellInfo
305 * @return ROK/RFAILED
309 PUBLIC Void rgSCHSCellActivation
311 RgSchUeCellInfo *sCellInfo
314 PUBLIC Void rgSCHSCellActivation(sCellInfo)
315 RgSchUeCellInfo *sCellInfo
318 RgSchCellCb *sCell = sCellInfo->cell;
319 RgSchUeCb *ueCb = sCellInfo->ue;
320 RgSchCmnCell *cellSch;
323 Inst inst = ueCb->cell->instIdx;
326 RgrUePrdDlCqiCfg *cqiCfg;
327 U8 j; /*Bandwidth Parts*/
331 RgSchUePCqiCb *cqiCb = NULLP;
332 CmLteTimingInfo timingInfo;
336 TRC3(rgSCHSCellActivation);
338 sCellInfo->sCellState = RG_SCH_SCELL_ACTIVE;
340 ueCb->tenbStats->stats.persistent.numActivation++;
344 printf("ueId is SCELL_ACTIVE\n ueCb->ueId = %d sCell->sCellIdx =%d, sCell->sCellId=%d, sCell->sCellState=%d \n", ueCb->ueId, sCellInfo->sCellIdx, sCellInfo->sCellId, sCellInfo->sCellState);
346 /* Start the sCellDeactivation timer if cfgd */
347 if(PRSNT_NODEF == ueCb->sCellDeactTmrVal.pres)
349 //rgSCHTmrStartTmr (sCell,sCellInfo ,RG_SCH_TMR_SCELL_DEACT,
350 // ueCb->sCellDeactTmrVal.val);
354 /* Start receiving CQI for this SCell for this UE */
355 crntTime = (ueCb->cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)+
356 (ueCb->cell->crntTime.slot);
358 cqiCb = &sCellInfo->cqiCb;
359 cqiCfg = &cqiCb->cqiCfg;
360 if (cqiCfg->type == RGR_SCH_PCQI_SETUP)
362 cqiTrInstTime = ((cqiCb->cqiPeri+crntTime) - cqiCb->cqiOffset)
364 cqiCb->nCqiTrIdx = (crntTime +
365 (cqiCb->cqiPeri - cqiTrInstTime));
366 /* Introduced timing delta for reception req
368 if(cqiCb->nCqiTrIdx <= (crntTime + TFU_RECPREQ_DLDELTA))
370 cqiCb->nCqiTrIdx = cqiCb->nCqiTrIdx + cqiCb->cqiPeri;
373 timingInfo.sfn = cqiCb->nCqiTrIdx/RGSCH_NUM_SUB_FRAMES_5G;
374 timingInfo.slot = cqiCb->nCqiTrIdx%RGSCH_NUM_SUB_FRAMES_5G;
375 if(cqiCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP)
377 rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ueCb,cqiCb);
380 cqiCb->nCqiTrIdx = cqiCb->nCqiTrIdx
381 %RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
382 RGSCHDBGINFONEW(inst, (rgSchPBuf(inst), "CQI Config: idx(%u) Periodicity %u"
383 "Offset %u uePosInQ (%u)\n", cqiCfg->cqiSetup.cqiPCfgIdx,
384 cqiCb->cqiPeri, cqiCb->cqiOffset,cqiCb->nCqiTrIdx));
386 cmLListAdd2Tail(&ueCb->cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,
389 rgSCHUtlSCellHndlCqiCollsn(cqiCb);
391 RGSCHDBGINFO(inst,(rgSchPBuf(inst),
392 "\n rgSCHCfgPCqiUeCfg():"
393 " CrntTime=%d Next CqiTrInstTime=%d Index Stored at=%d ",
394 crntTime, cqiTrInstTime, cqiCb->nCqiTrIdx));
396 if(cqiCfg->cqiSetup.riEna)
399 cqiCb->invalidateCqi = FALSE;
401 if(RGR_UE_PCQI_WB_REP == cqiCfg->cqiSetup.cqiRepType)
404 1. wideband RI reporting is configured
406 (10*sfn+floor(subframe)-Noffsetcqi-NoffsetRI )Mod(NCqiperiod
409 periodicity = cqiCb->cqiPeri * cqiCb->riPeri;
414 * Where Widesband and Subband RI reporting is configured
416 * (10*sfn+floor(subframe)-Noffsetcqi-NoffsetRI )
417 * Mod(H. NCqiperiod *MriPeriod )=0
418 * where H= J * K +1; J=Number of bandwidth parts(BW/subsize).
419 * K is RGR interf input
422 RG_SCH_GET_CQI_J_VAL(sCell->bwCfg.dlTotalBw, j);
423 cqiCb->h = (cqiCb->cqiCfg.cqiSetup.k *j )+1;
424 periodicity = cqiCb->h * cqiCb->cqiPeri *
429 /* In case of SFN wraparound, the SB CQI reporting cycle breaks
430 * and RI->WB CQI->SBCQI.. should resume. RI is repositioned
431 * accordingly. WBCQI handling is naturally accomplished */
432 if (periodicity >= RGSCH_MAX_SUBFRM_5G)
434 periodicity = cqiCb->cqiOffset - cqiCb->riOffset +
435 RGSCH_MAX_SUBFRM_5G - (crntTime);
436 tempIdx = crntTime + periodicity;
440 riTrInsTime = ((periodicity +crntTime )- \
441 cqiCb->cqiOffset + cqiCb->riOffset)\
443 tempIdx = (crntTime + (periodicity -riTrInsTime));
445 if (tempIdx <= (crntTime + TFU_RECPREQ_DLDELTA))
447 tempIdx = tempIdx + periodicity;
449 cqiCb->nRiTrIdx = tempIdx
450 % RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
451 if(periodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
453 cqiCb->riDist = rgSCHUtlFindDist((U16)(crntTime + TFU_RECPREQ_DLDELTA),
462 /* Start receiving RI for this SCell for this UE */
463 cmLListAdd2Tail(&ueCb->cell->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst,
465 RG_SCH_RECORD(&cqiCb->histElem,RGSCH_ACTION_ADD,
466 &ueCb->cell->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst);
468 rgSCHUtlSCellHndlRiCollsn(cqiCb);
471 RGSCHDBGINFONEW(inst,(rgSchPBuf(inst), "SCel RI cfg:"
472 "idx %u period %u Offset %u posInQ(%u) riDist(%u)lst count"
473 "%lu\n", cqiCfg->cqiSetup.riCfgIdx, cqiCb->riPeri,
474 cqiCb->riOffset, cqiCb->nRiTrIdx, cqiCb->riDist,
475 ueCb->cell->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst.count));
477 RGSCHDBGINFONEW(inst,(rgSchPBuf(inst), "SCel RI cfg:"
478 "idx %u period %u Offset %u posInQ(%u) riDist(%u)lst count"
479 "%u\n", cqiCfg->cqiSetup.riCfgIdx, cqiCb->riPeri,
480 cqiCb->riOffset, cqiCb->nRiTrIdx, cqiCb->riDist,
481 ueCb->cell->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst.count));
486 RGSCHDBGINFO(inst,(rgSchPBuf(inst),
487 "\n rgSCHSCellActivation(): CrntTime=%d Next RiTrInstTime=%d"
488 "Index Stored at=%d riDis=%d ",
489 crntTime, riTrInsTime, cqiCb->nRiTrIdx, cqiCb->riDist));
494 cellSch = RG_SCH_CMN_GET_CELL(sCellInfo->cell);
495 cellSch->apisDl->rgSCHDlSCellActv(sCellInfo->cell, sCellInfo->ue);
503 * @brief Remove CQI from Scell Lst
507 * Function: rgSCHCellClearScellLstOfCQI
508 * Purpose : Remove CQI from Scell Lst
513 * @param[in] RgSchUeCellInfo *sCellInfo
518 PRIVATE Void rgSCHCellClearScellLstOfCQI
520 RgSchUeCellInfo *sCellInfo
523 PRIVATE Void rgSCHCellClearScellLstOfCQI(sCellInfo)
524 RgSchUeCellInfo *sCellInfo;
528 TRC3(rgSCHCellClearScellLstOfCQI);
529 RgSchUePCqiCb *cqiRiCb = NULLP;
531 ueCb = sCellInfo->ue;
532 /* Clear CQI/RI entry for this SCELL */
533 cqiRiCb = &sCellInfo->cqiCb;
534 /* Delete Periodic CQI/PMI Transmission Instance */
535 if (cqiRiCb->nCqiTrIdx != RG_SCH_INVALID_IDX)
537 cmLListDelFrm(&ueCb->cell->pCqiSrsSrLst[cqiRiCb->nCqiTrIdx].cqiLst,
538 &cqiRiCb->cqiLstEnt);
539 cqiRiCb->nCqiTrIdx = RG_SCH_INVALID_IDX;
541 if (ueCb->nPCqiCb == cqiRiCb)
543 rgSCHUtlSCellHndlCqiCollsn(&ueCb->cellInfo[RGSCH_PCELL_INDEX]->cqiCb);
545 /* Delete Periodic RI Transmission Instance */
547 if (cqiRiCb->nRiTrIdx != RG_SCH_INVALID_IDX)
549 cmLListDelFrm(&ueCb->cell->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst,
551 RG_SCH_RECORD(&cqiRiCb->histElem,RGSCH_ACTION_DEL,
552 &ueCb->cell->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst);
553 cqiRiCb->nRiTrIdx = RG_SCH_INVALID_IDX;
554 if (ueCb->nPRiCb == cqiRiCb)
556 rgSCHUtlSCellHndlRiCollsn(&ueCb->cellInfo[RGSCH_PCELL_INDEX]->cqiCb);
563 #endif/*TFU_UPGRADE*/
566 * @brief Handling of SCell DeActivation
570 * Function: rgSCHSCellDeActivation
571 * Purpose : Perform Deactivation of secondary cell
572 * : Move the state to IN_ACTIVE
573 * : Flush the harqEntity
574 * : Trigger harqEntity flushing to MAC
575 * : Remove PCQI/SRS for this scell
576 * : Stop Deactivation timer if running
578 * Invoked by:Cfg/Commn Scheduler
580 * @param[in] RgSchUeCellInfo *sCellInfo
582 * @return ROK/RFAILED
586 PRIVATE S16 rgSCHSCellDeActivation
588 RgSchUeCellInfo *sCellInfo
591 PRIVATE S16 rgSCHSCellDeActivation(sCellInfo)
592 RgSchUeCellInfo *sCellInfo
596 RgSchCmnCell *cellSch;
597 Inst inst = sCellInfo->cell->instIdx;
599 TRC3(rgSCHSCellDeActivation);
600 /* Stop the timer if running */
602 if(sCellInfo->deactTmr.tmrEvnt != TMR_NONE)
604 rgSCHTmrStopTmr(sCellInfo->cell, RG_SCH_TMR_SCELL_DEACT, sCellInfo);
607 if (sCellInfo->actDelayTmr.tmrEvnt != TMR_NONE)
609 rgSCHTmrStopTmr(sCellInfo->cell, RG_SCH_TMR_SCELL_ACT_DELAY, sCellInfo);
612 cellSch = RG_SCH_CMN_GET_CELL(sCellInfo->cell);
613 cellSch->apisDl->rgSCHDlUeReset(sCellInfo->cell, sCellInfo->ue);
615 if(sCellInfo->ue->isDrxEnabled)
617 rgSCHDrxUeHqReset(sCellInfo->ue->cell, sCellInfo->ue,
618 sCellInfo->hqEnt, sCellInfo->sCellIdx);
621 /* Flush the harqEntity at scheduler */
622 if(sCellInfo->hqEnt != NULLP)
624 rgSCHDhmHqEntReset(sCellInfo->hqEnt);
626 /* Trigger harq flush req to MAC */
629 rgSCHSCellTrgMacHqEReset(inst,sCellInfo->sCellId,sCellInfo->ue->ueId);
631 sCellInfo->sCellState = RG_SCH_SCELL_READY;
633 rgSCHCellClearScellLstOfCQI(sCellInfo);
637 sCellInfo->ue->tenbStats->stats.persistent.numDeactivation++;
640 cellSch->apisDl->rgSCHDlSCellDeactv(sCellInfo->cell, sCellInfo->ue);
643 printf("SCELL DEATIVATED sCellInfo->ue->ueId =%d, sCellInfo->sCellId =%d\n", sCellInfo->ue->ueId, sCellInfo->sCellId);
644 //MSPD_DBG("SCELL DEATIVATED sCellInfo->ue->ueId =%d, sCellInfo->sCellId =%d\n", sCellInfo->ue->ueId, sCellInfo->sCellId);
651 * @brief Triggering hqEntity reset to mac
655 * Function: rgSCHSCellTrgMacHqEReset
656 * Purpose: Frame the interface for mac to reset
658 * Derive the macInstance corresponding
659 * to the secondary cell going to be deactivated.
660 * Triiger the msg to that macInstance
662 * Invoked by: CommonScheduler
664 * @param[in] U16 sCellId
665 * @param[in] U16 rnti
670 PRIVATE S16 rgSCHSCellTrgMacHqEReset
677 PRIVATE S16 rgSCHSCellTrgMacHqEReset(inst,secCellId,rnti)
684 RgSchCellCb *secCellCb = NULLP;
685 RgInfResetHqEnt hqEntRstInfo;
687 if((secCellCb = (RgSchCellCb *)rgSchUtlGetCellCb(inst, secCellId)) == NULLP)
689 RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "SCell doesnt exists"));
693 hqEntRstInfo.cellId = secCellId;
694 hqEntRstInfo.crnti = rnti;
696 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[inst], secCellCb->macInst);
698 RgSchMacRstHqEnt(&pst, &hqEntRstInfo);
707 * @brief Handling of harq feeback for SCell act CE txion
711 * Function: rgSCHSCellHndlFdbkInd
712 * Purpose: Handling the harq feedback for SCell ACT ce txion
713 * ACK:: Set the state as active for the Scells for which
715 * HQ FAILURE/DTX/NACK:: Perform retxion. Add to Act CE list
716 * Set the state to TOBE_SCHEDULED
719 * Invoked by: CommonScheduler
721 * @param[in] RgSchCellCb* cell
722 * @param[in] RgSchUeCb* ue
727 PUBLIC Void rgSCHSCellHndlFdbkInd
729 RgSchDlHqProcCb *hqP,
732 Bool maxHqRetxReached
735 PUBLIC Void rgSCHSCellHndlFdbkInd(hqP, tbIdx, fdbk,maxHqRetxReached)
736 RgSchDlHqProcCb *hqP;
739 Bool maxHqRetxReached;
745 RgSchUeCellInfo *sCellInfo;
747 TRC3(rgSCHSCellHndlFdbkInd);
755 hqP->tbInfo[tbIdx].schdSCellActCe.pres = FALSE;
757 for(U8 idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
759 if(ueCb->cellInfo[idx] != NULLP)
761 if(ueCb->cellInfo[idx]->sCellState == RG_SCH_SCELL_ACTVTN_IN_PROG)
764 printf("\n starting delay timer...\n");
766 rgSCHTmrStartTmr (cell,ueCb->cellInfo[idx] ,RG_SCH_TMR_SCELL_ACT_DELAY,
767 RG_SCH_CMN_SCELL_ACT_DELAY_TMR);
771 if(ueCb->cellInfo[idx]->sCellState == RG_SCH_SCELL_DEACTVTN_IN_PROG)
773 sCellInfo = ueCb->cellInfo[idx];
774 rgSCHSCellDeActivation(sCellInfo);
784 if(TRUE == maxHqRetxReached)
786 hqP->tbInfo[tbIdx].schdSCellActCe.pres = FALSE;
787 for(U8 idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
789 if(ueCb->cellInfo[idx] != NULLP)
791 if(ueCb->cellInfo[idx]->sCellState == RG_SCH_SCELL_ACTVTN_IN_PROG)
793 ueCb->cellInfo[idx]->sCellState = RG_SCH_SCELL_TOBE_ACTIVATED;
797 if(ueCb->cellInfo[idx]->sCellState == RG_SCH_SCELL_DEACTVTN_IN_PROG)
799 ueCb->cellInfo[idx]->sCellState = RG_SCH_SCELL_TOBE_DEACTIVATED;
803 /* Add to actDeactCe lst */
804 rgSCHSCellAddToActDeactLst(cell,ueCb);
817 * @brief Handling of SCell Deactivation Tmr Expiry
821 * Function: rgSCHSCellDeactTmrExpry
822 * Purpose : Deactivating the SCell. a
823 * Clear all the Harq Procs associated with this
825 * Trigger Harq Reset to the respective MAC
826 * Set the state of the cell to Inactive
831 * @param[in] RgSchUeCellInfo *sCellInfo
836 PUBLIC Void rgSCHSCellDeactTmrExpry
838 RgSchUeCellInfo *sCellInfo
841 PUBLIC Void rgSCHSCellDeactTmrExpry(sCellInfo)
842 RgSchUeCellInfo *sCellInfo;
846 TRC3(rgSCHSCellDeactTmrExpry);
847 if (sCellInfo->ue->isScellExplicitDeAct == TRUE)
849 /* Deactivation Timer is not configured (infinity), thus send deactivation CE explicitly */
850 /* No doing Deactivaiton of LAA Cell */
851 if (FALSE == rgSCHLaaSCellEnabled(sCellInfo->cell))
853 rgSCHSCellTrigActDeact(sCellInfo->ue->cell, sCellInfo->ue, sCellInfo->sCellIdx, RGR_SCELL_DEACT);
857 printf (" !!!!!! Avoiding DEACT for UE %d because of LAA Cell !!!!!!!!!!!!! \n",
858 sCellInfo->ue->ueId);
864 /* Deactivation Timer is configured, thus assume that UE has deactivated */
865 rgSCHSCellDeActivation(sCellInfo);
872 * @brief This function handles the action of the SCell
876 * Function: rgSCHSCellTrigActDeact
878 * 1) Prepares SCELL ready for activation OR
879 * 2) Initiates activation of SCELL OR
880 * 3) Initiate deactivation of SCELL OR
882 * Invoked by:Cfg/Commn Scheduler
884 * @param[in] RgSchCellCb *cellCb
885 * @param[in] RgSchUeCb *ueCb
886 * @param[in] U8 sCellIdx
887 * @param[in] U8 action
889 * @return ROK/RFAILED
893 PUBLIC S16 rgSCHSCellTrigActDeact
901 PUBLIC S16 rgSCHSCellTrigActDeact(cell,ueCb,sCellIdx,action)
908 Inst inst = cell->instIdx;
911 TRC3(rgSCHSCellTrigActDeact);
914 (sCellIdx > RGR_MAX_SCELL_PER_UE))
916 RGSCHDBGERRNEW(inst, (rgSchPBuf(inst),"Invalid Serv Cell Idx %d\n", \
921 if(ueCb->cellInfo[sCellIdx] == NULLP)
923 RGSCHDBGERRNEW(inst, (rgSchPBuf(inst),"Serv Cell not added to this Ue Scell Idx %d ueId %d\n", \
924 sCellIdx,ueCb->ueId));
930 case RGR_SCELL_READY:
932 if(ueCb->cellInfo[sCellIdx]->sCellState != RG_SCH_SCELL_INACTIVE)
934 RGSCHDBGERRNEW(inst, (rgSchPBuf(inst),"Invalid state %u for preparing SCell Idx %u for UE %u\n", \
935 ueCb->cellInfo[sCellIdx]->sCellState, sCellIdx, ueCb->ueId));
940 ueCb->cellInfo[sCellIdx]->sCellState = RG_SCH_SCELL_READY;
941 //TODO_SID Activating the cell directly. Ignoring the ActCe procedure.
942 rgSCHSCellActivation(ueCb->cellInfo[sCellIdx]);
943 /* Setting allocCmnUlPdcch flag to FALSE, So that PDCCH allocation will be done
944 from UE Searchspace */
945 ueCb->allocCmnUlPdcch = FALSE;
946 printf("\n***** SCellIdx=%d state Changed to %d State \n",sCellIdx, ueCb->cellInfo[sCellIdx]->sCellState);
947 printf("\n***** SCellInfo Addr=%p state Changed to RG_SCH_SCELL_READY\n",(void*)ueCb->cellInfo[sCellIdx]);
953 if(ueCb->cellInfo[sCellIdx]->sCellState != RG_SCH_SCELL_READY)
955 RGSCHDBGERRNEW(inst, (rgSchPBuf(inst),"Invalid state %u for activating SCell Idx %u for UE %u\n", \
956 ueCb->cellInfo[sCellIdx]->sCellState, sCellIdx, ueCb->ueId));
961 ueCb->cellInfo[sCellIdx]->sCellState = RG_SCH_SCELL_TOBE_ACTIVATED;
962 if (NULLP == ueCb->sCellActLnk.node)
964 /* Add only if UE is not already present in the activation/deactivation list */
965 rgSCHSCellAddToActDeactLst(cell,ueCb);
970 case RGR_SCELL_DEACT:
972 if(ueCb->cellInfo[sCellIdx]->sCellState != RG_SCH_SCELL_ACTIVE)
974 RGSCHDBGERRNEW(inst, (rgSchPBuf(inst),"Invalid state %u for deactivating SCell Idx %u for UE %u\n", \
975 ueCb->cellInfo[sCellIdx]->sCellState, sCellIdx, ueCb->ueId));
980 ueCb->cellInfo[sCellIdx]->sCellState = RG_SCH_SCELL_TOBE_DEACTIVATED;
981 if (NULLP == ueCb->sCellActLnk.node)
983 /* Add only if UE is not already present in the activation/deactivation list */
984 rgSCHSCellAddToActDeactLst(cell,ueCb);
991 RGSCHDBGERRNEW(inst, (rgSchPBuf(inst),"Invalid action received for SCell Idx %u for UE %u\n", \
992 sCellIdx, ueCb->ueId));
1002 * @brief SCell Activation of selected cell
1006 * Function: rgSCHSCellSelectForAct
1007 * Purpose : Perform Selection of secondary cell for activation
1009 * Invoked by:Cfg/Commn Scheduler
1011 * @param[in] RgSchCellCb *cellCb
1012 * @param[in] RgSchUeCb *ueCb
1014 * @return ROK/RFAILED
1018 PRIVATE S16 rgSCHSCellSelectForAct
1025 PRIVATE S16 rgSCHSCellSelectForAct(cell, ueCb)
1031 TRC3(rgSCHSCellSelectAndAct);
1033 for((*sCellIdx) = 1; (*sCellIdx) <= RG_SCH_MAX_SCELL; (*sCellIdx)++)
1035 if((ueCb->cellInfo[(*sCellIdx)] != NULLP) &&
1036 (ueCb->cellInfo[(*sCellIdx)]->sCellState == RG_SCH_SCELL_READY))
1045 * @brief SCell Activation of selected cell
1049 * Function: rgSCHSCellSelectAndActDeAct
1050 * Purpose : Perform Selection and Activation/Deactivation of secondary cell
1052 * Invoked by:Cfg/Commn Scheduler
1054 * @param[in] RgSchCellCb *cellCb
1055 * @param[in] RgSchUeCb *ueCb
1056 * @param[in] U8 action
1062 PUBLIC Void rgSCHSCellSelectAndActDeAct
1069 PUBLIC Void rgSCHSCellSelectAndActDeAct(pCell, ueCb, action)
1083 if(((ret = rgSCHSCellSelectForAct(pCell, ueCb, &sCellIdx)) == ROK)
1092 (ROK != (rgSCHSCellTrigActDeact(pCell, ueCb, sCellIdx, action))))
1094 RGSCHDBGERR(pCell->instIdx,(rgSchPBuf(pCell->instIdx), "SCell Actication failed"
1095 "for UE [%d] with SCellIdx [%d]\n", ueCb->ueId, sCellIdx));
1102 * @brief Handling of Scell Deletion
1106 * Function: rgSCHSCellDelUeSCell
1107 * Purpose : Perform Scell Deletion for an UE
1108 * : flush harqEnttiy of the given scell associated
1112 * Invoked by:Cfg module
1114 * @param[in] RgSchCellCb *cellCb
1115 * @param[in] RgSchUeCb *ueCb
1117 * @return ROK/RFAILED
1121 PUBLIC Void rgSCHSCellDelUeSCell
1123 RgSchCellCb *cellCb,
1128 PUBLIC Void rgSCHSCellDelUeSCell(cellCb,ueCb,sCellIdx)
1129 RgSchCellCb *cellCb;
1134 RgUeUlHqCb *ulHqEnt;
1135 Inst inst = cellCb->instIdx;
1136 RgSchUeCellInfo *sCellInfo;
1139 TRC3(rgSCHSCellDelUeSCell);
1140 sCellInfo = ueCb->cellInfo[sCellIdx];
1143 if(sCellInfo == NULLP)
1145 RGSCHDBGERRNEW(inst, (rgSchPBuf(inst),"Serv Cell not added to this Ue Scell Idx %d\
1147 sCellIdx,ueCb->ueId));
1151 rgSCHDbmDelUeCb(sCellInfo->cell, ueCb);
1152 ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, sCellInfo->cell);
1154 if (NULLP != sCellInfo->sCellLnk.node)
1156 cmLListDelFrm(&sCellInfo->cell->sCellUeLst, &sCellInfo->sCellLnk);
1159 /* Clear Scheduler specific list for this UE from the
1160 * corresponding CELL */
1162 /*Updating 1BCS Value*/
1163 ueCb->f1bCsAVal = (ueCb->f1bCsAVal -
1164 rgSCHUtlGetMaxTbSupp(sCellInfo->txMode.txModeEnum));
1167 rgSCHUtlDelUeANFdbkInfo(ueCb,sCellIdx);
1170 rgSCHSCellDeActivation(sCellInfo);
1171 /* Release hqEnt mem */
1172 rgSCHDhmDelHqEnt(cellCb, &sCellInfo->hqEnt);
1174 ulHqEnt = &(ueUl->hqEnt);
1176 cellCb->sc.apis->rgSCHRgrSCellUeDel(sCellInfo, sCellInfo->ue);
1178 rgSCHUhmFreeUe(sCellInfo->cell, ulHqEnt);
1180 rgSCHUtlFreeSBuf(cellCb->instIdx,
1181 (Data**)(&(sCellInfo)), (sizeof(RgSchUeCellInfo)));
1183 ueCb->cellInfo[sCellIdx] = NULLP;
1189 * @brief Handling of UE Deletion
1193 * Function: rgSCHSCellDelUe
1194 * Purpose : Perform UE Deletion
1195 * : Delete all the SCells added for this UE
1196 * : flush harqEnttiy of all scells associated
1200 * Invoked by:Cfg module
1202 * @param[in] RgSchCellCb *cellCb
1203 * @param[in] RgSchUeCb *ueCb
1204 * @return ROK/RFAILED
1208 PUBLIC S16 rgSCHSCellDelUe
1210 RgSchCellCb *cellCb,
1214 PUBLIC S16 rgSCHSCellDelUe(cellCb,ueCb)
1215 RgSchCellCb *cellCb;
1220 TRC3(rgSCHSCellDelUe);
1222 for(U8 idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
1224 rgSCHSCellDelUeSCell(cellCb,ueCb,idx);
1233 * @brief Handling of PCqi cfg fro a scell
1237 * Function: rgSCHSCellPCqiCfg
1239 * : Delete all the SCells added for this UE
1240 * : flush harqEnttiy of all scells associated
1243 * - For SCell-specific Periodic CQI related configuration,
1244 * - If Periodic CQI/PMI is configured,
1245 * - Update SCell with the configured values.
1246 * - Update the CQI offset and CQI perodicity information
1249 * - For SCell-specific Periodic RI related configuration,
1250 * - If Periodic RI is configured,
1251 * - Update SCell with the configured values.
1252 * - Update the RI offset and RI perodicity information
1255 * Invoked by:Cfg module
1257 * @param[in] RgSchCellCb *cellCb
1258 * @param[in] RgSchUeCb *ueCb
1259 * @return ROK/RFAILED
1263 PUBLIC S16 rgSCHSCellPCqiCfg
1265 RgSchCellCb *priCellCb,
1266 RgSchCellCb *secCellCb,
1268 RgrUePrdDlCqiCfg *cqiCfg,
1269 CmLteUeCategory ueCat,
1273 PUBLIC S16 rgSCHSCellPCqiCfg(priCellCb,secCellCb,ueCb,cqiCfg,ueCat,sCellIdx)
1274 RgSchCellCb *priCellCb;
1275 RgSchCellCb *secCellCb;
1277 RgrUePrdDlCqiCfg *cqiCfg;
1278 CmLteUeCategory ueCat;
1282 U8 j; /*Bandwidth Parts*/
1285 Inst inst = priCellCb->instIdx;
1287 RgSchUeCellInfo *sCellInfo;
1288 RgSchUePCqiCb *cqiCb = NULLP;
1290 TRC3(rgSCHSCellPCqiCfg);
1292 RGSCHDBGINFO(priCellCb->instIdx, (rgSchPBuf(priCellCb->instIdx),
1293 "rgSCHSCellPCqiCfg cellId =%d, ueId = %d, CfgType =%d\n",
1294 secCellCb->cellId, ueCb->ueId, cqiCfg->type));
1296 if((sCellIdx < 1) ||
1297 (sCellIdx > RGR_MAX_SCELL_PER_UE))
1299 RGSCHDBGERRNEW(inst, (rgSchPBuf(inst),"Invalid Serv Cell Idx %d\n",
1304 sCellInfo = ueCb->cellInfo[sCellIdx];
1306 cqiCb = &ueCb->cellInfo[sCellIdx]->cqiCb;
1307 cqiCb->servCellInfo = sCellInfo;
1309 /* Periodic CQI is setup */
1310 if (cqiCfg->type == RGR_SCH_PCQI_SETUP)
1312 /* 1. Copy the Received CQI Cfg parameters to ueCb */
1313 cmMemcpy((U8 *)&cqiCb->cqiCfg, (U8 *)cqiCfg,
1314 sizeof(RgrUePrdDlCqiCfg));
1316 /* 2. Compute Periodic CQI Periodicity and subframe offset */
1318 rgSCHUtlGetCfgPerOff(RG_SCH_FDD_PCQI_TBL, cqiCfg->cqiSetup.cqiPCfgIdx,
1319 &cqiCb->cqiPeri, &cqiCb->cqiOffset);
1321 rgSCHUtlGetCfgPerOff( RG_SCH_TDD_PCQI_TBL,
1322 cqiCfg->cqiSetup.cqiPCfgIdx,
1323 &cqiCb->cqiPeri, &cqiCb->cqiOffset);
1327 RGSCHDBGINFO(priCellCb->instIdx,(rgSchPBuf(priCellCb->instIdx),
1328 "\n rgSCHSCellPCqiCfg(): CQI Peri=%d, CQI Offset=%d",
1329 cqiCb->cqiPeri,cqiCb->cqiOffset));
1331 if(RGR_UE_PCQI_SB_REP == cqiCfg->cqiSetup.cqiRepType)
1333 U8 k; /*SubBand Size (RB) */
1334 RG_SCH_GET_CQI_J_VAL(secCellCb->bwCfg.dlTotalBw, j);
1335 RG_SCH_GET_CQI_K_VAL(secCellCb->bwCfg.dlTotalBw, k);
1336 cqiCb->J = j; /*Number of Bandwidth Parts*/
1337 /*h: reporting instances required for a complete CQI/PMI report */
1338 /*j:Number of bandwidth parts; k: Subband Size*/
1339 cqiCb->h = (cqiCb->cqiCfg.cqiSetup.k *j )+1;
1340 /* ccpu00140905- L-size is coming as 3 for 100Rbs where it should be 2*/
1341 temp = RGSCH_CEIL(secCellCb->bwCfg.dlTotalBw, (j*k));
1342 cqiCb->label = (temp & (temp-1)) ?
1343 (1+ rgSCHUtlLog32bitNbase2(temp)) : rgSCHUtlLog32bitNbase2(temp);
1347 /* Wideband Cqi Rep Type */
1348 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1;
1350 cqiCb->cqiLstEnt.node=(PTR)cqiCb;
1351 cqiCb->isCqiIgnoByCollsn = FALSE;
1354 /* 4. Rank Indicator Cfg handler */
1355 /* 1. Rank Indicator is enabled */
1356 if(cqiCfg->cqiSetup.riEna)
1358 rgSCHUtlGetCfgPerOff(RG_SCH_RI_TBL,
1359 cqiCfg->cqiSetup.riCfgIdx,
1360 &cqiCb->riPeri, &cqiCb->riOffset);
1362 RGSCHDBGINFO(priCellCb->instIdx,(rgSchPBuf(priCellCb->instIdx),
1363 "\n rgSCHSCellPCqiCfg(): RI Peri=%d, RI Offset=%d",
1364 cqiCb->riPeri,cqiCb->riOffset));
1366 if(ueCb->cellInfo[sCellIdx]->txMode.txModeEnum == RGR_UE_TM_3
1367 || ueCb->cellInfo[sCellIdx]->txMode.txModeEnum == RGR_UE_TM_4)
1369 if (secCellCb->numTxAntPorts ==2)
1371 cqiCb->riNumBits = 1;
1373 else if(secCellCb->numTxAntPorts ==4)
1375 if(ueCat == CM_LTE_UE_CAT_8)
1377 cqiCb->riNumBits = 3;
1379 else if((ueCat == CM_LTE_UE_CAT_5) ||
1380 (ueCat == CM_LTE_UE_CAT_6) || CM_LTE_UE_CAT_7)
1382 cqiCb->riNumBits = 2;
1386 cqiCb->riNumBits = 1;
1390 cqiCb->riLstEnt.node=(PTR) cqiCb;
1391 cqiCb->isRiIgnoByCollsn = FALSE;
1397 sCellInfo->cqiCb.cqiCfg.type = RGR_SCH_PCQI_REL;
1399 /* Setting the indices to invalid during
1400 scell addition. These indices will be set during
1402 cqiCb->nRiTrIdx = RG_SCH_INVALID_IDX;
1403 cqiCb->riDist = RG_SCH_INVALID_IDX;
1404 cqiCb->nCqiTrIdx = RG_SCH_INVALID_IDX;
1411 * @brief Handling of Ue Reset from common scheduler
1415 * Function: rgSCHSCellDlUeReset
1416 * Purpose: Call scheudler type spcefic UE RESET
1417 * for all the secondary cells
1419 * Invoked by: CommonScheduler
1421 * @param[in] RgSchCellCb* cell
1422 * @param[in] RgSchUeCb* ue
1427 PUBLIC Void rgSCHSCellDlUeReset
1433 PUBLIC Void rgSCHSCellDlUeReset(cell, ue)
1438 RgSchCmnCell *cellSch;
1439 TRC3(rgSCHSCellDlUeReset);
1441 for(U8 idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
1443 if(ue->cellInfo[idx] != NULLP)
1445 cellSch = RG_SCH_CMN_GET_CELL(ue->cellInfo[idx]->cell);
1446 cellSch->apisDl->rgSCHDlUeReset(ue->cellInfo[idx]->cell, ue);
1447 rgSCHSCellDeActivation(ue->cellInfo[idx]);
1448 ue->cellInfo[idx]->sCellState = RG_SCH_SCELL_INACTIVE;
1456 * @brief Handling of LC Cfg from common scheduler
1460 * Function: rgSCHSCellDlLcCfg
1461 * Purpose: Call scheudler type spcefic LC config
1462 * for all the secondary cells
1464 * Invoked by: CommonScheduler
1466 * @param[in] RgSchCellCb* cell
1467 * @param[in] RgSchUeCb* ue
1472 PUBLIC Void rgSCHSCellDlLcCfg
1479 PUBLIC Void rgSCHSCellDlLcCfg(cell, ue, svc)
1485 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
1486 TRC3(rgSCHSCellDlLcCfg);
1487 for(U8 idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
1489 if(ue->cellInfo[idx] != NULLP)
1491 cellSch->apisDl->rgSCHRgrDlLcCfg(ue->cellInfo[idx]->cell, ue, svc,NULLP,NULLP);
1498 * @brief Handling of LC Delete from common scheduler
1502 * Function: rgSCHSCellDlLcDel
1503 * Purpose: Call scheudler type spcefic bo update handler
1504 * for all the secondary cells
1506 * Invoked by: CommonScheduler
1508 * @param[in] RgSchCellCb* cell
1509 * @param[in] RgSchUeCb* ue
1514 PUBLIC Void rgSCHSCellDlLcDel
1521 PUBLIC Void rgSCHSCellDlLcDel(cell, ue, svc)
1527 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
1528 TRC3(rgSCHSCellDlLcDel);
1529 for(U8 idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
1531 if(ue->cellInfo[idx] != NULLP)
1533 cellSch->apisDl->rgSCHFreeDlLc(ue->cellInfo[idx]->cell, ue, svc);
1540 * @brief Handling of Bo update from common scheduler
1544 * Function: rgSCHSCellDlDedBoUpd
1545 * Purpose: Call scheudler type spcefic bo update handler
1546 * for all the secondary cells
1548 * Invoked by: CommonScheduler
1550 * @param[in] RgSchCellCb* cell
1551 * @param[in] RgSchUeCb* ue
1556 PUBLIC Void rgSCHSCellDlDedBoUpd
1563 PUBLIC Void rgSCHSCellDlDedBoUpd(cell, ue, svc)
1569 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
1570 TRC3(rgSCHSCellDlDedBoUpd);
1572 /* If this is not invoked by PCell, then
1573 invoke the call to PCell handler
1574 This happens during finalization if LC Bo becomes zero*/
1575 if (ue->cell != cell)
1577 cellSch->apisDl->rgSCHDlDedBoUpd(ue->cell, ue, svc);
1579 for(U8 idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
1581 if((ue->cellInfo[idx] != NULLP) &&
1582 (ue->cellInfo[idx]->sCellState == RG_SCH_SCELL_ACTIVE) &&
1583 (ue->cellInfo[idx]->cell != cell))
1585 cellSch->apisDl->rgSCHDlDedBoUpd(ue->cellInfo[idx]->cell, ue, svc);
1592 * @brief Compare two CQI CB configs are return the result
1596 * Function: rgSCHUtlSCellCmpCqiCfg
1597 * Purpose : Compare priority levels of cqiCb1 and cqiCb2
1598 * and set the isCqiIgnoByCollsn to TRUE for the
1599 * cqiCb which has lower priority
1600 * Invoked by:scell module
1602 * @param[in] RgSchUePCqiCb *cqiCb1
1603 * @param[in] RgSchUePCqiCb *cqiCb2
1604 * @return U8 cqiCb cell idx which has the higher priority
1608 PRIVATE U8 rgSCHUtlSCellCmpCqiCfg
1610 RgSchUePCqiCb *cqiCb1,
1611 RgSchUePCqiCb *cqiCb2
1614 PRIVATE U8 rgSCHUtlSCellCmpCqiCfg(cqiCb1, cqiCb2)
1615 RgSchUePCqiCb *cqiCb1;
1616 RgSchUePCqiCb *cqiCb2;
1619 RgSchUePCqiCb *retCqiCb;
1620 TRC3(rgSCHUtlSCellCmpCqiCfg);
1621 /* Collision rules are defined in TS 36.213,7.2.2 */
1622 /* RI, WB first PMI > WB CQI > SB CQI */
1623 /* As of now only taking care of RI > WB CQI > SB CQI */
1625 if (cqiCb1->prioLvl > cqiCb2->prioLvl)
1627 cqiCb2->isCqiIgnoByCollsn = TRUE;
1628 cqiCb1->isCqiIgnoByCollsn = FALSE;
1631 else if (cqiCb2->prioLvl > cqiCb1->prioLvl)
1633 cqiCb1->isCqiIgnoByCollsn = TRUE;
1634 cqiCb2->isCqiIgnoByCollsn = FALSE;
1639 if (cqiCb1->servCellInfo->sCellIdx > cqiCb2->servCellInfo->sCellIdx)
1641 cqiCb1->isCqiIgnoByCollsn = TRUE;
1642 cqiCb2->isCqiIgnoByCollsn = FALSE;
1647 cqiCb2->isCqiIgnoByCollsn = TRUE;
1648 cqiCb1->isCqiIgnoByCollsn = FALSE;
1653 return (retCqiCb->servCellInfo->sCellIdx);
1657 * @brief Handling of collision of CQI types between serving cells
1661 * Function: rgSCHUtlSCellHndlCqiCollsn
1662 * Purpose : Takes care of collision clauses specified in 36.213 7.2.2 Rel 10
1663 * and selects next nearest cqiCb
1664 * Invoked by:Cfg module
1666 * @param[in] RgSchCellCb *cellCb
1667 * @param[in] RgSchUeCb *ueCb
1668 * @return ROK/RFAILED
1672 PUBLIC S16 rgSCHUtlSCellHndlCqiCollsn
1674 RgSchUePCqiCb *cqiCb
1677 PUBLIC S16 rgSCHUtlSCellHndlCqiCollsn(cqiCb)
1678 RgSchUePCqiCb *cqiCb;
1681 U32 nPCqiServCellIdx;
1685 RgSchCellCb *priCellCb = cqiCb->servCellInfo->ue->cell;
1686 RgSchUeCb *ueCb = cqiCb->servCellInfo->ue;
1690 CmLteTimingInfo timingInfo;
1692 TRC3(rgSCHUtlSCellHndlCqiCollsn);
1695 RG_SCH_ADD_TO_CRNT_TIME(priCellCb->crntTime, timingInfo, TFU_DELTA);
1697 RG_SCH_ADD_TO_CRNT_TIME(priCellCb->crntTime, timingInfo,
1698 TFU_RECPREQ_DLDELTA);
1701 RG_SCH_GET_IDX_PCQISRSSR(timingInfo, crntSfIdx);
1703 cqiCb->isCqiIgnoByCollsn = FALSE;
1705 pCqiTrIdx = cqiCb->nCqiTrIdx;
1706 nPCqiServCellIdx = cqiCb->servCellInfo->sCellIdx;
1707 /* Handle wrap around case */
1708 if (pCqiTrIdx < crntSfIdx)
1710 pCqiTrIdx += RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1712 minPCqiTrIdx = pCqiTrIdx;
1714 for (cellIdx =0; cellIdx <= RG_SCH_MAX_SCELL; cellIdx++)
1716 /* If a serving cell is configured */
1717 if(ueCb->cellInfo[cellIdx] != NULLP)
1719 /* If the serving cell is in ACTIVE state and
1720 If it is not the same serving cell as cqiCb for which
1721 collision is being checked */
1722 if ((ueCb->cellInfo[cellIdx]->sCellState == RG_SCH_SCELL_ACTIVE)&&
1723 (cellIdx != cqiCb->servCellInfo->sCellIdx))
1725 scellPCqiTrIdx = ueCb->cellInfo[cellIdx]->cqiCb.nCqiTrIdx;
1727 /* Handle wrap around case */
1728 if (scellPCqiTrIdx < crntSfIdx)
1730 scellPCqiTrIdx += RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1733 /* If cqiCb->isCqiIgnoByCollsn is TRUE then a higher prio cqiCb
1734 is already found so need to compare */
1735 if ((FALSE == ueCb->cellInfo[cellIdx]->cqiCb.isCqiIgnoByCollsn) &&
1736 (FALSE == cqiCb->isCqiIgnoByCollsn) &&
1737 (scellPCqiTrIdx == pCqiTrIdx))
1739 /* Handle Collision */
1740 /* set isCqiIgnoByCollsn to TRUE for low prio CQI Rep type */
1741 nPCqiServCellIdx = rgSCHUtlSCellCmpCqiCfg(&ueCb->cellInfo[cellIdx]->cqiCb,cqiCb);
1743 else if (scellPCqiTrIdx < minPCqiTrIdx)
1745 minPCqiTrIdx = scellPCqiTrIdx;
1746 nPCqiServCellIdx = cellIdx;
1750 /* If all of the num of configured scells are checked then break */
1751 if (sCellCnt == ueCb->numSCells)
1759 /* Set the next expected Cqi into nPCqiCb */
1760 idx = ((nPCqiServCellIdx)& (CM_LTE_MAX_CELLS -1));
1761 ueCb->nPCqiCb = &ueCb->cellInfo[idx]->cqiCb;
1768 * @brief Handling of collision of RI types between serving cells
1772 * Function: rgSCHUtlSCellHndlRiCollsn
1773 * Purpose : Takes care of collision clauses specified in 36.213 7.2.2 Rel 10
1774 * and selects next nearest cqiCb
1775 * Invoked by:Cfg module
1777 * @param[in] RgSchCellCb *cellCb
1778 * @param[in] RgSchUeCb *ueCb
1779 * @return ROK/RFAILED
1783 PUBLIC S16 rgSCHUtlSCellHndlRiCollsn
1785 RgSchUePCqiCb *cqiCb
1788 PUBLIC S16 rgSCHUtlSCellHndlRiCollsn(cqiCb)
1789 RgSchUePCqiCb *cqiCb;
1792 U32 nPRiServCellIdx;
1796 RgSchCellCb *priCellCb = cqiCb->servCellInfo->ue->cell;
1797 RgSchUeCb *ueCb = cqiCb->servCellInfo->ue;
1801 CmLteTimingInfo timingInfo;
1802 TRC3(rgSCHUtlSCellHndlRiCollsn);
1805 RG_SCH_ADD_TO_CRNT_TIME(priCellCb->crntTime, timingInfo, TFU_DELTA);
1807 RG_SCH_ADD_TO_CRNT_TIME(priCellCb->crntTime, timingInfo,
1808 TFU_RECPREQ_DLDELTA);
1811 RG_SCH_GET_IDX_PCQISRSSR(timingInfo, crntSfIdx);
1813 pRiTrIdx = cqiCb->nRiTrIdx + cqiCb->riDist * RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1815 /* Handle wrap around case */
1816 if (pRiTrIdx < crntSfIdx)
1818 pRiTrIdx += RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1821 cqiCb->isRiIgnoByCollsn = FALSE;
1822 nPRiServCellIdx = cqiCb->servCellInfo->sCellIdx;
1823 minPRiTrIdx = pRiTrIdx;
1825 for (cellIdx =0; cellIdx <= RG_SCH_MAX_SCELL; cellIdx++)
1827 /* If a serving cell is configured */
1828 if(ueCb->cellInfo[cellIdx] != NULLP)
1830 /* If the serving cell is in ACTIVE state and
1831 If it is not the same serving cell as cqiCb for which
1832 collision is being checked */
1833 if ((ueCb->cellInfo[cellIdx]->sCellState == RG_SCH_SCELL_ACTIVE)&&
1834 (cellIdx != cqiCb->servCellInfo->sCellIdx))
1836 scellPRiTrIdx = ueCb->cellInfo[cellIdx]->cqiCb.nRiTrIdx +
1837 ueCb->cellInfo[cellIdx]->cqiCb.riDist * RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1839 /* Handle wrap around case */
1840 if (scellPRiTrIdx < crntSfIdx)
1842 scellPRiTrIdx += RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1845 /* If cqiCb->isRiIgnoByCollsn is TRUE then a higher prio cqiCb
1846 is already found so need to compare */
1847 if ((FALSE == ueCb->cellInfo[cellIdx]->cqiCb.isRiIgnoByCollsn) &&
1848 (FALSE == cqiCb->isRiIgnoByCollsn) &&
1849 (scellPRiTrIdx == pRiTrIdx))
1851 /* Handle Collision */
1852 /* set isRiIgnoByCollsn to TRUE for low prio CQI Rep type */
1853 if (cqiCb->servCellInfo->sCellIdx < (ueCb->cellInfo[cellIdx]->sCellIdx))
1855 ueCb->cellInfo[cellIdx]->cqiCb.isRiIgnoByCollsn = TRUE;
1859 cqiCb->isRiIgnoByCollsn = TRUE;
1862 else if (scellPRiTrIdx < minPRiTrIdx)
1864 minPRiTrIdx = scellPRiTrIdx;
1865 nPRiServCellIdx = cellIdx;
1869 /* If all of the num of configured scells are checked then break */
1870 if (sCellCnt == ueCb->numSCells)
1878 /* Set the next expected Cqi into nPCqiCb */
1879 ueCb->nPRiCb = &ueCb->cellInfo[nPRiServCellIdx]->cqiCb;
1883 #endif/*TFU_UPGRADE*/
1886 * @brief Checking whethter the scell is active or not
1890 * Function: rgSCHSCellIsActive
1891 * Purpose: Check the Scell is in active state or not
1894 * Invoked by: SpecificScheduler
1896 * @param[in] RgSchCellCb* cell
1897 * @param[in] RgSchUeCb* ue
1902 PUBLIC S16 rgSCHSCellIsActive
1908 PUBLIC S16 rgSCHSCellIsActive(cell, ue)
1913 S16 retVal = RFAILED;
1914 TRC3(rgSCHSCellIsActive);
1916 for(U8 idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
1918 if((ue->cellInfo[idx] != NULLP) &&
1919 (ue->cellInfo[idx]->cell->cellId == cell->cellId)&&
1920 (ue->cellInfo[idx]->sCellState == RG_SCH_SCELL_ACTIVE))
1930 * @brief Function to check for Acell Activation Trigered.
1934 * Function : rgSCHIsActvReqd
1935 * This function will check for Secondary cell activation criteria
1936 * If met this will return TRUE else FALSE
1938 * @param[in] RgSchCellCb *cell
1939 * @param[in] RgSchUeCb *ue
1944 PUBLIC Bool rgSCHIsActvReqd
1950 PUBLIC Bool rgSCHIsActvReqd(cell, ue)
1955 TRC2(rgSCHIsActvReqd)
1956 /* Check if remBoCnt in this UE is greater than ZERO for sufficient number of
1957 * Scheduling TTIs. If yes then We should activate a secondary cell to handle
1959 if(ue->remBoCnt == RG_SCH_ACTIVATION_COUNT)
1969 /**********************************************************************
1972 **********************************************************************/