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_uhm.c
32 @brief This module handles uplink harq related functionality in MAC.
35 /* header include files -- defines (.h) */
36 #include "envopt.h" /* environment options */
37 #include "envdep.h" /* environment dependent */
38 #include "envind.h" /* environment independent */
40 #include "gen.h" /* general */
41 #include "ssi.h" /* system services */
43 #include "cm_lte.h" /* Common LTE */
44 #include "cm_tkns.h" /* Common Token Defines */
45 #include "cm_llist.h" /* Common Link List Defines */
46 #include "cm_hash.h" /* Common Hash List Defines */
47 #include "cm_mblk.h" /* memory management */
49 #include "rg_env.h" /* MAC Environment Defines */
50 #include "tfu.h" /* TFU Interface defines */
51 #include "rgr.h" /* RGR Interface defines */
52 #include "lrg.h" /* LRG Interface defines */
54 #include "rg_sch.h" /* Scheduler defines */
55 #include "rg_sch_inf.h" /* Scheduler defines */
56 #include "rg_sch_err.h" /* MAC error defines */
58 /* header/extern include files (.x) */
59 #include "gen.x" /* general */
60 #include "ssi.x" /* system services */
61 #include "cm5.x" /* system services */
62 #include "cm_lte.x" /* Common LTE */
63 #include "cm_tkns.x" /* Common Token Definitions */
64 #include "cm_llist.x" /* Common Link List Definitions */
65 #include "cm_lib.x" /* Common Library Definitions */
66 #include "cm_hash.x" /* Common Hash List Definitions */
67 #include "cm_mblk.x" /* memory management */
69 #include "tfu.x" /* TFU Interface defines */
70 #include "rgr.x" /* RGR Interface includes */
71 #include "lrg.x" /* LRG Interface includes */
73 #include "rg_sch_inf.x" /* Scheduler defines */
74 #include "rg_sch.x" /* Scheduler includes */
75 #include "rg_sch_cmn.h"
76 #include "rg_sch_cmn.x"
84 /* forward references */
87 U32 gUlRetxPassCntr = 0;
88 /*EXTERN U32 gUlRetxFailCntr;
89 EXTERN U32 gUlCrcPassCounter;
90 EXTERN U32 gUlCrcFailCounter;*/
92 PUBLIC U8 rgRvIdxTable[] = {0, 3, 1, 2}; /* This gives rvIdx for a given rv */
93 PUBLIC U8 rgRvTable[] = {0, 2, 3 ,1}; /* This gives rv for a given rvIdx */
96 PUBLIC Void rgSCHCmnEmtcHdlHarqProcFail
100 RgSchUlHqProcCb *hqProc,
103 PUBLIC Void rgSCHEmtcInitUlUeHqEnt
113 * @brief Handler for HARQ processing on recieving Data indication from PHY.
117 * Function: rgSCHUhmProcDatInd
119 * Invoked by: rgSCHTomTfuDatInd of TOM
122 * - Set rcvdCrcInd variable to TRUE
129 #ifndef MAC_SCH_STATS
131 PUBLIC Void rgSCHUhmProcDatInd
138 PUBLIC Void rgSCHUhmProcDatInd(cell, ue, frm)
143 #else /* MAC_SCH_STATS */
145 PUBLIC Void rgSCHUhmProcDatInd
153 PUBLIC Void rgSCHUhmProcDatInd(cell, ue, frm, cqi)
159 #endif /* MAC_SCH_STATS */
161 RgSchUlHqProcCb *hqProc;
163 RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
165 U8 maxiTbs = rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend]
169 TRC2(rgSCHUhmProcDatInd);
171 rgSCHUtlUlHqProcForUe(cell, frm, ue, &hqProc);
174 printf("UE[%d] failed to find UL HqProc for [%d:%d]\n",
175 ue->ueId, frm.sfn, frm.slot);
178 hqProc->rcvdCrcInd = TRUE;
182 ueUl->ulLaCb.deltaiTbs += UL_LA_STEPUP;
183 iTbs = (ueUl->ulLaCb.cqiBasediTbs + ueUl->ulLaCb.deltaiTbs)/100;
187 ueUl->ulLaCb.deltaiTbs = (maxiTbs * 100) - ueUl->ulLaCb.cqiBasediTbs;
193 /** Stats update over here
196 hqFailStats.ulCqiStat[cqi - 1].numOfAcks++;
201 /* UL stats are filled in primary index as of now */
202 cell->tenbStats->sch.ulAckNack[rgRvTable[hqProc->rvIdx]]++;
203 ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulAckNackCnt++;
206 ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulTpt += (hqProc->alloc->grnt.datSz << 3);
207 cell->tenbStats->sch.ulTtlTpt +=(hqProc->alloc->grnt.datSz << 3);//pverma
212 } /* rgSCHUhmProcDatInd */
215 * @brief Handler for HARQ processing on recieving Data indication from PHY.
219 * Function: rgSCHUhmProcMsg3DatInd
221 * Invoked by: rgSCHTomTfuDatInd of TOM
224 * - Set rcvdCrcInd variable to TRUE
226 * @param[in,out] *hqProc
230 PUBLIC Void rgSCHUhmProcMsg3DatInd
232 RgSchUlHqProcCb *hqProc
235 PUBLIC Void rgSCHUhmProcMsg3DatInd(hqProc)
236 RgSchUlHqProcCb *hqProc;
239 TRC2(rgSCHUhmProcMsg3DatInd);
240 hqProc->rcvdCrcInd = TRUE;
241 hqProc->remTx = 0; /*Reseting the value of rem Tx*/
242 printf("\nrgSCHUhmProcMsg3DatInd,id:%u\n",hqProc->procId);
244 } /* rgSCHUhmProcMsg3DatInd */
247 * @brief Handler for HARQ processing on recieving Data indication from PHY.
251 * Function: rgSCHUhmProcMsg3Failure
253 * Invoked by: rgSCHTomTfuDatInd of TOM
256 * - Set rcvdCrcInd variable to TRUE
258 * @param[in,out] *hqProc
262 PUBLIC Void rgSCHUhmProcMsg3Failure
264 RgSchUlHqProcCb *hqProc
267 PUBLIC Void rgSCHUhmProcMsg3Failure(hqProc)
268 RgSchUlHqProcCb *hqProc;
271 TRC2(rgSCHUhmProcMsg3Failure);
273 RG_SCH_EMTC_IS_CRCIND_RCVD_CHK_RACB(hqProc);
275 if(hqProc->rcvdCrcInd != TRUE)
277 hqProc->rcvdCrcInd = FALSE;
281 } /* rgSCHUhmProcMsg3Failure */
284 * @brief Handler for HARQ processing on recieving Decode failure from PHY.
288 * Function: rgSCHUhmProcHqFailure
290 * Invoked by: rgSCHTomTfuDecFailInd of TOM
293 * - Update NACK information in harq info.
294 * - Update RV index of received RV from PHY in harq info.
295 * - Set PhichInfo in DlSf
303 #ifndef MAC_SCH_STATS
305 PUBLIC Void rgSCHUhmProcHqFailure
313 PUBLIC Void rgSCHUhmProcHqFailure(cell, ue, frm, rv)
319 #else /* MAC_SCH_STATS */
321 PUBLIC Void rgSCHUhmProcHqFailure
330 PUBLIC Void rgSCHUhmProcHqFailure(cell, ue, frm, rv, cqi)
337 #endif /* MAC_SCH_STATS */
339 RgSchUlHqProcCb *hqProc;
341 RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
344 TRC2(rgSCHUhmProcHqFailure);
346 rgSCHUtlUlHqProcForUe(cell, frm, ue, &hqProc);
349 printf("UE[%d] failed to find UL HqProc for [%d:%d]\n",
350 ue->ueId, frm.sfn, frm.slot);
355 ueUl->ulLaCb.deltaiTbs -= UL_LA_STEPDOWN;
356 iTbs = (ueUl->ulLaCb.cqiBasediTbs + ueUl->ulLaCb.deltaiTbs)/100;
360 ueUl->ulLaCb.deltaiTbs = -(ueUl->ulLaCb.cqiBasediTbs);
366 /** Stats update over here */
368 static U32 retxCnt = 0;
370 hqFailStats.ulCqiStat[cqi - 1].numOfNacks++;
372 #endif /* MAC_SCH_STATS */
373 if(hqProc->rcvdCrcInd != TRUE)
375 hqProc->rcvdCrcInd = FALSE;
378 /* UL stats are filled in primary index as of now */
379 cell->tenbStats->sch.ulAckNack[rgRvTable[hqProc->rvIdx]]++;
380 ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulAckNackCnt++;
381 cell->tenbStats->sch.ulNack[rgRvTable[hqProc->rvIdx]]++;
382 ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulNackCnt++;
384 hqProc->rvIdxPhy.pres = rv.pres;
387 hqProc->rvIdxPhy.val = rgRvIdxTable[rv.val];
390 } /* rgSCHUhmProcHqFailure */
393 * @brief Handler for identifying the HARQ process cb associated with the
398 * Function: rgSCHUhmGetUlHqProc
401 * - Return pointer to uplink harq process corresponding to the timing
402 * information passed.
406 * @return RgSchUlHqProcCb*
407 * -# Pointer to harq process corresponding to index
411 PUBLIC RgSchUlHqProcCb* rgSCHUhmGetUlHqProc
418 PUBLIC RgSchUlHqProcCb* rgSCHUhmGetUlHqProc(cell, ue, idx)
424 RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
425 TRC2(rgSCHUhmGetUlHqProc);
427 #if (ERRCLASS & ERRCLS_DEBUG)
428 if(idx >= ueUl->hqEnt.numHqPrcs)
433 RETVALUE(&(ueUl->hqEnt.hqProcCb[idx]));
434 } /* rgSCHUhmGetUlHqProc */
437 * @brief Handler for HARQ processing on recieving new trasmission indication
442 * Function: rgSCHUhmNewTx
447 * - Update harq info with values indicating new HARQ transmission.
449 * @param[in,out] *hqProc
454 PUBLIC Void rgSCHUhmNewTx
456 RgSchUlHqProcCb *hqProc,
461 PUBLIC Void rgSCHUhmNewTx(hqProc, maxHqRetx, alloc)
462 RgSchUlHqProcCb *hqProc;
470 hqProc->alloc = alloc;
471 hqProc->remTx = maxHqRetx;
472 hqProc->rcvdCrcInd = FALSE;
474 hqProc->rvIdxPhy.pres = FALSE;
476 if (hqProc->alloc->ue)
478 ((RgUeUlHqCb*)hqProc->hqEnt)->numBusyHqProcs++;
482 } /* rgSCHUhmNewTx */
485 * @brief Free an uplink HARQ process.
489 * Function: rgSCHUhmFreeProc
494 * - Set alloc pointer to NULLP
496 * @param[in] RgSchUlHqProcCb *hqProc
497 * @param[in] RgSchCellCb *cell
501 PUBLIC Void rgSCHUhmFreeProc
503 RgSchUlHqProcCb *hqProc,
507 PUBLIC Void rgSCHUhmFreeProc(hqProc, cell)
508 RgSchUlHqProcCb *hqProc;
516 TRC2(rgSCHUhmFreeProc);
519 if (hqProc->alloc && hqProc->alloc->ue)
521 ueCb = hqProc->alloc->ue;
524 U32 nonLcg0ReportedBs = ((RgSchCmnLcg *)(ueCb->ul.lcgArr[1].sch))->reportedBs + \
525 ((RgSchCmnLcg *)(ueCb->ul.lcgArr[2].sch))->reportedBs + \
526 ((RgSchCmnLcg *)(ueCb->ul.lcgArr[3].sch))->reportedBs;
527 ((RgUeUlHqCb*)hqProc->hqEnt)->numBusyHqProcs--;
528 if (! ((RgUeUlHqCb*)hqProc->hqEnt)->numBusyHqProcs && !(nonLcg0ReportedBs))
530 while (ueCb->ulActiveLCs)
532 if (ueCb->ulActiveLCs & 0x1)
534 cell->qciArray[qci].ulUeCount--;
537 ueCb->ulActiveLCs >>= 1;
545 if(hqProc && (RgUeUlHqCb*)hqProc->hqEnt)
549 printf("\n\n########HARQ FREED HARQPROC ID (%d )after rgSCHUhmFreeProc inuse %ld free %ld \n",hqProc->alloc->grnt.hqProcId, (CmLListCp *)(&((RgUeUlHqCb*)hqProc->hqEnt)->inUse)->count,(CmLListCp *) (&((RgUeUlHqCb*)hqProc->hqEnt)->free)->count);
551 hqProc->alloc = NULLP;
552 hqProc->ulSfIdx = RGSCH_INVALID_INFO;
553 /*ccpu00116293 - Correcting relation between UL slot and DL slot based on RG_UL_DELTA*/
554 hqProc->isRetx = FALSE;
555 hqProc->remTx = 0; /*Reseting the remTx value to 0*/
557 RG_SCH_EMTC_SET_ISDTX_TO_FALSE(hqProc);
559 cmLListDelFrm(&((RgUeUlHqCb*)hqProc->hqEnt)->inUse,&hqProc->lnk);
560 cmLListAdd2Tail(&((RgUeUlHqCb*)hqProc->hqEnt)->free, &hqProc->lnk);
563 printf("after rgSCHUhmFreeProc inuse %ld free %ld \n",
564 (CmLListCp *)(&((RgUeUlHqCb*)hqProc->hqEnt)->inUse)->count,
565 (CmLListCp *) (&((RgUeUlHqCb*)hqProc->hqEnt)->free)->count);
570 printf("\nhqEnt is NULL\n");
573 } /* rgSCHUhmFreeProc */
576 * @brief Handler for HARQ processing on recieving re-trasmission
577 * indication from USM.
581 * Function: rgSCHUhmRetx
586 * - Update harq info with values corresponding to
589 * @param[in,out] *hqProc
593 PUBLIC Void rgSCHUhmRetx
595 RgSchUlHqProcCb *hqProc,
599 PUBLIC Void rgSCHUhmRetx(hqProc, alloc)
600 RgSchUlHqProcCb *hqProc;
606 hqProc->alloc = alloc;
608 hqProc->rvIdx = (hqProc->rvIdx + 1) % 4;
609 hqProc->rvIdxPhy.pres = FALSE;
615 * @brief Handler for initializing the HARQ entity.
619 * Function: rgSCHUhmRgrUeCfg
624 * - Initialize maxHqRetx
627 * @param[in,out] *ueCb
633 PUBLIC Void rgSCHUhmRgrUeCfg
640 PUBLIC Void rgSCHUhmRgrUeCfg(cellCb, ueCb, ueCfg)
647 RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb);
649 TRC2(rgSCHUhmRgrUeCfg);
651 ueUl->hqEnt.maxHqRetx = ((ueCfg->ueUlHqCfg.maxUlHqTx) - 1);
653 /* Storing the delta HARQ offset for HARQ + PUSCH */
654 ueCb->ul.betaHqOffst = ueCfg->puschDedCfg.bACKIdx;
656 cmLListInit(&ueUl->hqEnt.free);
657 cmLListInit(&ueUl->hqEnt.inUse);
658 for(i=0; i < ueUl->hqEnt.numHqPrcs; i++)
660 ueUl->hqEnt.hqProcCb[i].hqEnt = (void*)(&ueUl->hqEnt);
661 ueUl->hqEnt.hqProcCb[i].procId = i;
662 ueUl->hqEnt.hqProcCb[i].remTx = 0;
663 ueUl->hqEnt.hqProcCb[i].ulSfIdx = RGSCH_INVALID_INFO;
664 ueUl->hqEnt.hqProcCb[i].alloc = NULLP;
666 /* ccpu00139513- Initializing SPS flags*/
667 ueUl->hqEnt.hqProcCb[i].isSpsActvnHqP = FALSE;
668 ueUl->hqEnt.hqProcCb[i].isSpsOccnHqP = FALSE;
670 cmLListAdd2Tail(&ueUl->hqEnt.free, &ueUl->hqEnt.hqProcCb[i].lnk);
671 ueUl->hqEnt.hqProcCb[i].lnk.node = (PTR)&ueUl->hqEnt.hqProcCb[i];
675 rgSCHEmtcInitUlUeHqEnt(cellCb, ueCfg, ueCb);
678 } /* rgSCHUhmRgrUeCfg */
681 * @brief Handler for re-initializing the HARQ entity.
685 * Function: rgSCHUhmRgrUeRecfg
690 * - Re-initialize maxHqRetx
693 * @param[in,out] *ueCb
699 PUBLIC Void rgSCHUhmRgrUeRecfg
706 PUBLIC Void rgSCHUhmRgrUeRecfg(cellCb, ueCb, ueRecfg)
712 RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb);
713 TRC2(rgSCHUhmRgrUeRecfg);
715 /* [ccpu00123958]-ADD- Check for HARQ Reconfig from the bit mask */
716 if(RGR_UE_ULHARQ_RECFG & ueRecfg->ueRecfgTypes)
718 ueUl->hqEnt.maxHqRetx = (ueRecfg->ueUlHqRecfg.maxUlHqTx - 1);
722 } /* rgSCHUhmRgrUeRecfg */
725 * @brief Handler for de-initializing the HARQ entity.
729 * Function: rgSCHUhmFreeUe
736 * @param[in,out] *ueCb
740 PUBLIC Void rgSCHUhmFreeUe
746 PUBLIC Void rgSCHUhmFreeUe(cellCb, hqEnt)
751 TRC2(rgSCHUhmFreeUe);
753 /* ccpu00117052 - MOD - Passing double pointer
754 for proper NULLP assignment*/
755 rgSCHUtlFreeSBuf(cellCb->instIdx,
756 (Data **)(&(hqEnt->hqProcCb)),
757 hqEnt->numHqPrcs * sizeof(RgSchUlHqProcCb));
761 } /* rgSCHUhmFreeUe */
765 * @brief Handler for appending the PHICH information in to the dlSf.
769 * Function: rgSCHUhmAppendPhich
774 * - Set PhichInfo in DlSf for each Hq
776 * @param[in] *RgSchCellCb
777 * @param[in] CmLteTimingInfo
782 PUBLIC S16 rgSCHUhmAppendPhich
789 PUBLIC S16 rgSCHUhmAppendPhich (cellCb, frm, idx)
800 RgSchUlAlloc *ulAlloc;
802 Bool allwNack = TRUE;
803 #endif /* LTEMAC_HDFDD */
804 RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cellCb);
806 TRC2(rgSCHUhmAppendPhich)
811 if(cellUl->hqFdbkIdx[idx] != RGSCH_INVALID_INFO)
813 ulAlloc = rgSCHUtlFirstHqFdbkAlloc (cellCb, idx);
816 /*ccpu00106104 MOD added check for ACKNACK rep*/
817 /*added check for acknack so that adaptive retx considers ue
818 inactivity due to ack nack repetition*/
819 if((ulAlloc->ue != NULLP) && ((TRUE != ulAlloc->forMsg3) &&
820 ((ulAlloc->ue->measGapCb.isMeasuring == TRUE) ||
821 (ulAlloc->ue->ackNakRepCb.isAckNakRep == TRUE))))
823 /* Mark the UE for retransmission */
824 /* If UE is measuring then we should not be sending PHICH unless msg3 */
825 /*UE assumes ack, if nack then do adaptive re-transmission*/
826 /*ulAlloc->hqProc->rcvdCrcInd = FALSE;--*/
827 ulAlloc = rgSCHUtlNextHqFdbkAlloc (cellCb, ulAlloc, idx);
831 if (rgSCHUtlGetPhichInfo (ulAlloc->hqProc, &rbStart, &nDmrs, &iPhich) != ROK)
833 if (rgSCHUtlGetPhichInfo (ulAlloc->hqProc, &rbStart, &nDmrs) != ROK)
838 if(nDmrs != RGSCH_INVALID_NDMRS)
840 if(cellCb->dynCfiCb.switchOvrInProgress)
842 ulAlloc->hqProc->rcvdCrcInd = TRUE;
845 if(ulAlloc->hqProc->rcvdCrcInd)
848 rgSCHUtlAddPhich (cellCb, frm, TRUE, nDmrs, rbStart, iPhich);
850 rgSCHUtlAddPhich (cellCb, frm, TRUE, nDmrs, rbStart, ulAlloc->forMsg3);
853 /* Sending NACK in PHICH for failed UL TX */
857 rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, iPhich);
860 if (ulAlloc->ue != NULLP && ulAlloc->ue->hdFddEnbld)
862 rgSCHCmnHdFddChkNackAllow( cellCb, ulAlloc->ue, frm, &allwNack);
863 /* Present implementaion of non-HDFDD does not send phich req
864 incase of NACK. So commented this part to maintain same right
869 rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, ulAlloc->forMsg3);
873 rgSCHUtlAddPhich (cellCb, frm, TRUE, nDmrs, rbStart, ulAlloc->forMsg3);
878 rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, ulAlloc->forMsg3);
881 rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, ulAlloc->forMsg3);
882 #endif/* LTEMAC_HDFDD */
886 ulAlloc = rgSCHUtlNextHqFdbkAlloc (cellCb, ulAlloc, idx);
890 } /* rgSCHUhmAppendPhich */
893 * @brief This function initializes the DL HARQ Entity of UE.
897 * Function: rgSCHUhmHqEntInit
898 * Purpose: This function initializes the UL HARQ Processes of
899 * UE control block. This is performed at the time
900 * of creating UE control block.
902 * Invoked by: configuration module
904 * @param[in] RgSchUeCb* ueCb
911 PUBLIC S16 rgSCHUhmHqEntInit
917 PUBLIC S16 rgSCHUhmHqEntInit(cellCb, ueCb)
922 RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb);
924 Inst inst = ueCb->cell->instIdx;
926 TRC2(rgSCHUhmHqEntInit)
929 /* Init the HARQ processes */
930 ueUl->hqEnt.numHqPrcs = RGSCH_NUM_UL_HQ_PROC;
932 /* Init the HARQ processes */
933 ueUl->hqEnt.numHqPrcs =
934 rgSchTddUlNumHarqProcTbl[ueCb->cell->ulDlCfgIdx];
935 if (rgSCHUtlAllocSBuf(inst, (Data **)&ueUl->hqEnt.hqProcCb,
936 ueUl->hqEnt.numHqPrcs * \
937 sizeof(RgSchUlHqProcCb)) != ROK)
944 } /* rgSCHUhmHqEntInit */
948 * @brief This function gets an available HARQ process.
952 * Function: rgSCHUhmGetAvlHqProc
953 * Purpose: This function returns an available HARQ process in
954 * the UL direction. All HARQ processes are maintained
955 * in queues of free and inuse.
957 * 1. Check if the free queue is empty. If yes, return
959 * 2. If not empty, update the proc variable with the
960 * first process in the queue. Return ROK.
962 * Invoked by: scheduler
964 * @param[in] RgSchUeCb *ue
965 * @param[in] CmLteTimingInfo timingInfo
966 * @param[out] RgSchDlHqProc **hqP
968 * -#ROK if successful
969 * -#RFAILED otherwise
973 PUBLIC S16 rgSCHUhmGetAvlHqProc
977 RgSchUlHqProcCb **hqP
980 PUBLIC S16 rgSCHUhmGetAvlHqProc (cell, ue, hqP)
983 RgSchUlHqProcCb **hqP;
986 RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
987 RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
988 RgSchUlHqProcCb *tmpHqProc;
992 TRC2(rgSCHUhmGetAvlHqProc);
996 CM_LLIST_FIRST_NODE(&(hqE->free), tmp);
1000 //RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,
1001 // "rgSCHUhmGetAvlHqProc free %ld inUse %ld ue %d"
1002 // , hqE->free.count, hqE->inUse.count, ue->ueId);
1003 //printf("5GTF_ERROR rgSCHUhmGetAvlHqProc cellId %d %ld inUse %ld ue %d"
1004 //, cell->cellId, hqE->free.count, hqE->inUse.count, ue->ueId);
1005 /* No Harq Process available in the free queue. */
1009 tmpHqProc = (RgSchUlHqProcCb *)(tmp->node);
1011 /* Remove the element from the free Queue */
1012 cmLListDelFrm(&hqE->free, tmp);
1014 /* Add the element into the inUse Queue as well */
1015 cmLListAdd2Tail(&hqE->inUse, &tmpHqProc->lnk);
1018 printf("rgSCHUhmGetAvlHqProc cellId %d free %ld inUse %ld ue %d time (%d %d)\n",cell->cellId, hqE->free.count, hqE->inUse.count, ue->ueId,cellUl->schdTime.sfn,cellUl->schdTime.slot);
1020 tmpHqProc->schdTime = cellUl->schdTime;
1025 } /* rgSCHUhmGetAvlHqProc */
1028 * @brief Handler for identifying the HARQ process cb associated with the
1033 * Function: rgSCHUhmGetUlProcByTime
1036 * - Return pointer to uplink harq process corresponding to the timing
1037 * information passed.
1041 * @return RgSchUlHqProcCb*
1042 * -# Pointer to harq process corresponding to index
1046 PUBLIC RgSchUlHqProcCb* rgSCHUhmGetUlProcByTime
1053 PUBLIC RgSchUlHqProcCb* rgSCHUhmGetUlProcByTime(cell, ue, frm)
1056 CmLteTimingInfo frm;
1059 RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
1060 CmLListCp *lst = &ueUl->hqEnt.inUse;
1061 CmLList *lnk = lst->first;
1062 RgSchUlHqProcCb *proc;
1064 TRC2(rgSCHUhmGetUlProcByTime);
1068 proc = (RgSchUlHqProcCb *)(lnk->node);
1070 // printf("compare rgSCHUhmGetUlProcByTime time (%d %d) CRC time (%d %d) proc->procId %d \n",proc->schdTime.sfn,proc->schdTime.slot,frm.sfn,frm.slot ,proc->procId);
1071 if (RGSCH_TIMEINFO_SAME(proc->schdTime, frm))
1073 // printf("Harq timing Matched rgSCHUhmGetUlProcByTime time (%d %d) proc->procId %d \n",proc->schdTime.sfn,proc->schdTime.slot, proc->procId);
1079 } /* rgSCHUhmGetUlProcByTime */
1083 /**********************************************************************
1086 **********************************************************************/