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.subframe);
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.subframe);
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;
513 RgSchCmnUlUeSpsInfo *ulSpsUe = NULLP;
519 TRC2(rgSCHUhmFreeProc);
522 if (hqProc->alloc && hqProc->alloc->ue)
524 ueCb = hqProc->alloc->ue;
527 U32 nonLcg0ReportedBs = ((RgSchCmnLcg *)(ueCb->ul.lcgArr[1].sch))->reportedBs + \
528 ((RgSchCmnLcg *)(ueCb->ul.lcgArr[2].sch))->reportedBs + \
529 ((RgSchCmnLcg *)(ueCb->ul.lcgArr[3].sch))->reportedBs;
530 ((RgUeUlHqCb*)hqProc->hqEnt)->numBusyHqProcs--;
531 if (! ((RgUeUlHqCb*)hqProc->hqEnt)->numBusyHqProcs && !(nonLcg0ReportedBs))
533 while (ueCb->ulActiveLCs)
535 if (ueCb->ulActiveLCs & 0x1)
537 cell->qciArray[qci].ulUeCount--;
540 ueCb->ulActiveLCs >>= 1;
548 if(hqProc && (RgUeUlHqCb*)hqProc->hqEnt)
552 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);
554 hqProc->alloc = NULLP;
555 hqProc->ulSfIdx = RGSCH_INVALID_INFO;
556 /*ccpu00116293 - Correcting relation between UL subframe and DL subframe based on RG_UL_DELTA*/
557 hqProc->isRetx = FALSE;
558 hqProc->remTx = 0; /*Reseting the remTx value to 0*/
560 RG_SCH_EMTC_SET_ISDTX_TO_FALSE(hqProc);
562 cmLListDelFrm(&((RgUeUlHqCb*)hqProc->hqEnt)->inUse,&hqProc->lnk);
563 cmLListAdd2Tail(&((RgUeUlHqCb*)hqProc->hqEnt)->free, &hqProc->lnk);
566 printf("after rgSCHUhmFreeProc inuse %ld free %ld \n",
567 (CmLListCp *)(&((RgUeUlHqCb*)hqProc->hqEnt)->inUse)->count,
568 (CmLListCp *) (&((RgUeUlHqCb*)hqProc->hqEnt)->free)->count);
573 printf("\nhqEnt is NULL\n");
576 } /* rgSCHUhmFreeProc */
579 * @brief Handler for HARQ processing on recieving re-trasmission
580 * indication from USM.
584 * Function: rgSCHUhmRetx
589 * - Update harq info with values corresponding to
592 * @param[in,out] *hqProc
596 PUBLIC Void rgSCHUhmRetx
598 RgSchUlHqProcCb *hqProc,
602 PUBLIC Void rgSCHUhmRetx(hqProc, alloc)
603 RgSchUlHqProcCb *hqProc;
609 hqProc->alloc = alloc;
611 hqProc->rvIdx = (hqProc->rvIdx + 1) % 4;
612 hqProc->rvIdxPhy.pres = FALSE;
618 * @brief Handler for initializing the HARQ entity.
622 * Function: rgSCHUhmRgrUeCfg
627 * - Initialize maxHqRetx
630 * @param[in,out] *ueCb
636 PUBLIC Void rgSCHUhmRgrUeCfg
643 PUBLIC Void rgSCHUhmRgrUeCfg(cellCb, ueCb, ueCfg)
650 RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb);
652 TRC2(rgSCHUhmRgrUeCfg);
654 ueUl->hqEnt.maxHqRetx = ((ueCfg->ueUlHqCfg.maxUlHqTx) - 1);
656 /* Storing the delta HARQ offset for HARQ + PUSCH */
657 ueCb->ul.betaHqOffst = ueCfg->puschDedCfg.bACKIdx;
659 cmLListInit(&ueUl->hqEnt.free);
660 cmLListInit(&ueUl->hqEnt.inUse);
661 for(i=0; i < ueUl->hqEnt.numHqPrcs; i++)
663 ueUl->hqEnt.hqProcCb[i].hqEnt = (void*)(&ueUl->hqEnt);
664 ueUl->hqEnt.hqProcCb[i].procId = i;
665 ueUl->hqEnt.hqProcCb[i].remTx = 0;
666 ueUl->hqEnt.hqProcCb[i].ulSfIdx = RGSCH_INVALID_INFO;
667 ueUl->hqEnt.hqProcCb[i].alloc = NULLP;
669 /* ccpu00139513- Initializing SPS flags*/
670 ueUl->hqEnt.hqProcCb[i].isSpsActvnHqP = FALSE;
671 ueUl->hqEnt.hqProcCb[i].isSpsOccnHqP = FALSE;
673 cmLListAdd2Tail(&ueUl->hqEnt.free, &ueUl->hqEnt.hqProcCb[i].lnk);
674 ueUl->hqEnt.hqProcCb[i].lnk.node = (PTR)&ueUl->hqEnt.hqProcCb[i];
678 rgSCHEmtcInitUlUeHqEnt(cellCb, ueCfg, ueCb);
681 } /* rgSCHUhmRgrUeCfg */
684 * @brief Handler for re-initializing the HARQ entity.
688 * Function: rgSCHUhmRgrUeRecfg
693 * - Re-initialize maxHqRetx
696 * @param[in,out] *ueCb
702 PUBLIC Void rgSCHUhmRgrUeRecfg
709 PUBLIC Void rgSCHUhmRgrUeRecfg(cellCb, ueCb, ueRecfg)
715 RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb);
716 TRC2(rgSCHUhmRgrUeRecfg);
718 /* [ccpu00123958]-ADD- Check for HARQ Reconfig from the bit mask */
719 if(RGR_UE_ULHARQ_RECFG & ueRecfg->ueRecfgTypes)
721 ueUl->hqEnt.maxHqRetx = (ueRecfg->ueUlHqRecfg.maxUlHqTx - 1);
725 } /* rgSCHUhmRgrUeRecfg */
728 * @brief Handler for de-initializing the HARQ entity.
732 * Function: rgSCHUhmFreeUe
739 * @param[in,out] *ueCb
743 PUBLIC Void rgSCHUhmFreeUe
749 PUBLIC Void rgSCHUhmFreeUe(cellCb, hqEnt)
754 TRC2(rgSCHUhmFreeUe);
756 /* ccpu00117052 - MOD - Passing double pointer
757 for proper NULLP assignment*/
758 rgSCHUtlFreeSBuf(cellCb->instIdx,
759 (Data **)(&(hqEnt->hqProcCb)),
760 hqEnt->numHqPrcs * sizeof(RgSchUlHqProcCb));
764 } /* rgSCHUhmFreeUe */
768 * @brief Handler for appending the PHICH information in to the dlSf.
772 * Function: rgSCHUhmAppendPhich
777 * - Set PhichInfo in DlSf for each Hq
779 * @param[in] *RgSchCellCb
780 * @param[in] CmLteTimingInfo
785 PUBLIC S16 rgSCHUhmAppendPhich
792 PUBLIC S16 rgSCHUhmAppendPhich (cellCb, frm, idx)
803 RgSchUlAlloc *ulAlloc;
805 Bool allwNack = TRUE;
806 #endif /* LTEMAC_HDFDD */
807 RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cellCb);
809 TRC2(rgSCHUhmAppendPhich)
814 if(cellUl->hqFdbkIdx[idx] != RGSCH_INVALID_INFO)
816 ulAlloc = rgSCHUtlFirstHqFdbkAlloc (cellCb, idx);
819 /*ccpu00106104 MOD added check for ACKNACK rep*/
820 /*added check for acknack so that adaptive retx considers ue
821 inactivity due to ack nack repetition*/
822 if((ulAlloc->ue != NULLP) && ((TRUE != ulAlloc->forMsg3) &&
823 ((ulAlloc->ue->measGapCb.isMeasuring == TRUE) ||
824 (ulAlloc->ue->ackNakRepCb.isAckNakRep == TRUE))))
826 /* Mark the UE for retransmission */
827 /* If UE is measuring then we should not be sending PHICH unless msg3 */
828 /*UE assumes ack, if nack then do adaptive re-transmission*/
829 /*ulAlloc->hqProc->rcvdCrcInd = FALSE;--*/
830 ulAlloc = rgSCHUtlNextHqFdbkAlloc (cellCb, ulAlloc, idx);
834 if (rgSCHUtlGetPhichInfo (ulAlloc->hqProc, &rbStart, &nDmrs, &iPhich) != ROK)
836 if (rgSCHUtlGetPhichInfo (ulAlloc->hqProc, &rbStart, &nDmrs) != ROK)
841 if(nDmrs != RGSCH_INVALID_NDMRS)
843 if(cellCb->dynCfiCb.switchOvrInProgress)
845 ulAlloc->hqProc->rcvdCrcInd = TRUE;
848 if(ulAlloc->hqProc->rcvdCrcInd)
851 rgSCHUtlAddPhich (cellCb, frm, TRUE, nDmrs, rbStart, iPhich);
853 rgSCHUtlAddPhich (cellCb, frm, TRUE, nDmrs, rbStart, ulAlloc->forMsg3);
856 /* Sending NACK in PHICH for failed UL TX */
860 rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, iPhich);
863 if (ulAlloc->ue != NULLP && ulAlloc->ue->hdFddEnbld)
865 rgSCHCmnHdFddChkNackAllow( cellCb, ulAlloc->ue, frm, &allwNack);
866 /* Present implementaion of non-HDFDD does not send phich req
867 incase of NACK. So commented this part to maintain same right
872 rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, ulAlloc->forMsg3);
876 rgSCHUtlAddPhich (cellCb, frm, TRUE, nDmrs, rbStart, ulAlloc->forMsg3);
881 rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, ulAlloc->forMsg3);
884 rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, ulAlloc->forMsg3);
885 #endif/* LTEMAC_HDFDD */
889 ulAlloc = rgSCHUtlNextHqFdbkAlloc (cellCb, ulAlloc, idx);
893 } /* rgSCHUhmAppendPhich */
896 * @brief This function initializes the DL HARQ Entity of UE.
900 * Function: rgSCHUhmHqEntInit
901 * Purpose: This function initializes the UL HARQ Processes of
902 * UE control block. This is performed at the time
903 * of creating UE control block.
905 * Invoked by: configuration module
907 * @param[in] RgSchUeCb* ueCb
914 PUBLIC S16 rgSCHUhmHqEntInit
920 PUBLIC S16 rgSCHUhmHqEntInit(cellCb, ueCb)
925 RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb);
927 Inst inst = ueCb->cell->instIdx;
929 TRC2(rgSCHUhmHqEntInit)
932 /* Init the HARQ processes */
933 ueUl->hqEnt.numHqPrcs = RGSCH_NUM_UL_HQ_PROC;
935 /* Init the HARQ processes */
936 ueUl->hqEnt.numHqPrcs =
937 rgSchTddUlNumHarqProcTbl[ueCb->cell->ulDlCfgIdx];
938 if (rgSCHUtlAllocSBuf(inst, (Data **)&ueUl->hqEnt.hqProcCb,
939 ueUl->hqEnt.numHqPrcs * \
940 sizeof(RgSchUlHqProcCb)) != ROK)
947 } /* rgSCHUhmHqEntInit */
951 * @brief This function gets an available HARQ process.
955 * Function: rgSCHUhmGetAvlHqProc
956 * Purpose: This function returns an available HARQ process in
957 * the UL direction. All HARQ processes are maintained
958 * in queues of free and inuse.
960 * 1. Check if the free queue is empty. If yes, return
962 * 2. If not empty, update the proc variable with the
963 * first process in the queue. Return ROK.
965 * Invoked by: scheduler
967 * @param[in] RgSchUeCb *ue
968 * @param[in] CmLteTimingInfo timingInfo
969 * @param[out] RgSchDlHqProc **hqP
971 * -#ROK if successful
972 * -#RFAILED otherwise
976 PUBLIC S16 rgSCHUhmGetAvlHqProc
980 RgSchUlHqProcCb **hqP
983 PUBLIC S16 rgSCHUhmGetAvlHqProc (cell, ue, hqP)
986 RgSchUlHqProcCb **hqP;
989 RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
990 RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
991 RgSchUlHqProcCb *tmpHqProc;
995 TRC2(rgSCHUhmGetAvlHqProc);
999 CM_LLIST_FIRST_NODE(&(hqE->free), tmp);
1003 //RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,
1004 // "rgSCHUhmGetAvlHqProc free %ld inUse %ld ue %d"
1005 // , hqE->free.count, hqE->inUse.count, ue->ueId);
1006 //printf("5GTF_ERROR rgSCHUhmGetAvlHqProc cellId %d %ld inUse %ld ue %d"
1007 //, cell->cellId, hqE->free.count, hqE->inUse.count, ue->ueId);
1008 /* No Harq Process available in the free queue. */
1012 tmpHqProc = (RgSchUlHqProcCb *)(tmp->node);
1014 /* Remove the element from the free Queue */
1015 cmLListDelFrm(&hqE->free, tmp);
1017 /* Add the element into the inUse Queue as well */
1018 cmLListAdd2Tail(&hqE->inUse, &tmpHqProc->lnk);
1021 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.subframe);
1023 tmpHqProc->schdTime = cellUl->schdTime;
1028 } /* rgSCHUhmGetAvlHqProc */
1031 * @brief Handler for identifying the HARQ process cb associated with the
1036 * Function: rgSCHUhmGetUlProcByTime
1039 * - Return pointer to uplink harq process corresponding to the timing
1040 * information passed.
1044 * @return RgSchUlHqProcCb*
1045 * -# Pointer to harq process corresponding to index
1049 PUBLIC RgSchUlHqProcCb* rgSCHUhmGetUlProcByTime
1056 PUBLIC RgSchUlHqProcCb* rgSCHUhmGetUlProcByTime(cell, ue, frm)
1059 CmLteTimingInfo frm;
1062 RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
1063 CmLListCp *lst = &ueUl->hqEnt.inUse;
1064 CmLList *lnk = lst->first;
1065 RgSchUlHqProcCb *proc;
1067 TRC2(rgSCHUhmGetUlProcByTime);
1071 proc = (RgSchUlHqProcCb *)(lnk->node);
1073 // printf("compare rgSCHUhmGetUlProcByTime time (%d %d) CRC time (%d %d) proc->procId %d \n",proc->schdTime.sfn,proc->schdTime.subframe,frm.sfn,frm.subframe ,proc->procId);
1074 if (RGSCH_TIMEINFO_SAME(proc->schdTime, frm))
1076 // printf("Harq timing Matched rgSCHUhmGetUlProcByTime time (%d %d) proc->procId %d \n",proc->schdTime.sfn,proc->schdTime.subframe, proc->procId);
1082 } /* rgSCHUhmGetUlProcByTime */
1086 /**********************************************************************
1089 **********************************************************************/