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 //EXTERN S16 ssGetDBufOfSize(Region region,Size size,Buffer **dBuf);
72 //void prc_trace_format_string(UINT32 group_mask, UINT16 level, const char *format, ...);
78 EXTERN S16 SIncMsgRef(Buffer *srcBuf,Region dstRegion, Pool dstPool,Buffer **dstBuf);
80 PRIVATE 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 U8 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 U8 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 // U32 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
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 /*PRIVATE U32 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;
700 tbIndex = (U8)(datReq->transId & 0x03);
701 /* Accept all the data requests even if delayed in case nothing
702 * has been sent earlier on the harq proc.
704 if((datReq->nmbOfTbs > RG_MAX_TB_PER_UE) ||
707 /* release corresponding TBs from SF tbs List */
708 for(j=0;j<datReq->nmbOfTbs;j++)
710 if (!(tbIndex & (j+1)))
714 rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (U8)(j+1));
719 for(i=0;i<datReq->nmbOfTbs;i++)
721 /* tbIndex 01 corresponds to presence of 1st TB
722 * 10 corresponds 2nd TB
723 * 11 corresponds two TBs of UE */
724 if (!(tbIndex & (i+1)))
728 if (hqProc->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node == NULLP)
730 /* release corresponding TBs from SF tbs List */
731 for(j=0;j<datReq->nmbOfTbs;j++)
733 if (!(tbIndex & (j+1)))
737 rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (U8)(j+1));
738 printf("\nrgDHMHndlDedDatReq:: hqP %p \n", (Void *)hqProc);
744 RG_FREE_MSG(hqProc->tbInfo[i].tb);
745 /* L2 optimization for mUe/Tti: Pre-allocated mBuf pointers(macHdr,
746 * macCes and MacPad) of harq TB need to be reset to db_base
749 tb = &hqProc->tbInfo[i].tb;
750 if (tb->tbPres == TRUE)
755 bldPdu.datReq = datReq;
756 bldPdu.reqType = EVTRGUDDATREQ;
757 bldPdu.schdTbSz = hqProc->tbInfo[i].tbSz;
758 bldPdu.tbIndex = i+1;
759 bldPdu.ta = hqProc->tbInfo[i].schdTa;
761 bldPdu.sCellActCe= hqProc->tbInfo[i].sCellActCe;
763 bldPdu.contResId = NULLP;
765 /* Store tbId from RLC in DDatRequest */
766 hqProc->tbId[i] = datReq->datReqTb[i].tbId;
769 hqProc->status[i] = FALSE;
771 if(rgMUXBldPdu(inst,&bldPdu, &(hqProc->tbInfo[i].tb), err) != ROK)
773 RLOG1(L_ERROR, "MUXing failed for: MacInst %d", inst);
774 RLOG4(L_ERROR, "MUXing failed for: time: %d/%d\
775 procId %d ueId %d", hqProc->tbInfo[i].timingInfo.sfn,
776 hqProc->tbInfo[i].timingInfo.slot, hqProc->procId,
777 hqProc->tbInfo[i].pdcch.rnti);
779 /* release corresponding TBs from SF tbs List */
780 for(j=0;j<datReq->nmbOfTbs;j++)
782 if (!(tbIndex & (j+1)))
786 rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (U8)(j+1));
791 SFndLenMsg(hqProc->tbInfo[i].tb, &len);
795 } /* rgDHMHndlDedDatReq */
798 * @brief Function to handle RGU datReq received from ROM
802 * Function : rgDHMHndlCmnDatReq
804 * This function shall act on the datReq received on RGU. It shall
805 * store the data IDs for all the logical channels and get the MAC
809 * @param[in] Inst inst
810 * @param[in] RgDlHqProcCb *hqProc
811 * @param[in] RgRguCmnDatReq *datReq
812 * @param[out] RgErrInfo *err
818 S16 rgDHMHndlCmnDatReq
821 RgDlHqProcCb *hqProc,
822 RgRguCmnDatReq *datReq,
826 S16 rgDHMHndlCmnDatReq(inst,hqProc, datReq, err)
828 RgDlHqProcCb *hqProc;
829 RgRguCmnDatReq *datReq;
837 if (hqProc->tbInfo[0].tb != NULLP)
839 /* If numLch is non zero means HQ Proc is busy*/
840 if (hqProc->tbInfo[0].tb.tbPres)
843 /* datReq discarded. Generate an alarm */
844 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_HARQ);
845 rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
846 LRG_CAUSE_HQ_PROC_BUSY, &dgn);
850 bldPdu.datReq = datReq;
851 bldPdu.reqType = EVTRGUCDATREQ;
852 bldPdu.schdTbSz = hqProc->tbInfo[0].tbSz;
853 bldPdu.ta = hqProc->tbInfo[0].schdTa;
855 bldPdu.sCellActCe= hqProc->tbInfo[0].sCellActCe;
858 bldPdu.contResId = hqProc->tbInfo[0].contResId;
860 if(rgMUXBldPdu(inst,&bldPdu, &(hqProc->tbInfo[0].tb), err) != ROK)
862 RLOG1(L_ERROR, "MUXing failed for: MacInst %d", inst);
863 RLOG4(L_ERROR, "MUXing failed for: time: %d/%d\
864 procId %d ueId %d", hqProc->tbInfo[0].timingInfo.sfn,
865 hqProc->tbInfo[0].timingInfo.slot, hqProc->procId,
866 hqProc->tbInfo[0].pdcch.rnti);
868 RG_FREE_MSG(datReq->pdu);
873 } /* rgDHMHndlCmnDatReq */
876 * @brief Function to get consolidate grants and send consolidated grant to RLC
880 * Function : rgDHMSndConsolidatedStaInd
882 * This function shall be invoked by Scheduler to trigger DHM to send a
883 * consolidated status indication of all UE scheduled in a TTI as well as
884 * send consolidated CStaInd for MSG4 and for all common channels(PCCH,
885 * if RGR_SI_SCH is not defined then it includes BCH and BCCH also)
888 * @param[in] RgCellCb *cell
889 * @param[in] RgInfUeInfo *ueInfo,
890 * @param[in] CmLteTimingInfo timingInfo,
891 * @param[out] RgErrInfo err
892 * @param[in] RguCStaIndInfo *cStaInd
899 S16 rgDHMSndConsolidatedStaInd
903 CmLteTimingInfo timingInfo,
907 S16 rgDHMSndConsolidatedStaInd(cell, ueInfo, timingInfo, err)
910 CmLteTimingInfo timingInfo;
914 SuId rguDlSpId;/*need to use spID instead of suID*/
919 RgDlSf *dlSf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
920 Inst inst = cell->macInst - RG_INST_START;
921 // Bool isDStaReqrd = FALSE;
922 RgRguDedStaInd *dStaInd[rgCb[inst].numRguSaps] ;
923 RgUpSapCb *rguDlSap[rgCb[inst].numRguSaps];
928 RgInfUeAlloc *allocInfo;
932 Bool hqPAdded = FALSE;
935 RgTfuDatReqTbInfo *tb; /* TB to be sent to CL/PHY*/
938 memset (dStaInd, 0, (sizeof(RgRguDedStaInd *) * rgCb[inst].numRguSaps));
939 memset (rguDlSap, 0, (sizeof(RgUpSapCb *) * rgCb[inst].numRguSaps));
941 /* Send StaInd for the scheduled UEs */
942 for(ueIdx = 0; ueIdx < ueInfo->numUes; ueIdx++)
947 if((ue=rgDBMGetUeCb (cell, ueInfo->allocInfo[ueIdx].rnti)) == NULLP)
949 /* Check in RachLst */
950 if((ue=rgDBMGetUeCbFromRachLst (cell,
951 ueInfo->allocInfo[ueIdx].rnti)) == NULLP)
953 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"CRNTI:%d No ueCb found",
954 ueInfo->allocInfo[ueIdx].rnti);
955 /*Fix: If one UE is not present dont return, look for the next.*/
961 rgDHMGetHqProcFrmId(ue,ueInfo->allocInfo[ueIdx].hqProcId,&hqP);
962 allocInfo = &ueInfo->allocInfo[ueIdx];
965 /* Fix : syed Avoid sending data for a RETX
966 * if initial TX data processing was unsuccessful */
967 if((allocInfo->tbInfo[0].isReTx == TRUE) &&
968 (hqP->tbInfo[0].tbSz == 0))
970 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
971 "CRNTI:%d RETX hqP(%d) tb(0) for a failed New Tx",
972 allocInfo->rnti, hqP->procId);
975 if((allocInfo->tbInfo[1].isReTx == TRUE) &&
976 (hqP->tbInfo[1].tbSz == 0))
978 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
979 "CRNTI:%d RETX hqP(%d) tb(1) for a failed New Tx",
980 allocInfo->rnti, hqP->procId);
984 if(ue->rguDlSap != NULLP)
986 rguDlSpId = ue->rguDlSap->sapCfg.spId;
988 {/* UeCb is from rachList */
989 rguDlSpId = cell->rguDlSap->sapCfg.spId;
993 for(idx=allocInfo->tbStrtIdx;((idx-allocInfo->tbStrtIdx) <\
994 allocInfo->nmbOfTBs); idx++)
996 RguCStaIndInfo *cStaInd;
998 /* LTE_ADV_FLAG_REMOVED_START */
999 hqP->tbInfo[idx].isEnbSFR = allocInfo->isEnbSFR;
1000 /* update pA value */
1001 hqP->tbInfo[idx].pa = allocInfo->pa;
1002 /* LTE_ADV_FLAG_REMOVED_END */
1005 hqP->numOfTBs = allocInfo->nmbOfTBs;
1006 hqP->tbInfo[idx].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node = (PTR)hqP;
1007 hqP->tbInfo[idx].sfLnkInfo[dlSf->schdTime.slot % 2].sf = dlSf;
1008 cmLListAdd2Tail(&dlSf->tbs,&(hqP->tbInfo[idx].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk));
1009 /* Changes as part of performance testing*/
1010 /* hqP->numOfTBs++;*/
1011 hqP->tbInfo[idx].doa = allocInfo->doa;
1012 hqP->tbInfo[idx].txMode = allocInfo->txMode;
1013 hqP->tbInfo[idx].puschRptUsd = allocInfo->puschRptUsd;
1014 hqP->tbInfo[idx].puschPmiInfo = allocInfo->puschPmiInfo;
1016 hqP->tbInfo[idx].pdcch.rnti = allocInfo->pdcchRnti;
1018 hqP->tbInfo[idx].pdcch.rnti = allocInfo->rnti;
1020 if(allocInfo->tbInfo[idx].isReTx == TRUE)
1022 hqP->tbInfo[idx].pdcch.dci = allocInfo->dciInfo;
1026 hqP->tbInfo[idx].timingInfo = timingInfo;
1027 hqP->tbInfo[idx].pdcch.dci = allocInfo->dciInfo;
1029 RG_FREE_MSG(hqP->tbInfo[idx].tb);
1031 /* L2 optimization for mUe/Tti: Pre-allocated mBuf pointers(macHdr,
1032 * macCes and MacPad) of harq TB need to be reset to db_base
1034 tb = &(hqP->tbInfo[idx].tb);
1035 if (tb->tbPres == TRUE)
1040 hqP->tbInfo[idx].tbSz = allocInfo->tbInfo[idx].schdTbSz;
1042 hqP->tbInfo[idx].schdTa.pres = allocInfo->tbInfo[idx].ta.pres;
1043 hqP->tbInfo[idx].schdTa.val = allocInfo->tbInfo[idx].ta.val;
1046 hqP->tbInfo[idx].sCellActCe.pres = allocInfo->tbInfo[idx].sCellActCe.pres;
1047 hqP->tbInfo[idx].sCellActCe.val = allocInfo->tbInfo[idx].sCellActCe.val;
1051 if(( hqPAdded == TRUE) || (ROK == rgLaaPushHqPToScellLst(allocInfo,cell,timingInfo)))
1057 if (allocInfo->tbInfo[idx].schdDat[0].lcId == RG_CCCH_LCID)
1060 RG_FREE_MSG(hqP->tbInfo[idx].tb);
1062 /* L2 optimization for mUe/Tti: Pre-allocated mBuf pointers(macHdr,
1063 * macCes and MacPad) of harq TB need to be reset to db_base
1065 tb = &(hqP->tbInfo[idx].tb);
1067 if (tb->tbPres == TRUE)
1072 hqP->tbInfo[0].contResCe = allocInfo->tbInfo[0].contResCe;
1073 if(allocInfo->tbInfo[0].contResCe)
1075 hqP->tbInfo[0].contResId = &ue->contResId;
1079 if(allocInfo->tbInfo[idx].numSchLch == 0)
1081 RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
1082 "UEID:%d MSG4 with only contResId hqP(%d)",
1085 hqP->tbInfo[idx].numSchLch = 0;
1089 /* Increamenting the tbIndex instead of
1090 assigning it to constant */
1094 hqP->tbInfo[idx].numSchLch = 1;
1095 hqP->tbInfo[idx].schdData[0].lcId =
1096 allocInfo->tbInfo[idx].schdDat[0].lcId;
1097 hqP->tbInfo[idx].schdData[0].schdSz =
1098 allocInfo->tbInfo[idx].schdDat[0].numBytes;
1100 // if(cStaInd == NULLP)
1102 if ((rgAllocShrablSBuf(inst,(Data**)&cStaInd, sizeof(RguCStaIndInfo))) != ROK)
1104 err->errType = RGERR_DHM_SND_STA_IND;
1105 err->errCause = RG_DHM_MEM_ALLOC_FAIL;
1110 idx1 = (hqP->procId << 2) | tbIndex;
1112 cStaInd->cellId = cell->cellId;
1113 cStaInd->rnti = allocInfo->rnti;
1114 cStaInd->lcId = cell->dlCcchId;
1115 cStaInd->transId = (timingInfo.sfn << 16) |
1116 (timingInfo.slot << 8) | idx1;
1117 /* ADD Changes for Downlink UE Timing Optimization */
1118 #ifdef LTEMAC_DLUE_TMGOPTMZ
1119 dlSf->remDatReqCnt++;
1121 RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,
1122 "RNTI:%d UE:MSG4 grant for CCCH hqP(%d) LCID:%d",
1126 /* Fix : syed Avoid return param for interface prim and
1127 * proceed for other UEs. For the failed UE, MAC shall
1129 rgUIMSndCmnStaInd(cell->macInst,cell->rguDlSap,cStaInd);
1136 RG_FREE_MSG(hqP->tbInfo[idx].tb);
1138 /* L2 optimization for mUe/Tti: Pre-allocated mBuf pointers(macHdr,
1139 * macCes and MacPad) of harq TB need to be reset to db_base
1141 tb = &(hqP->tbInfo[idx].tb);
1142 if (tb->tbPres == TRUE)
1148 if((NULLP == dStaInd[rguDlSpId]) && (allocInfo->tbInfo[idx].numSchLch))
1150 if ((rgAllocShrablSBuf (inst,(Data**)&dStaInd[rguDlSpId], sizeof(RguDStaIndInfo))) != ROK)
1152 err->errType = RGERR_DHM_SND_STA_IND;
1153 err->errCause = RG_DHM_MEM_ALLOC_FAIL;
1154 /* Need to return as memory allocation will fail for other UEs also*/
1157 dStaInd[rguDlSpId]->nmbOfUeGrantPerTti = 0;
1158 rguDlSap[rguDlSpId] = ue->rguDlSap;
1163 lcIdx < allocInfo->tbInfo[idx].numSchLch; lcIdx++)
1165 hqP->tbInfo[idx].schdData[lcIdx].lcId =
1166 allocInfo->tbInfo[idx].schdDat[lcIdx].lcId;
1167 if (hqP->tbInfo[idx].schdData[lcIdx].lcId == 0)
1169 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
1170 "CCCH grant in DStaInd for LCID:%d CRNTI:%d",
1171 hqP->tbInfo[idx].schdData[lcIdx].lcId,allocInfo->rnti);
1173 hqP->tbInfo[idx].schdData[lcIdx].schdSz =
1174 allocInfo->tbInfo[idx].schdDat[lcIdx].numBytes;
1175 if(dStaInd[rguDlSpId])
1177 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].staIndTb[idx].\
1178 lchStaInd[lcIdx].lcId = allocInfo->tbInfo[idx].\
1179 schdDat[lcIdx].lcId;
1180 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].staIndTb[idx].\
1181 lchStaInd[lcIdx].totBufSize = allocInfo->tbInfo[idx].\
1182 schdDat[lcIdx].numBytes;
1185 lchBufSize+=allocInfo->tbInfo[idx].schdDat[lcIdx].numBytes;
1187 hqP->tbInfo[idx].numSchLch =
1188 allocInfo->tbInfo[idx].numSchLch;
1189 if(dStaInd[rguDlSpId])
1191 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].staIndTb[idx].nmbLch =
1192 allocInfo->tbInfo[idx].numSchLch;
1194 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].staIndTb[idx].tbId =
1201 //if((dStaInd) && (tbIndex) && (isDStaReqrd == TRUE))
1202 if((dStaInd[rguDlSpId]) && (tbIndex))
1204 idx1 = (hqP->procId << 2) | tbIndex;
1205 /* Create RguDStaInd struct and send to UIM */
1206 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].rnti = allocInfo->rnti;
1208 dStaInd->transId = (hqP->timingInfo.sfn << 16) |
1209 (hqP->timingInfo.slot << 8) | hqP->procId;
1211 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].transId = (timingInfo.sfn << 16) |
1212 (timingInfo.slot << 8) | idx1;
1213 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].nmbOfTbs = hqP->numOfTBs;
1215 dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].fillCtrlPdu = allocInfo->fillCtrlPdu;
1217 /*increment num of UE as staInd is prepared for it */
1218 dStaInd[rguDlSpId]->nmbOfUeGrantPerTti++;
1219 /* ADD Changes for Downlink UE Timing Optimization */
1220 #ifdef LTEMAC_DLUE_TMGOPTMZ
1221 dlSf->remDatReqCnt++;
1224 //isDStaReqrd = FALSE;
1228 for(idx = 0; idx < rgCb[inst].numRguSaps ; idx++)
1230 if(dStaInd[idx] != NULLP)
1232 dStaInd[idx]->cellId = cell->cellId;
1233 /* Fix : syed Avoid return param for interface prim and
1234 * proceed for other UEs. For the failed UE, MAC shall
1236 rgUIMSndDedStaInd(inst,rguDlSap[idx],dStaInd[idx]);
1239 if(staIndCnt == activeSapCnt)
1240 break;/* all valid staind are considered */
1245 } /* rgDHMSndConsolidatedStaInd */
1249 * @brief Function to handle building the TFU Data Request
1253 * Function : rgDHMBldTfuDatReq
1255 * This function builds the TFU Data Request with the details
1256 * present in HARQ Process.
1258 * @param[in] RgDlHqProcCb *hqP
1259 * @param[out] TfuDatReqPduInfo *datReq
1265 PRIVATE Void rgDHMBldTfuDatReq
1270 RgTfuDatReqPduInfo *datReq
1273 PRIVATE Void rgDHMBldTfuDatReq(cellCb, dlSf, hqP, datReq)
1277 RgTfuDatReqPduInfo *datReq;
1282 #if !(!(defined TENB_ACC) && !(defined LTE_PAL_ENB))
1284 #elif defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
1295 datReq->nmbOfTBs = 0;
1297 #if !(!(defined TENB_ACC) && !(defined LTE_PAL_ENB))
1298 inst = cellCb->macInst - RG_INST_START;
1299 #elif defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
1300 inst = cellCb->macInst - RG_INST_START;
1303 /*MS_WORKAROUND for ccpu00123904*/
1304 datReq->isTApres = FALSE;
1305 #ifdef TFU_ALLOC_EVENT_NO_INIT
1307 datReq->mBuf[0] = 0;
1308 datReq->mBuf[1] = 0;
1312 for(i=0;i<RG_MAX_TB_PER_UE;i++)
1315 if ((hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf) &&
1316 (hqP->tbInfo[i].tb != NULLP))
1318 if ((hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf) &&
1319 RgUtlIsTbMuxed(&(hqP->tbInfo[i].tb)))
1323 datReq->rnti = hqP->tbInfo[i].pdcch.rnti;
1324 datReq->dciInfo = hqP->tbInfo[i].pdcch.dci;
1325 datReq->doa = hqP->tbInfo[i].doa;
1326 datReq->transMode = hqP->tbInfo[i].txMode;
1327 datReq->puschRptUsd = hqP->tbInfo[i].puschRptUsd;
1328 datReq->puschPmiInfo = hqP->tbInfo[i].puschPmiInfo;
1329 /*MS_WORKAROUND for ccpu00123904*/
1330 if (hqP->tbInfo[i].schdTa.pres)
1332 datReq->isTApres = TRUE;
1335 /* update pA value */
1336 datReq->pa = hqP->tbInfo[i].pa;
1338 /* LTE_ADV_FLAG_REMOVED_START */
1339 datReq->isEnbSFR = hqP->tbInfo[i].isEnbSFR;
1340 /* LTE_ADV_FLAG_REMOVED_END */
1342 #if (!(defined TENB_ACC) && !(defined LTE_PAL_ENB)) /* ABHI */ /* This is only temp fix. It needs to be removed
1343 after rebasing to MAC CCB */
1345 datReq->mBuf[i] = hqP->tbInfo[i].tb;
1347 /* Intel Tdd- Commenting out the Optimization for direct Access of
1349 /*Proper clean-up needed as this needs long stability tests
1351 #if defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
1352 SIncMsgRef(hqP->tbInfo[i].tb, RG_GET_MEM_REGION(rgCb[inst]),
1353 RG_GET_MEM_POOL(rgCb[inst]), &datReq->mBuf[i]);
1355 datReq->mBuf[i] = hqP->tbInfo[i].tb;
1359 SIncMsgRef(hqP->tbInfo[i].tb, RG_GET_MEM_REGION(rgCb[inst]),
1360 RG_GET_MEM_POOL(rgCb[inst]), &datReq->mBuf[i]);
1364 if(SFndLenMsg(datReq->mBuf[i], &dbgBufLen))
1368 RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId,
1369 "RNTI:%d SFN:%d slot:%d tbIdx:%d Sdu Length 0 ",
1371 hqP->tbInfo[i].timingInfo.sfn,
1372 hqP->tbInfo[i].timingInfo.slot,i);
1373 RLOG_ARG3(L_ERROR,DBG_CELLID,cellCb->cellId,
1374 "taPres [%d] numOfTbs [%d] format[%d]",
1377 datReq->dciInfo.format);
1382 /* L2 optimization for mUe/Tti: Removing SIncMsgRef to avoid additional
1383 * mBuf allocation. MAC header, MAC Ces, MAC PDU per LCH per TB Per UE
1384 * and MAC padding Mbufs are being sent to CL. Populating these Ptrs
1385 * From TB Info to TfuDatReq
1387 datReq->tbInfo[i].tbPres = TRUE;
1388 datReq->tbInfo[i].tbSize = hqP->tbInfo[i].tbSz;
1389 datReq->tbInfo[i].macHdr = hqP->tbInfo[i].tb.macHdr;
1390 datReq->tbInfo[i].macCes = hqP->tbInfo[i].tb.macCes;
1391 datReq->tbInfo[i].numLch = hqP->tbInfo[i].tb.numLch;
1392 for(lchIdx = 0; lchIdx < hqP->tbInfo[i].tb.numLch; lchIdx++)
1394 datReq->tbInfo[i].lchInfo[lchIdx].numPdu = hqP->tbInfo[i].tb.\
1395 lchInfo[lchIdx].numPdu;
1396 for(pduIdx = 0; pduIdx < hqP->tbInfo[i].tb.lchInfo[lchIdx].numPdu;\
1399 datReq->tbInfo[i].lchInfo[lchIdx].mBuf[pduIdx] =
1400 hqP->tbInfo[i].tb.lchInfo[lchIdx].mBuf[pduIdx];
1403 // datReq->tbInfo[i].macPad = hqP->tbInfo[i].tb.macPad;
1404 datReq->tbInfo[i].padSize = hqP->tbInfo[i].tb.padSize;
1405 // prc_trace_format_string(0x40,3,"TfuDatReq:RNTI=%d TbIdx=%d TbSize=%d PdSz=(%d) macHdraddr: (%p) macCEAddr: (%p) noLch=(%d)",datReq->rnti, i,
1406 // hqP->tbInfo[i].tbSz, datReq->tbInfo[i].padSize, datReq->tbInfo[i].macHdr, datReq->tbInfo[i].macCes, datReq->tbInfo[i].numLch);
1413 } /* rgDHMBldTfuDatReq */
1418 * @brief This function releases a HARQ process
1422 * Function: rgDHMFreeHqProcTB
1423 * Purpose: This function returns a HARQ process to HARQ Entity
1424 * in the DL direction.
1426 * 1. Add the HARQ process to the free queue.
1427 * Invoked by: scheduler and HARQ processing
1429 * @param[in] RgDlHqProc *hqP
1434 S16 rgDHMFreeHqProcTB
1440 S16 rgDHMFreeHqProcTB(hqP, tbIndex)
1445 RgTfuDatReqTbInfo *tb; /* TB to be sent to CL/PHY*/
1448 if((tbIndex > RG_MAX_TB_PER_UE) ||
1454 tb = &(hqP->tbInfo[tbIndex-1].tb);
1455 RG_FREE_MSG(tb->macHdr);
1456 RG_FREE_MSG(tb->macCes);
1458 for(idx = 0; idx < 2; idx++)
1460 if (hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sfLnk.node != NULLP)
1462 cmLListDelFrm(&hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sf->tbs,
1463 &(hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sfLnk));
1464 hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sfLnk.node = (PTR)NULLP;
1465 printf("\nrgDHMFreeHqProcTB:: hqP %p \n", (Void *)hqP);
1467 hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sf = NULLP;
1476 * @brief Handler for freeing up the harq related information from ueCb
1480 * Function : rgDHMFreeUe
1482 * This function shall free up the HARQ specific information from ueCb.
1484 * @param[in] Inst inst
1485 * @param[in] RgDlHqEnt *hqE
1497 Void rgDHMFreeUe(inst,hqE)
1506 /* Free all the memory associated with HARQ */
1507 for (i=0; i < hqE->numHqProcs; i++)
1510 rgDHMRlsHqProcTB(rgCb[inst].cell, hqE->procs[i], 1);
1511 rgDHMRlsHqProcTB(rgCb[inst].cell, hqE->procs[i], 2);
1513 rgDHMFreeHqProcTB(hqE->procs[i], 1);
1514 rgDHMFreeHqProcTB(hqE->procs[i], 2);
1517 rgFreeSBuf(inst,(Data **)&(hqE->procs[i]), sizeof(RgDlHqProcCb));
1519 rgDHMFreeSavedHqP(inst,hqE,i);
1523 /*ccpu00117052 - MOD - Passing double pointer for proper NULLP
1531 * @brief Function for handling RaResp request received from scheduler to MAC
1535 * Function : RgSchMacRstHqEntReq
1537 * This function shall be invoked whenever a sec cell of an ue
1538 * is deactivated. MAC needs to reset the harqentity associated
1539 * with the deactivated scell of the ue
1542 * @param[in] Pst *pst
1543 * @param[in] RgInfResetHqEnt *hqEntInfo
1548 S16 RgSchMacRstHqEntReq
1551 RgInfResetHqEnt* hqEntInfo
1554 S16 RgSchMacRstHqEntReq(pst, hqEntInfo)
1556 RgInfResetHqEnt* hqEntInfo;
1563 inst = pst->dstInst - RG_INST_START;
1565 if (((cell = rgCb[inst].cell) == NULLP) ||
1566 (rgCb[inst].cell->cellId != hqEntInfo->cellId))
1568 RGDBGERRNEW(inst,(rgPBuf(inst), "For user [%d]Cell does not exist %d\n",
1569 hqEntInfo->crnti,hqEntInfo->cellId));
1573 if ((ue = rgDBMGetUeCb(cell, hqEntInfo->crnti)) == NULLP)
1575 RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]UE does not exist for this hqEntInfo\n",
1580 rgDHMUeReset(cell, &ue->dl.hqEnt);
1587 * @brief Function for handling RaResp request received from scheduler to MAC
1591 * Function : RgSchMacRlsHqReq
1593 * This function shall be invoked whenever scheduler is done with the
1594 * allocations of random access responses for a slot.
1595 * This shall invoke RAM to create ueCbs for all the rapIds allocated and
1596 * shall invoke MUX to create RAR PDUs for raRntis allocated.
1599 * @param[in] CmLteCellId cellId,
1600 * @param[in] CmLteTimingInfo timingInfo,
1601 * @param[in] RaRespInfo *rarInfo
1606 S16 RgSchMacRlsHqReq
1609 RgInfRlsHqInfo *rlshqUeInfo
1612 S16 RgSchMacRlsHqReq(pst, rlshqUeInfo)
1614 RgInfRlsHqInfo *rlshqUeInfo;
1618 RgCellCb *cell = NULLP;
1624 RguHarqStatusInd hqStaInd;
1625 Bool isValidTbId = FALSE;
1629 RG_IS_INST_VALID(pst->dstInst);
1630 inst = pst->dstInst - RG_INST_START;
1631 cell = rgCb[inst].cell;
1633 SStartTask(&startTime, PID_MAC_AM_HARQ_RLS);
1635 if(NULLP == rlshqUeInfo)
1641 ||( cell->cellId != rlshqUeInfo->cellId))
1644 RLOG_ARG0(L_ERROR,DBG_CELLID,rlshqUeInfo->cellId,
1645 "No cellCb found with cellId");
1649 if(NULLP == rlshqUeInfo->ueHqInfo)
1654 for(idx1 = 0; idx1 < rlshqUeInfo->numUes; idx1++)
1656 if((ue=rgDBMGetUeCb (cell, rlshqUeInfo->ueHqInfo[idx1].rnti)) == NULLP)
1658 /* Check in RachLst */
1659 if((ue=rgDBMGetUeCbFromRachLst (cell,
1660 rlshqUeInfo->ueHqInfo[idx1].rnti)) == NULLP)
1662 RLOG_ARG1(L_ERROR,DBG_CELLID,rlshqUeInfo->cellId, "CRNTI:%d No ueCb found",
1663 rlshqUeInfo->ueHqInfo[idx1].rnti);
1669 if ((rlshqUeInfo->ueHqInfo[idx1].rlsOperationType && !gSaveVal) || (rlshqUeInfo->ueHqInfo[idx1].hqProcId > 8))
1672 RLOG_ARG1(L_INFO," SPURIOUS CALLL !!!! procId %d \n", rlshqUeInfo->ueHqInfo[idx1].hqProcId);
1675 printf ("RgSchMacRlsHqReq cell %d : numUes %d idx %d rnti %d hqProc %d numTbs %d tbid[0] %d tbid[1] %d rlsopr %d \n",
1677 rlshqUeInfo->numUes,
1679 rlshqUeInfo->ueHqInfo[idx1].rnti,
1680 rlshqUeInfo->ueHqInfo[idx1].hqProcId,
1681 rlshqUeInfo->ueHqInfo[idx1].numOfTBs,
1682 rlshqUeInfo->ueHqInfo[idx1].tbId[0],
1683 rlshqUeInfo->ueHqInfo[idx1].tbId[1],
1684 rlshqUeInfo->ueHqInfo[idx1].rlsOperationType);
1692 RgSchMacHndlRelReq(cell, ue, &rlshqUeInfo->ueHqInfo[idx1]);
1694 if (RGINF_RLS_HQ_DEL_TB == rlshqUeInfo->ueHqInfo[idx1].rlsOperationType)
1696 /* If REQ is to DEL the saved TBs no need to free the HqP as it's already
1700 #endif /* LTE_ADV */
1701 rgDHMGetHqProcFrmId(ue,rlshqUeInfo->ueHqInfo[idx1].hqProcId,&hqP);
1702 if(rlshqUeInfo->ueHqInfo[idx1].status[0] != TRUE)
1704 rgCb[inst].genSts.numHarqFail++;
1708 hqStaInd.cellId = cell->cellId;
1709 hqStaInd.ueId = rlshqUeInfo->ueHqInfo[idx1].rnti;
1710 hqStaInd.numTbs = rlshqUeInfo->ueHqInfo[idx1].numOfTBs;
1713 for(idx2=0; idx2 < rlshqUeInfo->ueHqInfo[idx1].numOfTBs; idx2++)
1716 /* Fill the hq sta Ind stucture. Need to send the Status Ind for only
1717 those TBID's reported by Scheduler*/
1718 tbId = rlshqUeInfo->ueHqInfo[idx1].tbId[idx2];
1719 if (hqP->tbId[tbId-1] != RGU_INVALID_TBID)
1721 /* Fill the correct Sn Map corresponding to the TBID */
1722 hqStaInd.tbId[idx2] = hqP->tbId[tbId-1];
1723 hqStaInd.status[idx2] = rlshqUeInfo->ueHqInfo[idx1].status[idx2];
1727 if(rgDHMRlsHqProcTB(cell, hqP,
1728 rlshqUeInfo->ueHqInfo[idx1].tbId[idx2]) != ROK)
1730 RLOG_ARG1(L_ERROR,DBG_CELLID,rlshqUeInfo->cellId,
1731 "CRNTI:%d Failure in releasing hq TB",
1732 rlshqUeInfo->ueHqInfo[idx1].rnti);
1743 RgUiRguHqStaInd(&(ue->rguDlSap->sapCfg.sapPst),
1744 ue->rguDlSap->sapCfg.suId,
1748 {/* Ue is from rach list*/
1749 RgUiRguHqStaInd(&(cell->rguDlSap->sapCfg.sapPst),
1750 cell->rguDlSap->sapCfg.suId,
1755 } /* end of ues loop */
1758 SStopTask(startTime,PID_MAC_AM_HARQ_RLS);
1761 } /* end of RgSchMacRlsHqReq */
1764 /**********************************************************************
1767 **********************************************************************/