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 **********************************************************************/
32 @brief APIs related to Downlink HARQ.
35 static const char* RLOG_MODULE_NAME="MAC";
36 static int RLOG_FILE_ID=279;
37 static int RLOG_MODULE_ID=4096;
38 /* header include files -- defines (.h) */
39 #include "common_def.h"
47 #include "rg_sch_inf.h"
51 #include "du_app_mac_inf.h"
53 /* header/extern include files (.x) */
61 #include "rg_sch_inf.x"
62 #include "rg_prg.x" /* PRG interface typedefs */
69 #include "ss_msg.x" /* MAC includes */
71 // S16 ssGetDBufOfSize(Region region,Size size,Buffer **dBuf);
72 //void prc_trace_format_string(UINT32 group_mask, UINT16 level, const char *format, ...);
78 S16 SIncMsgRef(Buffer *srcBuf,Region dstRegion, Pool dstPool,Buffer **dstBuf);
80 static Void rgDHMBldTfuDatReq ARGS((RgCellCb *cellCb, RgDlSf *dlSf, RgDlHqProcCb *hqP,
81 RgTfuDatReqPduInfo *datReq));
92 /* forward references */
95 * @brief This function initializes the DL HARQ Entity of UE
99 * Function: rgDHMHqEntInit
100 * Purpose: This function initializes the DL HARQ entity of
101 * UE control block. This is performed at the time
102 * of creating UE control block.
104 * Invoked by: configuration module
106 * @param[in] Inst inst
107 * @param[in] RgCellCb* cell
108 * @param[in] RgUeCb* ue
122 S16 rgDHMHqEntInit(inst,hqE, maxHqProcs)
130 Buffer *hdrDBuf = NULLP;
131 Buffer *ceDBuf = NULLP;
134 hqE->numHqProcs = maxHqProcs;
135 /* for each harq process */
136 for (idx1 = 0; idx1 < hqE->numHqProcs; idx1++)
138 if (rgAllocSBuf(inst,(Data **)&(hqE->procs[idx1]),sizeof(RgDlHqProcCb)) != ROK)
142 rgFreeSBuf(inst,(Data **)&(hqE->procs[idx1]), sizeof(RgDlHqProcCb));
144 RLOG0(L_ERROR, "Memory Alloc Failure for RgDlHqProcCb");
148 hqE->procs[idx1]->procId = idx1;
149 for(idx2 = 0; idx2 < RG_MAX_TB_PER_UE; idx2++)
152 hqE->procs[idx1]->tbInfo[idx2].tb = NULLP;
155 /* L2 optimization for mUe/Tti: Allocating buffers for macHdr, macCes
156 * and macPadding. These buffers shall not be released by MAC/CL.
157 * However, Only rPtr and wPtr will be reset while release of hq proc
159 tmpMBuf = hqE->procs[idx1]->tbInfo[idx2].tb.macHdr;
160 rgGetMsg(inst, &tmpMBuf);
161 RG_ADD_DBuf(hdrDBuf, RG_MAC_HDR_SIZE, tmpMBuf);
162 hqE->procs[idx1]->tbInfo[idx2].tb.macHdr = tmpMBuf;
163 macHeader[idx2] = MacPtrAddress;
165 tmpMBuf = hqE->procs[idx1]->tbInfo[idx2].tb.macCes;
166 rgGetMsg(inst, &tmpMBuf);
167 RG_ADD_DBuf(ceDBuf, RG_MAC_CE_SIZE, tmpMBuf);
168 hqE->procs[idx1]->tbInfo[idx2].tb.macCes = tmpMBuf;
170 hqE->procs[idx1]->tbInfo[idx2].tb.padSize = 0;
173 hqE->procs[idx1]->tbId[idx2] = RGU_INVALID_TBID;
177 cmLListInit(&hqE->savedProcLst[idx1]);
182 } /* rgDHMHqEntInit */
185 * @brief This function releases a HARQ process
189 * Function: rgDHMUeReset
190 * Purpose: This function resets TB in each HarqProc.
192 * Invoked by: CFG UE Reset
194 * @param[in] RgDlHqProc *hqP
205 Void rgDHMUeReset(cell, hqE)
214 /* Free all the TB memory associated with HARQ */
215 for (i=0; i < hqE->numHqProcs; i++)
217 rgDHMRlsHqProcTB(cell, hqE->procs[i], 1);
218 rgDHMRlsHqProcTB(cell, hqE->procs[i], 2);
221 rgDHMFreeSavedHqP((cell->macInst - RG_INST_START), hqE, i);
229 * @brief This function defers shared memory buffer
230 * freeing out of the critical RT path.
234 * Function: rgDHMHdlBufFree
235 * Purpose: To defer shared memory freeing post
236 * critical path. Defer as many if defer queue
237 * is full then release instantly.
239 * Invoked by: HARQ TB Release.
251 Void rgDHMHdlBufFree(Inst inst, Buffer **mBuf)
255 RgCb *rgCbP = &rgCb[inst];
257 if (rgCbP->bufCnt < RG_MAX_DFRD_FREE_BUFS)
261 rgCbP->bufToFree[rgCbP->bufCnt] = *mBuf;
273 * @brief This function is called to release the
274 * shared memory of the HARQ TBs outside
275 * the critical RT path.
279 * Function: rgDHMFreeTbBufs
280 * Purpose: This function is called to release the
281 * shared memory of the HARQ TBs outside
282 * the critical RT path.
284 * 1. Job of releasing TBs is shared across TTIs
285 * Invoked by: MAC every TTI
296 Void rgDHMFreeTbBufs(inst)
300 RgCb *rgCbP = &rgCb[inst];
301 uint8_t start = rgCbP->bufCnt;
304 if (rgCbP->bufCnt < RG_MAX_FREE_BUFS_PERTTI)
310 end = rgCbP->bufCnt - RG_MAX_FREE_BUFS_PERTTI;
315 SPutMsg(rgCbP->bufToFree[start]);
319 } /* rgDHMFreeTbBufs */
322 Void rgDHMFreeAllTbBufs
327 Void rgDHMFreeAllTbBufs(inst)
331 RgCb *rgCbP = &rgCb[inst];
332 uint8_t start = rgCbP->bufCnt;
338 SPutMsg(rgCbP->bufToFree[start]);
342 } /* rgDHMFreeTbBufs */
346 * @brief This function releases a HARQ process
350 * Function: rgDHMRlsHqProcTB
351 * Purpose: This function returns a HARQ process to HARQ Entity
352 * in the DL direction.
354 * 1. Add the HARQ process to the free queue.
355 * Invoked by: scheduler and HARQ processing
357 * @param[in] RgDlHqProc *hqP
369 S16 rgDHMRlsHqProcTB(cell, hqP, tbIndex)
377 RgTfuDatReqTbInfo *tb; /* TB to be sent to CL/PHY*/
378 // uint32_t lchIdx, pduIdx;
381 if((tbIndex > RG_MAX_TB_PER_UE) ||
387 hqP->tbInfo[tbIndex-1].numSchLch = 0;
389 if (hqP->tbInfo[tbIndex-1].tb)
391 rgDHMHdlBufFree(cell->macInst - RG_INST_START, &hqP->tbInfo[tbIndex-1].tb);
394 /* L2 Optimization for mUe/Tti: macHdr, macCes and macPad mBuf pointers
395 * shall not be released. However, Inorder to release harq info/TB info,
396 * just Resetting rPtr and wPtr of these mbufs to db_base
398 tb = &(hqP->tbInfo[tbIndex-1].tb);
399 if (tb->tbPres == TRUE)
404 hqP->tbInfo[tbIndex-1].schdTa.pres = FALSE;
406 hqP->tbInfo[tbIndex -1].sCellActCe.pres = FALSE;
409 /* Decrementing might lead to roundoff error in case of say UE reset
410 * where all the HqProcs irrespective whether in use are called for rls.
411 * Hence to avoid the same shift operator is being used. */
412 hqP->numOfTBs = hqP->numOfTBs >> 1;
413 for(idx = 0; idx < 2; idx++)
415 if (hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sfLnk.node != NULLP)
417 cmLListDelFrm(&hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sf->tbs,
418 &(hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sfLnk));
419 hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sfLnk.node = (PTR)NULLP;
420 printf("\nrgDHMRlsHqProcTB:: hqP %p \n", (Void *)hqP);
422 hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sf = NULLP;
424 /* Fix : syed It is better to reset these feilds
425 * corruption avoidance */
426 hqP->tbInfo[tbIndex-1].tbSz = 0;
427 hqP->tbInfo[tbIndex-1].contResCe = NOTPRSNT;
428 hqP->tbInfo[tbIndex-1].contResId = NULLP;
431 } /* rgDHMRlsHqProc */
434 * @brief This function gets HARQ process with the given Id
438 * Function: rgDHMGetHqProcFrmId
439 * Purpose: This function returns the HARQ process with the given ID.
442 * @param[in] RgUeCb *ue
443 * @param[in] uint8_t idx
444 * @param[in] RgDlHqProc **hqP
446 * -# ROK if successful
447 * -# RFAILED otherwise
451 S16 rgDHMGetHqProcFrmId
458 S16 rgDHMGetHqProcFrmId(ue, idx, hqP)
464 /* Pick the proc based on the index provided */
465 *hqP = (ue->dl.hqEnt.procs[idx]);
468 } /* rgDHMGetHqProcFrmId */
470 /*static uint32_t dataAvl; */
472 * @brief Handler for sending data to PHY
476 * Function : rgDHMSndDatReq
478 * This function shall send the MAC PDU built for the UE to TOM
479 * when invoked as part of TTI processing and keep track of the number of
480 * transmissions for this TB.
483 * @param[in] RgCellCb *cell
484 * @param[in] RgDlHqProcCb *hqE
485 * @param[out] RgErrInfo *err
495 RgTfuDatReqInfo *datInfo,
500 S16 rgDHMSndDatReq(cellCb, dlSf, datInfo, hqP, err)
503 RgTfuDatReqInfo *datInfo;
509 Inst inst = cellCb->macInst - RG_INST_START;
510 RgTfuDatReqPduInfo *datReq;
512 /*Added this variable to figure out that whether this UE data
513 has to be inclueded in the TFU Data request.*/
517 for(i=0;i< RG_MAX_TB_PER_UE;i++)
519 /* printf("\nDHMSndDatReq1: Rnti %d dlSfSchdTime(sfn sf) : (%d %d)\n"
520 "macCell(sfn sf): (%d %d) tbTimingInfo(sfn sf): (%d %d)\n"
521 "dlSf %p dlSf->tbs.count %d hqp %p tb %p\n",
522 hqP->tbInfo[i].pdcch.rnti,
523 dlSf->schdTime.sfn, dlSf->schdTime.slot,
524 cellCb->crntTime.sfn, cellCb->crntTime.slot,
525 hqP->tbInfo[i].timingInfo.sfn,
526 hqP->tbInfo[i].timingInfo.slot,
527 (Void *)dlSf, dlSf->tbs.count,
529 (Void *)hqP->tbInfo[i].tb);*/
530 /* Mukesh :: in case of rpepetiton this is not rerd*/
531 if (hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf)
533 /* Check if data from RLC had been received and got muxed. */
535 if (hqP->tbInfo[i].tb == NULLP)
537 if (!(hqP->tbInfo[i].tb.tbPres))
541 if (hqP->tbInfo[i].schdTa.pres == TRUE ||
542 hqP->tbInfo[i].contResCe == PRSNT_NODEF)
544 if ((hqP->tbInfo[i].schdTa.pres == TRUE) ||
545 (hqP->tbInfo[i].contResCe == PRSNT_NODEF) ||
546 (hqP->tbInfo[i].sCellActCe.pres == TRUE))
549 /* Data not received but ta needs to be sent. */
550 /* MUX TA and send it */
551 bldPdu.datReq = NULLP;
552 //bldPdu.reqType = EVENT_SLOT_IND_TO_MAC;
553 bldPdu.schdTbSz = hqP->tbInfo[i].tbSz;
554 bldPdu.ta = hqP->tbInfo[i].schdTa;
556 bldPdu.sCellActCe= hqP->tbInfo[i].sCellActCe;
558 /* changes for CR timer implementation*/
559 bldPdu.contResId = hqP->tbInfo[i].contResId;
560 if (ROK != rgMUXBldPdu(inst,&bldPdu, &(hqP->tbInfo[i].tb), err))
562 RLOG1(L_ERROR, "MUXing failed for: MacInst %d", inst);
563 RLOG4(L_ERROR, "MUXing failed for: time: %d/%d\
564 procId %d ueId %d", hqP->tbInfo[i].timingInfo.sfn,
565 hqP->tbInfo[i].timingInfo.slot, hqP->procId,
566 hqP->tbInfo[i].pdcch.rnti);
573 #ifdef LTEMAC_RGU_PAD
574 /* Data not received from RLC. Padding at MAC */
575 bldPdu.datReq = NULLP;
576 //bldPdu.reqType = EVENT_SLOT_IND_TO_MAC;
577 bldPdu.schdTbSz = hqP->tbInfo[i].tbSz;
578 bldPdu.ta = hqP->tbInfo[i].schdTa;
580 bldPdu.sCellActCe= hqP->tbInfo[i].sCellActCe;
583 bldPdu.contResId = NULLP;
585 if (ROK != rgMUXBldPdu(inst,&bldPdu, &(hqP->tbInfo[i].tb), err))
587 RLOG1(L_ERROR, "MUXing failed for: MacInst %d", inst);
588 RLOG4(L_ERROR, "MUXing failed for: time: %d/%d\
589 procId %d ueId %d", hqP->tbInfo[i].timingInfo.sfn,
590 hqP->tbInfo[i].timingInfo.slot, hqP->procId,
591 hqP->tbInfo[i].pdcch.rnti);
596 /*Padding is not done so data for this UE will not be
611 /*If Data/Padding is not available for UE, then we can not include
612 any Data for this UE in TFU Data Request.*/
615 /*Free up the HARQ process for this allocation.*/
616 /* Release First TB, as this would be anyway there*/
617 rgDHMRlsHqProcTB(cellCb, hqP, 1);
618 if(2 == hqP->numOfTBs)
620 rgDHMRlsHqProcTB(cellCb, hqP, 2);
626 if (rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo),
627 &(datInfo->memCp)) != ROK)
631 /* Fill the TFU Dat Req with information from Harq Proc */
633 rgDHMBldTfuDatReq(cellCb, dlSf, hqP, datReq);
635 /* MS_WORKAROUND for ccpu00122894 */
636 for(i=0;i< RG_MAX_TB_PER_UE;i++)
638 if (hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf)
640 cmLListDelFrm(&dlSf->tbs, &(hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk));
641 hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node = NULLP;
644 hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf = NULLP;
647 cmLListAdd2Tail(&datInfo->pdus, &(datReq->lnk));
648 datReq->lnk.node = (PTR)datReq;
651 } /* rgDHMSndDatReq */
654 * @brief Function to handle RGU datReq received from ROM
658 * Function : rgDHMHndlDedDatReq
660 * This function shall act on the datReq received on RGU. It shall
661 * store the data IDs for all the logical channels and get the MAC
665 * @param[in] Inst inst
666 * @param[in] RgDlHqProcCb *hqProc
667 * @param[in] RgRguDedDatReq *datReq
668 * @param[out] RgErrInfo *err
674 S16 rgDHMHndlDedDatReq
677 RgDlHqProcCb *hqProc,
678 RgRguDDatReqPerUe *datReq,
683 S16 rgDHMHndlDedDatReq(inst,hqProc, datReq, dlSf, err)
685 RgDlHqProcCb *hqProc;
686 RgRguDDatReqPerUe *datReq;
697 RgTfuDatReqTbInfo *tb;
701 tbIndex = (uint8_t)(datReq->transId & 0x03);
702 /* Accept all the data requests even if delayed in case nothing
703 * has been sent earlier on the harq proc.
705 if((datReq->nmbOfTbs > RG_MAX_TB_PER_UE) ||
708 /* release corresponding TBs from SF tbs List */
709 for(j=0;j<datReq->nmbOfTbs;j++)
711 if (!(tbIndex & (j+1)))
715 rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (uint8_t)(j+1));
720 for(i=0;i<datReq->nmbOfTbs;i++)
722 /* tbIndex 01 corresponds to presence of 1st TB
723 * 10 corresponds 2nd TB
724 * 11 corresponds two TBs of UE */
725 if (!(tbIndex & (i+1)))
729 if (hqProc->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node == NULLP)
731 /* release corresponding TBs from SF tbs List */
732 for(j=0;j<datReq->nmbOfTbs;j++)
734 if (!(tbIndex & (j+1)))
738 rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (uint8_t)(j+1));
739 printf("\nrgDHMHndlDedDatReq:: hqP %p \n", (Void *)hqProc);
745 RG_FREE_MSG(hqProc->tbInfo[i].tb);
746 /* L2 optimization for mUe/Tti: Pre-allocated mBuf pointers(macHdr,
747 * macCes and MacPad) of harq TB need to be reset to db_base
750 tb = &hqProc->tbInfo[i].tb;
751 if (tb->tbPres == TRUE)
756 bldPdu.datReq = datReq;
757 bldPdu.reqType = EVTRGUDDATREQ;
758 bldPdu.schdTbSz = hqProc->tbInfo[i].tbSz;
759 bldPdu.tbIndex = i+1;
760 bldPdu.ta = hqProc->tbInfo[i].schdTa;
762 bldPdu.sCellActCe= hqProc->tbInfo[i].sCellActCe;
764 bldPdu.contResId = NULLP;
766 /* Store tbId from RLC in DDatRequest */
767 hqProc->tbId[i] = datReq->datReqTb[i].tbId;
770 hqProc->status[i] = FALSE;
772 if(rgMUXBldPdu(inst,&bldPdu, &(hqProc->tbInfo[i].tb), err) != ROK)
774 RLOG1(L_ERROR, "MUXing failed for: MacInst %d", inst);
775 RLOG4(L_ERROR, "MUXing failed for: time: %d/%d\
776 procId %d ueId %d", hqProc->tbInfo[i].timingInfo.sfn,
777 hqProc->tbInfo[i].timingInfo.slot, hqProc->procId,
778 hqProc->tbInfo[i].pdcch.rnti);
780 /* release corresponding TBs from SF tbs List */
781 for(j=0;j<datReq->nmbOfTbs;j++)
783 if (!(tbIndex & (j+1)))
787 rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (uint8_t)(j+1));
792 SFndLenMsg(hqProc->tbInfo[i].tb, &len);
796 } /* rgDHMHndlDedDatReq */
799 * @brief Function to handle RGU datReq received from ROM
803 * Function : rgDHMHndlCmnDatReq
805 * This function shall act on the datReq received on RGU. It shall
806 * store the data IDs for all the logical channels and get the MAC
810 * @param[in] Inst inst
811 * @param[in] RgDlHqProcCb *hqProc
812 * @param[in] RgRguCmnDatReq *datReq
813 * @param[out] RgErrInfo *err
819 S16 rgDHMHndlCmnDatReq
822 RgDlHqProcCb *hqProc,
823 RgRguCmnDatReq *datReq,
827 S16 rgDHMHndlCmnDatReq(inst,hqProc, datReq, err)
829 RgDlHqProcCb *hqProc;
830 RgRguCmnDatReq *datReq;
838 if (hqProc->tbInfo[0].tb != NULLP)
840 /* If numLch is non zero means HQ Proc is busy*/
841 if (hqProc->tbInfo[0].tb.tbPres)
844 /* datReq discarded. Generate an alarm */
845 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_HARQ);
846 rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
847 LRG_CAUSE_HQ_PROC_BUSY, &dgn);
851 bldPdu.datReq = datReq;
852 bldPdu.reqType = EVTRGUCDATREQ;
853 bldPdu.schdTbSz = hqProc->tbInfo[0].tbSz;
854 bldPdu.ta = hqProc->tbInfo[0].schdTa;
856 bldPdu.sCellActCe= hqProc->tbInfo[0].sCellActCe;
859 bldPdu.contResId = hqProc->tbInfo[0].contResId;
861 if(rgMUXBldPdu(inst,&bldPdu, &(hqProc->tbInfo[0].tb), err) != ROK)
863 RLOG1(L_ERROR, "MUXing failed for: MacInst %d", inst);
864 RLOG4(L_ERROR, "MUXing failed for: time: %d/%d\
865 procId %d ueId %d", hqProc->tbInfo[0].timingInfo.sfn,
866 hqProc->tbInfo[0].timingInfo.slot, hqProc->procId,
867 hqProc->tbInfo[0].pdcch.rnti);
869 RG_FREE_MSG(datReq->pdu);
874 } /* rgDHMHndlCmnDatReq */
877 * @brief Function to get consolidate grants and send consolidated grant to RLC
881 * Function : rgDHMSndConsolidatedStaInd
883 * This function shall be invoked by Scheduler to trigger DHM to send a
884 * consolidated status indication of all UE scheduled in a TTI as well as
885 * send consolidated CStaInd for MSG4 and for all common channels(PCCH,
886 * if RGR_SI_SCH is not defined then it includes BCH and BCCH also)
889 * @param[in] RgCellCb *cell
890 * @param[in] RgInfUeInfo *ueInfo,
891 * @param[in] CmLteTimingInfo timingInfo,
892 * @param[out] RgErrInfo err
893 * @param[in] RguCStaIndInfo *cStaInd
900 S16 rgDHMSndConsolidatedStaInd
904 CmLteTimingInfo timingInfo,
908 S16 rgDHMSndConsolidatedStaInd(cell, ueInfo, timingInfo, err)
911 CmLteTimingInfo timingInfo;
915 SuId rguDlSpId;/*need to use spID instead of suID*/
919 uint8_t tbIndex=0,idx1;
920 RgDlSf *dlSf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
921 Inst inst = cell->macInst - RG_INST_START;
922 // Bool isDStaReqrd = FALSE;
923 RgRguDedStaInd *dStaInd[rgCb[inst].numRguSaps] ;
924 RgUpSapCb *rguDlSap[rgCb[inst].numRguSaps];
929 RgInfUeAlloc *allocInfo;
930 uint8_t activeSapCnt = 0;
931 uint8_t staIndCnt = 0;
933 Bool hqPAdded = FALSE;
936 RgTfuDatReqTbInfo *tb; /* TB to be sent to CL/PHY*/
939 memset (dStaInd, 0, (sizeof(RgRguDedStaInd *) * rgCb[inst].numRguSaps));
940 memset (rguDlSap, 0, (sizeof(RgUpSapCb *) * rgCb[inst].numRguSaps));
942 /* Send StaInd for the scheduled UEs */
943 for(ueIdx = 0; ueIdx < ueInfo->numUes; ueIdx++)
948 if((ue=rgDBMGetUeCb (cell, ueInfo->allocInfo[ueIdx].rnti)) == NULLP)
950 /* Check in RachLst */
951 if((ue=rgDBMGetUeCbFromRachLst (cell,
952 ueInfo->allocInfo[ueIdx].rnti)) == NULLP)
954 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"CRNTI:%d No ueCb found",
955 ueInfo->allocInfo[ueIdx].rnti);
956 /*Fix: If one UE is not present dont return, look for the next.*/
962 rgDHMGetHqProcFrmId(ue,ueInfo->allocInfo[ueIdx].hqProcId,&hqP);
963 allocInfo = &ueInfo->allocInfo[ueIdx];
966 /* Fix : syed Avoid sending data for a RETX
967 * if initial TX data processing was unsuccessful */
968 if((allocInfo->tbInfo[0].isReTx == TRUE) &&
969 (hqP->tbInfo[0].tbSz == 0))
971 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
972 "CRNTI:%d RETX hqP(%d) tb(0) for a failed New Tx",
973 allocInfo->rnti, hqP->procId);
976 if((allocInfo->tbInfo[1].isReTx == TRUE) &&
977 (hqP->tbInfo[1].tbSz == 0))
979 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
980 "CRNTI:%d RETX hqP(%d) tb(1) for a failed New Tx",
981 allocInfo->rnti, hqP->procId);
985 if(ue->rguDlSap != NULLP)
987 rguDlSpId = ue->rguDlSap->sapCfg.spId;
989 {/* UeCb is from rachList */
990 rguDlSpId = cell->rguDlSap->sapCfg.spId;
994 for(idx=allocInfo->tbStrtIdx;((idx-allocInfo->tbStrtIdx) <\
995 allocInfo->nmbOfTBs); idx++)
997 RguCStaIndInfo *cStaInd;
999 /* LTE_ADV_FLAG_REMOVED_START */
1000 hqP->tbInfo[idx].isEnbSFR = allocInfo->isEnbSFR;
1001 /* update pA value */
1002 hqP->tbInfo[idx].pa = allocInfo->pa;
1003 /* LTE_ADV_FLAG_REMOVED_END */
1006 hqP->numOfTBs = allocInfo->nmbOfTBs;
1007 hqP->tbInfo[idx].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node = (PTR)hqP;
1008 hqP->tbInfo[idx].sfLnkInfo[dlSf->schdTime.slot % 2].sf = dlSf;
1009 cmLListAdd2Tail(&dlSf->tbs,&(hqP->tbInfo[idx].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk));
1010 /* Changes as part of performance testing*/
1011 /* hqP->numOfTBs++;*/
1012 hqP->tbInfo[idx].doa = allocInfo->doa;
1013 hqP->tbInfo[idx].txMode = allocInfo->txMode;
1014 hqP->tbInfo[idx].puschRptUsd = allocInfo->puschRptUsd;
1015 hqP->tbInfo[idx].puschPmiInfo = allocInfo->puschPmiInfo;
1017 hqP->tbInfo[idx].pdcch.rnti = allocInfo->pdcchRnti;
1019 hqP->tbInfo[idx].pdcch.rnti = allocInfo->rnti;
1021 if(allocInfo->tbInfo[idx].isReTx == TRUE)
1023 hqP->tbInfo[idx].pdcch.dci = allocInfo->dciInfo;
1027 hqP->tbInfo[idx].timingInfo = timingInfo;
1028 hqP->tbInfo[idx].pdcch.dci = allocInfo->dciInfo;
1030 RG_FREE_MSG(hqP->tbInfo[idx].tb);
1032 /* L2 optimization for mUe/Tti: Pre-allocated mBuf pointers(macHdr,
1033 * macCes and MacPad) of harq TB need to be reset to db_base
1035 tb = &(hqP->tbInfo[idx].tb);
1036 if (tb->tbPres == TRUE)
1041 hqP->tbInfo[idx].tbSz = allocInfo->tbInfo[idx].schdTbSz;
1043 hqP->tbInfo[idx].schdTa.pres = allocInfo->tbInfo[idx].ta.pres;
1044 hqP->tbInfo[idx].schdTa.val = allocInfo->tbInfo[idx].ta.val;
1047 hqP->tbInfo[idx].sCellActCe.pres = allocInfo->tbInfo[idx].sCellActCe.pres;
1048 hqP->tbInfo[idx].sCellActCe.val = allocInfo->tbInfo[idx].sCellActCe.val;
1052 if(( hqPAdded == TRUE) || (ROK == rgLaaPushHqPToScellLst(allocInfo,cell,timingInfo)))
1058 if (allocInfo->tbInfo[idx].schdDat[0].lcId == RG_CCCH_LCID)
1061 RG_FREE_MSG(hqP->tbInfo[idx].tb);
1063 /* L2 optimization for mUe/Tti: Pre-allocated mBuf pointers(macHdr,
1064 * macCes and MacPad) of harq TB need to be reset to db_base
1066 tb = &(hqP->tbInfo[idx].tb);
1068 if (tb->tbPres == TRUE)
1073 hqP->tbInfo[0].contResCe = allocInfo->tbInfo[0].contResCe;
1074 if(allocInfo->tbInfo[0].contResCe)
1076 hqP->tbInfo[0].contResId = &ue->contResId;
1080 if(allocInfo->tbInfo[idx].numSchLch == 0)
1082 RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
1083 "UEID:%d MSG4 with only contResId hqP(%d)",
1086 hqP->tbInfo[idx].numSchLch = 0;
1090 /* Increamenting the tbIndex instead of
1091 assigning it to constant */
1095 hqP->tbInfo[idx].numSchLch = 1;
1096 hqP->tbInfo[idx].schdData[0].lcId =
1097 allocInfo->tbInfo[idx].schdDat[0].lcId;
1098 hqP->tbInfo[idx].schdData[0].schdSz =
1099 allocInfo->tbInfo[idx].schdDat[0].numBytes;
1101 // if(cStaInd == NULLP)
1103 if ((rgAllocShrablSBuf(inst,(Data**)&cStaInd, sizeof(RguCStaIndInfo))) != ROK)
1105 err->errType = RGERR_DHM_SND_STA_IND;
1106 err->errCause = RG_DHM_MEM_ALLOC_FAIL;
1111 idx1 = (hqP->procId << 2) | tbIndex;
1113 cStaInd->cellId = cell->cellId;
1114 cStaInd->rnti = allocInfo->rnti;
1115 cStaInd->lcId = cell->dlCcchId;
1116 cStaInd->transId = (timingInfo.sfn << 16) |
1117 (timingInfo.slot << 8) | idx1;
1118 /* ADD Changes for Downlink UE Timing Optimization */
1119 #ifdef LTEMAC_DLUE_TMGOPTMZ
1120 dlSf->remDatReqCnt++;
1122 RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,
1123 "RNTI:%d UE:MSG4 grant for CCCH hqP(%d) LCID:%d",
1127 /* Fix : syed Avoid return param for interface prim and
1128 * proceed for other UEs. For the failed UE, MAC shall
1130 rgUIMSndCmnStaInd(cell->macInst,cell->rguDlSap,cStaInd);
1137 RG_FREE_MSG(hqP->tbInfo[idx].tb);
1139 /* L2 optimization for mUe/Tti: Pre-allocated mBuf pointers(macHdr,
1140 * macCes and MacPad) of harq TB need to be reset to db_base
1142 tb = &(hqP->tbInfo[idx].tb);
1143 if (tb->tbPres == TRUE)
1149 if((NULLP == dStaInd[rguDlSpId]) && (allocInfo->tbInfo[idx].numSchLch))
1151 if ((rgAllocShrablSBuf (inst,(Data**)&dStaInd[rguDlSpId], sizeof(RguDStaIndInfo))) != ROK)
1153 err->errType = RGERR_DHM_SND_STA_IND;
1154 err->errCause = RG_DHM_MEM_ALLOC_FAIL;
1155 /* Need to return as memory allocation will fail for other UEs also*/
1158 dStaInd[rguDlSpId]->nmbOfUeGrantPerTti = 0;
1159 rguDlSap[rguDlSpId] = ue->rguDlSap;
1164 lcIdx < allocInfo->tbInfo[idx].numSchLch; lcIdx++)
1166 hqP->tbInfo[idx].schdData[lcIdx].lcId =
1167 allocInfo->tbInfo[idx].schdDat[lcIdx].lcId;
1168 if (hqP->tbInfo[idx].schdData[lcIdx].lcId == 0)
1170 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
1171 "CCCH grant in DStaInd for LCID:%d CRNTI:%d",
1172 hqP->tbInfo[idx].schdData[lcIdx].lcId,allocInfo->rnti);
1174 hqP->tbInfo[idx].schdData[lcIdx].schdSz =
1175 allocInfo->tbInfo[idx].schdDat[lcIdx].numBytes;
1176 if(dStaInd[rguDlSpId])
1178 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].staIndTb[idx].\
1179 lchStaInd[lcIdx].lcId = allocInfo->tbInfo[idx].\
1180 schdDat[lcIdx].lcId;
1181 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].staIndTb[idx].\
1182 lchStaInd[lcIdx].totBufSize = allocInfo->tbInfo[idx].\
1183 schdDat[lcIdx].numBytes;
1186 lchBufSize+=allocInfo->tbInfo[idx].schdDat[lcIdx].numBytes;
1188 hqP->tbInfo[idx].numSchLch =
1189 allocInfo->tbInfo[idx].numSchLch;
1190 if(dStaInd[rguDlSpId])
1192 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].staIndTb[idx].nmbLch =
1193 allocInfo->tbInfo[idx].numSchLch;
1195 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].staIndTb[idx].tbId =
1202 //if((dStaInd) && (tbIndex) && (isDStaReqrd == TRUE))
1203 if((dStaInd[rguDlSpId]) && (tbIndex))
1205 idx1 = (hqP->procId << 2) | tbIndex;
1206 /* Create RguDStaInd struct and send to UIM */
1207 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].rnti = allocInfo->rnti;
1209 dStaInd->transId = (hqP->timingInfo.sfn << 16) |
1210 (hqP->timingInfo.slot << 8) | hqP->procId;
1212 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].transId = (timingInfo.sfn << 16) |
1213 (timingInfo.slot << 8) | idx1;
1214 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].nmbOfTbs = hqP->numOfTBs;
1216 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].fillCtrlPdu = allocInfo->fillCtrlPdu;
1218 /*increment num of UE as staInd is prepared for it */
1219 dStaInd[rguDlSpId]->nmbOfUeGrantPerTti++;
1220 /* ADD Changes for Downlink UE Timing Optimization */
1221 #ifdef LTEMAC_DLUE_TMGOPTMZ
1222 dlSf->remDatReqCnt++;
1225 //isDStaReqrd = FALSE;
1229 for(idx = 0; idx < rgCb[inst].numRguSaps ; idx++)
1231 if(dStaInd[idx] != NULLP)
1233 dStaInd[idx]->cellId = cell->cellId;
1234 /* Fix : syed Avoid return param for interface prim and
1235 * proceed for other UEs. For the failed UE, MAC shall
1237 rgUIMSndDedStaInd(inst,rguDlSap[idx],dStaInd[idx]);
1240 if(staIndCnt == activeSapCnt)
1241 break;/* all valid staind are considered */
1246 } /* rgDHMSndConsolidatedStaInd */
1250 * @brief Function to handle building the TFU Data Request
1254 * Function : rgDHMBldTfuDatReq
1256 * This function builds the TFU Data Request with the details
1257 * present in HARQ Process.
1259 * @param[in] RgDlHqProcCb *hqP
1260 * @param[out] TfuDatReqPduInfo *datReq
1264 //uint8_t crashFlag = 0;
1266 static Void rgDHMBldTfuDatReq
1271 RgTfuDatReqPduInfo *datReq
1274 static Void rgDHMBldTfuDatReq(cellCb, dlSf, hqP, datReq)
1278 RgTfuDatReqPduInfo *datReq;
1283 #if !(!(defined TENB_ACC) && !(defined LTE_PAL_ENB))
1285 #elif defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
1293 uint32_t lchIdx, pduIdx;
1296 datReq->nmbOfTBs = 0;
1298 #if !(!(defined TENB_ACC) && !(defined LTE_PAL_ENB))
1299 inst = cellCb->macInst - RG_INST_START;
1300 #elif defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
1301 inst = cellCb->macInst - RG_INST_START;
1304 /*MS_WORKAROUND for ccpu00123904*/
1305 datReq->isTApres = FALSE;
1306 #ifdef TFU_ALLOC_EVENT_NO_INIT
1308 datReq->mBuf[0] = 0;
1309 datReq->mBuf[1] = 0;
1313 for(i=0;i<RG_MAX_TB_PER_UE;i++)
1316 if ((hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf) &&
1317 (hqP->tbInfo[i].tb != NULLP))
1319 if ((hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf) &&
1320 RgUtlIsTbMuxed(&(hqP->tbInfo[i].tb)))
1324 datReq->rnti = hqP->tbInfo[i].pdcch.rnti;
1325 datReq->dciInfo = hqP->tbInfo[i].pdcch.dci;
1326 datReq->doa = hqP->tbInfo[i].doa;
1327 datReq->transMode = hqP->tbInfo[i].txMode;
1328 datReq->puschRptUsd = hqP->tbInfo[i].puschRptUsd;
1329 datReq->puschPmiInfo = hqP->tbInfo[i].puschPmiInfo;
1330 /*MS_WORKAROUND for ccpu00123904*/
1331 if (hqP->tbInfo[i].schdTa.pres)
1333 datReq->isTApres = TRUE;
1336 /* update pA value */
1337 datReq->pa = hqP->tbInfo[i].pa;
1339 /* LTE_ADV_FLAG_REMOVED_START */
1340 datReq->isEnbSFR = hqP->tbInfo[i].isEnbSFR;
1341 /* LTE_ADV_FLAG_REMOVED_END */
1343 #if (!(defined TENB_ACC) && !(defined LTE_PAL_ENB)) /* ABHI */ /* This is only temp fix. It needs to be removed
1344 after rebasing to MAC CCB */
1346 datReq->mBuf[i] = hqP->tbInfo[i].tb;
1348 /* Intel Tdd- Commenting out the Optimization for direct Access of
1350 /*Proper clean-up needed as this needs long stability tests
1352 #if defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
1353 SIncMsgRef(hqP->tbInfo[i].tb, RG_GET_MEM_REGION(rgCb[inst]),
1354 RG_GET_MEM_POOL(rgCb[inst]), &datReq->mBuf[i]);
1356 datReq->mBuf[i] = hqP->tbInfo[i].tb;
1360 SIncMsgRef(hqP->tbInfo[i].tb, RG_GET_MEM_REGION(rgCb[inst]),
1361 RG_GET_MEM_POOL(rgCb[inst]), &datReq->mBuf[i]);
1365 if(SFndLenMsg(datReq->mBuf[i], &dbgBufLen))
1369 RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId,
1370 "RNTI:%d SFN:%d slot:%d tbIdx:%d Sdu Length 0 ",
1372 hqP->tbInfo[i].timingInfo.sfn,
1373 hqP->tbInfo[i].timingInfo.slot,i);
1374 RLOG_ARG3(L_ERROR,DBG_CELLID,cellCb->cellId,
1375 "taPres [%d] numOfTbs [%d] format[%d]",
1378 datReq->dciInfo.format);
1383 /* L2 optimization for mUe/Tti: Removing SIncMsgRef to avoid additional
1384 * mBuf allocation. MAC header, MAC Ces, MAC PDU per LCH per TB Per UE
1385 * and MAC padding Mbufs are being sent to CL. Populating these Ptrs
1386 * From TB Info to TfuDatReq
1388 datReq->tbInfo[i].tbPres = TRUE;
1389 datReq->tbInfo[i].tbSize = hqP->tbInfo[i].tbSz;
1390 datReq->tbInfo[i].macHdr = hqP->tbInfo[i].tb.macHdr;
1391 datReq->tbInfo[i].macCes = hqP->tbInfo[i].tb.macCes;
1392 datReq->tbInfo[i].numLch = hqP->tbInfo[i].tb.numLch;
1393 for(lchIdx = 0; lchIdx < hqP->tbInfo[i].tb.numLch; lchIdx++)
1395 datReq->tbInfo[i].lchInfo[lchIdx].numPdu = hqP->tbInfo[i].tb.\
1396 lchInfo[lchIdx].numPdu;
1397 for(pduIdx = 0; pduIdx < hqP->tbInfo[i].tb.lchInfo[lchIdx].numPdu;\
1400 datReq->tbInfo[i].lchInfo[lchIdx].mBuf[pduIdx] =
1401 hqP->tbInfo[i].tb.lchInfo[lchIdx].mBuf[pduIdx];
1404 // datReq->tbInfo[i].macPad = hqP->tbInfo[i].tb.macPad;
1405 datReq->tbInfo[i].padSize = hqP->tbInfo[i].tb.padSize;
1406 // prc_trace_format_string(0x40,3,"TfuDatReq:RNTI=%d TbIdx=%d TbSize=%d PdSz=(%d) macHdraddr: (%p) macCEAddr: (%p) noLch=(%d)",datReq->rnti, i,
1407 // hqP->tbInfo[i].tbSz, datReq->tbInfo[i].padSize, datReq->tbInfo[i].macHdr, datReq->tbInfo[i].macCes, datReq->tbInfo[i].numLch);
1414 } /* rgDHMBldTfuDatReq */
1419 * @brief This function releases a HARQ process
1423 * Function: rgDHMFreeHqProcTB
1424 * Purpose: This function returns a HARQ process to HARQ Entity
1425 * in the DL direction.
1427 * 1. Add the HARQ process to the free queue.
1428 * Invoked by: scheduler and HARQ processing
1430 * @param[in] RgDlHqProc *hqP
1435 S16 rgDHMFreeHqProcTB
1441 S16 rgDHMFreeHqProcTB(hqP, tbIndex)
1446 RgTfuDatReqTbInfo *tb; /* TB to be sent to CL/PHY*/
1449 if((tbIndex > RG_MAX_TB_PER_UE) ||
1455 tb = &(hqP->tbInfo[tbIndex-1].tb);
1456 RG_FREE_MSG(tb->macHdr);
1457 RG_FREE_MSG(tb->macCes);
1459 for(idx = 0; idx < 2; idx++)
1461 if (hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sfLnk.node != NULLP)
1463 cmLListDelFrm(&hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sf->tbs,
1464 &(hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sfLnk));
1465 hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sfLnk.node = (PTR)NULLP;
1466 printf("\nrgDHMFreeHqProcTB:: hqP %p \n", (Void *)hqP);
1468 hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sf = NULLP;
1477 * @brief Handler for freeing up the harq related information from ueCb
1481 * Function : rgDHMFreeUe
1483 * This function shall free up the HARQ specific information from ueCb.
1485 * @param[in] Inst inst
1486 * @param[in] RgDlHqEnt *hqE
1498 Void rgDHMFreeUe(inst,hqE)
1507 /* Free all the memory associated with HARQ */
1508 for (i=0; i < hqE->numHqProcs; i++)
1511 rgDHMRlsHqProcTB(rgCb[inst].cell, hqE->procs[i], 1);
1512 rgDHMRlsHqProcTB(rgCb[inst].cell, hqE->procs[i], 2);
1514 rgDHMFreeHqProcTB(hqE->procs[i], 1);
1515 rgDHMFreeHqProcTB(hqE->procs[i], 2);
1518 rgFreeSBuf(inst,(Data **)&(hqE->procs[i]), sizeof(RgDlHqProcCb));
1520 rgDHMFreeSavedHqP(inst,hqE,i);
1524 /*ccpu00117052 - MOD - Passing double pointer for proper NULLP
1532 * @brief Function for handling RaResp request received from scheduler to MAC
1536 * Function : RgSchMacRstHqEntReq
1538 * This function shall be invoked whenever a sec cell of an ue
1539 * is deactivated. MAC needs to reset the harqentity associated
1540 * with the deactivated scell of the ue
1543 * @param[in] Pst *pst
1544 * @param[in] RgInfResetHqEnt *hqEntInfo
1549 S16 RgSchMacRstHqEntReq
1552 RgInfResetHqEnt* hqEntInfo
1555 S16 RgSchMacRstHqEntReq(pst, hqEntInfo)
1557 RgInfResetHqEnt* hqEntInfo;
1564 inst = pst->dstInst - RG_INST_START;
1566 if (((cell = rgCb[inst].cell) == NULLP) ||
1567 (rgCb[inst].cell->cellId != hqEntInfo->cellId))
1569 RGDBGERRNEW(inst,(rgPBuf(inst), "For user [%d]Cell does not exist %d\n",
1570 hqEntInfo->crnti,hqEntInfo->cellId));
1574 if ((ue = rgDBMGetUeCb(cell, hqEntInfo->crnti)) == NULLP)
1576 RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]UE does not exist for this hqEntInfo\n",
1581 rgDHMUeReset(cell, &ue->dl.hqEnt);
1588 * @brief Function for handling RaResp request received from scheduler to MAC
1592 * Function : RgSchMacRlsHqReq
1594 * This function shall be invoked whenever scheduler is done with the
1595 * allocations of random access responses for a slot.
1596 * This shall invoke RAM to create ueCbs for all the rapIds allocated and
1597 * shall invoke MUX to create RAR PDUs for raRntis allocated.
1600 * @param[in] CmLteCellId cellId,
1601 * @param[in] CmLteTimingInfo timingInfo,
1602 * @param[in] RaRespInfo *rarInfo
1607 S16 RgSchMacRlsHqReq
1610 RgInfRlsHqInfo *rlshqUeInfo
1613 S16 RgSchMacRlsHqReq(pst, rlshqUeInfo)
1615 RgInfRlsHqInfo *rlshqUeInfo;
1619 RgCellCb *cell = NULLP;
1625 RguHarqStatusInd hqStaInd;
1626 Bool isValidTbId = FALSE;
1628 uint32_t startTime=0;
1630 RG_IS_INST_VALID(pst->dstInst);
1631 inst = pst->dstInst - RG_INST_START;
1632 cell = rgCb[inst].cell;
1634 SStartTask(&startTime, PID_MAC_AM_HARQ_RLS);
1636 if(NULLP == rlshqUeInfo)
1642 ||( cell->cellId != rlshqUeInfo->cellId))
1645 RLOG_ARG0(L_ERROR,DBG_CELLID,rlshqUeInfo->cellId,
1646 "No cellCb found with cellId");
1650 if(NULLP == rlshqUeInfo->ueHqInfo)
1655 for(idx1 = 0; idx1 < rlshqUeInfo->numUes; idx1++)
1657 if((ue=rgDBMGetUeCb (cell, rlshqUeInfo->ueHqInfo[idx1].rnti)) == NULLP)
1659 /* Check in RachLst */
1660 if((ue=rgDBMGetUeCbFromRachLst (cell,
1661 rlshqUeInfo->ueHqInfo[idx1].rnti)) == NULLP)
1663 RLOG_ARG1(L_ERROR,DBG_CELLID,rlshqUeInfo->cellId, "CRNTI:%d No ueCb found",
1664 rlshqUeInfo->ueHqInfo[idx1].rnti);
1670 if ((rlshqUeInfo->ueHqInfo[idx1].rlsOperationType && !gSaveVal) || (rlshqUeInfo->ueHqInfo[idx1].hqProcId > 8))
1673 RLOG_ARG1(L_INFO," SPURIOUS CALLL !!!! procId %d \n", rlshqUeInfo->ueHqInfo[idx1].hqProcId);
1676 printf ("RgSchMacRlsHqReq cell %d : numUes %d idx %d rnti %d hqProc %d numTbs %d tbid[0] %d tbid[1] %d rlsopr %d \n",
1678 rlshqUeInfo->numUes,
1680 rlshqUeInfo->ueHqInfo[idx1].rnti,
1681 rlshqUeInfo->ueHqInfo[idx1].hqProcId,
1682 rlshqUeInfo->ueHqInfo[idx1].numOfTBs,
1683 rlshqUeInfo->ueHqInfo[idx1].tbId[0],
1684 rlshqUeInfo->ueHqInfo[idx1].tbId[1],
1685 rlshqUeInfo->ueHqInfo[idx1].rlsOperationType);
1693 RgSchMacHndlRelReq(cell, ue, &rlshqUeInfo->ueHqInfo[idx1]);
1695 if (RGINF_RLS_HQ_DEL_TB == rlshqUeInfo->ueHqInfo[idx1].rlsOperationType)
1697 /* If REQ is to DEL the saved TBs no need to free the HqP as it's already
1701 #endif /* LTE_ADV */
1702 rgDHMGetHqProcFrmId(ue,rlshqUeInfo->ueHqInfo[idx1].hqProcId,&hqP);
1703 if(rlshqUeInfo->ueHqInfo[idx1].status[0] != TRUE)
1705 rgCb[inst].genSts.numHarqFail++;
1709 hqStaInd.cellId = cell->cellId;
1710 hqStaInd.ueId = rlshqUeInfo->ueHqInfo[idx1].rnti;
1711 hqStaInd.numTbs = rlshqUeInfo->ueHqInfo[idx1].numOfTBs;
1714 for(idx2=0; idx2 < rlshqUeInfo->ueHqInfo[idx1].numOfTBs; idx2++)
1717 /* Fill the hq sta Ind stucture. Need to send the Status Ind for only
1718 those TBID's reported by Scheduler*/
1719 tbId = rlshqUeInfo->ueHqInfo[idx1].tbId[idx2];
1720 if (hqP->tbId[tbId-1] != RGU_INVALID_TBID)
1722 /* Fill the correct Sn Map corresponding to the TBID */
1723 hqStaInd.tbId[idx2] = hqP->tbId[tbId-1];
1724 hqStaInd.status[idx2] = rlshqUeInfo->ueHqInfo[idx1].status[idx2];
1728 if(rgDHMRlsHqProcTB(cell, hqP,
1729 rlshqUeInfo->ueHqInfo[idx1].tbId[idx2]) != ROK)
1731 RLOG_ARG1(L_ERROR,DBG_CELLID,rlshqUeInfo->cellId,
1732 "CRNTI:%d Failure in releasing hq TB",
1733 rlshqUeInfo->ueHqInfo[idx1].rnti);
1744 RgUiRguHqStaInd(&(ue->rguDlSap->sapCfg.sapPst),
1745 ue->rguDlSap->sapCfg.suId,
1749 {/* Ue is from rach list*/
1750 RgUiRguHqStaInd(&(cell->rguDlSap->sapCfg.sapPst),
1751 cell->rguDlSap->sapCfg.suId,
1756 } /* end of ues loop */
1759 SStopTask(startTime,PID_MAC_AM_HARQ_RLS);
1762 } /* end of RgSchMacRlsHqReq */
1765 /**********************************************************************
1768 **********************************************************************/