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 static const char* RLOG_MODULE_NAME="MAC";
32 static int RLOG_FILE_ID=237;
33 static int RLOG_MODULE_ID=4096;
35 @brief This module does processing related to handling of lower interface APIs
36 invoked by PHY towards MAC
38 /* header include files -- defines (.h) */
39 #include "common_def.h"
40 #include "rgu.h" /* RGU defines */
41 #include "tfu.h" /* RGU defines */
42 #include "lrg.h" /* layer management defines for LTE-MAC */
43 #include "crg.h" /* layer management defines for LTE-MAC */
44 #include "rg_sch_inf.h" /* layer management defines for LTE-MAC */
45 #include "rg.h" /* defines and macros for MAC */
46 #include "rg_env.h" /* defines and macros for MAC */
47 #include "rg_err.h" /* defines and macros for MAC */
48 #include "rgm.h" /* layer management typedefs for MAC */
50 /* header/extern include files (.x) */
51 #include "crg.x" /* CRG interface typedefs */
52 #include "rgu.x" /* RGU types */
53 #include "tfu.x" /* RGU types */
54 #include "lrg.x" /* layer management typedefs for MAC */
55 #include "rg_sch_inf.x" /* SCH interface typedefs */
56 #include "rg_prg.x" /* PRG interface typedefs */
57 #include "rgm.x" /* layer management typedefs for MAC */
58 #include "rg.x" /* typedefs for MAC */
59 #ifdef MAC_RLC_UL_RBUF
64 /* ADD Changes for Downlink UE Timing Optimization */
65 #ifndef LTEMAC_DLUE_TMGOPTMZ
66 PRIVATE S16 rgTOMUtlProcDlSf ARGS(( RgDlSf *dlSf, RgCellCb *cellCb,
69 S16 rgTOMUtlProcDlSf ARGS((RgDlSf *dlSf, RgCellCb *cellCb,
72 PRIVATE S16 rgTOMProcCrntiCEInDatInd ARGS((
81 PRIVATE S16 rgTOMProcCCCHSduInDatInd ARGS((
96 EXTERN S16 RgUiRguFlowCntrlInd(Pst* pst, SuId suId, RguFlowCntrlInd *flowCntrlInd);
98 EXTERN S16 rgEmtcHndl(RgCellCb *cell,RgInfSfAlloc *sfInfo);
99 EXTERN S16 rgTOMEmtcUtlFillDatReqPdus(TfuDatReqInfo *datInfo, RgDlSf *dlSf, RgCellCb *cell, RgErrInfo *err);
100 EXTERN Void rgTOMEmtcRlsSf(RgDlSf *dlSf);
103 PRIVATE Void rgTOML2MCompileActiveLCs ARGS
110 PRIVATE S16 rgTOMUtlL2MStoreBufSz ARGS
116 PRIVATE S16 rgTomUtlPrepareL2MUlThrpInfo ARGS
120 RgRguDedDatInd *dDatInd
124 /* The below table takes lower values of BSR Range for a BSR value
125 This is to ensure that outstanding can be decrease to zero upon reception of
126 TB, which is not guaranteed if higher Range values are used */
127 /* Note: taking value 10 for BSR index 1 */
128 #ifndef MAC_5GTF_UPDATE
129 PRIVATE U32 rgLwrBsrTbl[64] = {
130 0, 10, 10, 12, 14, 17, 19, 22, 26,
131 31, 36, 42, 49, 57, 67, 78, 91,
132 107, 125, 146, 171, 200, 234, 274, 321,
133 376, 440, 515, 603, 706, 826, 967, 1132,
134 1326, 1552, 1817, 2127, 2490, 2915, 3413, 3995,
135 4677, 5476, 6411, 7505, 8787, 10287, 12043, 14099,
136 16507, 19325, 22624, 26487, 31009, 36304, 42502, 49759,
137 58255, 68201, 79846, 93479, 109439, 128125, 150000
141 PRIVATE U32 rgLwrBsrTbl[64] = {
142 0,10,13,16,19,23,29,35,43,53,65,80,98,120,147,181,223,274,337,414,
143 509,625,769,945,1162,1429,1757,2161,2657,3267,4017,4940,6074,7469,
144 9185,11294,13888,17077,20999,25822,31752,39045,48012,59039,72598,
145 89272,109774,134986,165989,204111,250990,308634,379519,466683,
146 573866,705666,867737,1067031,1312097,1613447,1984009,2439678,
154 #define RG_TOM_INF_ALLOC(_pdu, _size, _dataPtr, _ret) {\
155 _ret = cmGetMem((Ptr)&_pdu->memCp, _size, (Ptr *)&_dataPtr); \
158 /* global variables */
161 EXTERN U32 grgUlrate_tfu;
164 /** @brief This function fills the PDSCH data of a downlink subframe
168 * Function: rgTOMUtlFillDatReqPdus
171 * - Fill BCCH on DLSCH data using datInfo
172 * - Fill PCCH on DLSCH data using datInfo
173 * - Fill Dedicated data on DLSCH data using datInfo
174 * - Fill RA RSP data using datInfo
176 * @param [out] TfuDatReqInfo *datInfo
177 * @param [in] RgDlSf *dlSf
178 * @param [in] RgCellCb *cellCb
179 * @param [out] RgErrInfo *err
185 PRIVATE S16 rgTOMUtlFillDatReqPdus
187 TfuDatReqInfo *datInfo,
193 PRIVATE S16 rgTOMUtlFillDatReqPdus(datInfo, dlSf, cellCb, err)
194 TfuDatReqInfo *datInfo;
201 TfuDatReqPduInfo *datReq=NULLP;
202 /* Moving node declaration to limited scope for optimization */
205 Inst inst = cellCb->macInst - RG_INST_START;
207 TRC2(rgTOMUtlFillDatReqPdus)
209 /* first lets send the BCCH data down to PHY */
210 if (dlSf->bcch.tb != NULLP)
212 if ((ret = rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo),
213 &(datInfo->memCp))) != ROK)
215 err->errCause = RGERR_TOM_MEM_EXHAUST;
216 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Memory Exhaustion ");
219 #ifdef TFU_ALLOC_EVENT_NO_INIT
223 datReq->tbInfo[0].lchInfo[0].mBuf[0]=NULLP;
226 datReq->rnti = RG_SI_RNTI;
227 datReq->dciInfo = dlSf->bcch.pdcch.dci;
228 /* Note: SCpyMsgMsg is not done since free of unsent buffer
229 * has been taken care through cell delete by invoking rgTomRlsSf
231 datReq->nmbOfTBs = 1;
233 datReq->mBuf[0] = dlSf->bcch.tb;
235 SFndLenMsg((Buffer *)dlSf->bcch.tb, &(datReq->tbInfo[0].tbSize));
236 datReq->tbInfo[0].tbPres = TRUE;
237 datReq->tbInfo[0].lchInfo[0].mBuf[0] = dlSf->bcch.tb;
238 datReq->tbInfo[0].numLch = 1;
239 datReq->tbInfo[0].lchInfo[0].numPdu = 1;
241 #ifdef TFU_ALLOC_EVENT_NO_INIT
242 datReq->tbInfo[1].tbPres = FALSE;
243 datReq->tbInfo[1].lchInfo[0].mBuf[0] = NULLP;
246 cmLListAdd2Tail(&datInfo->pdus, &(datReq->lnk));
247 datReq->lnk.node = (PTR)datReq;
249 /* ccpu00132314-ADD- Adding txPower offset for the PDSCH transmission */
250 datReq->txPwrOffset = dlSf->bcch.txPwrOffset;
252 /* Setting the pointer to NULL post transmission */
253 dlSf->bcch.tb = NULLP;
256 if (dlSf->pcch.tb != NULLP)
258 if ((ret = rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo),
259 &(datInfo->memCp))) != ROK)
261 err->errCause = RGERR_TOM_MEM_EXHAUST;
262 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Memory Exhaustion CRNTI:%d",datReq->rnti);
265 #ifdef TFU_ALLOC_EVENT_NO_INIT
270 datReq->rnti = RG_P_RNTI;
271 datReq->dciInfo = dlSf->pcch.pdcch.dci;
272 datReq->nmbOfTBs = 1;
274 datReq->mBuf[0] = dlSf->pcch.tb;
276 SFndLenMsg((Buffer *)dlSf->pcch.tb, &datReq->tbInfo[0].tbSize);
277 datReq->tbInfo[0].tbPres = TRUE;
278 datReq->tbInfo[0].lchInfo[0].mBuf[0] = dlSf->pcch.tb;
279 #ifdef TFU_ALLOC_EVENT_NO_INIT
280 datReq->tbInfo[1].tbPres = FALSE;
281 datReq->tbInfo[1].lchInfo[0].mBuf[0] = NULLP;
283 datReq->tbInfo[0].numLch = 1;
284 datReq->tbInfo[0].lchInfo[0].numPdu = 1;
286 cmLListAdd2Tail(&datInfo->pdus, &(datReq->lnk));
287 datReq->lnk.node = (PTR)datReq;
289 /* ccpu00132314-ADD- Adding txPower offset for the PDSCH transmission */
290 datReq->txPwrOffset = dlSf->pcch.txPwrOffset;
292 dlSf->pcch.tb = NULLP;
295 for(idx=0; idx < dlSf->numRaRsp; idx++)
297 if ((ret = rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo),
298 &(datInfo->memCp))) != ROK)
300 err->errCause = RGERR_TOM_MEM_EXHAUST;
301 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Memory Exhaustion CRNTI:%d",
305 #ifdef TFU_ALLOC_EVENT_NO_INIT
310 datReq->rnti = dlSf->raRsp[idx].pdcch.rnti;
311 datReq->dciInfo = dlSf->raRsp[idx].pdcch.dci;
312 datReq->nmbOfTBs = 1;
314 datReq->mBuf[0] = dlSf->raRsp[idx].rar;
316 SFndLenMsg((Buffer *)dlSf->raRsp[idx].rar, &datReq->tbInfo[0].tbSize);
317 datReq->tbInfo[0].tbPres = TRUE;
318 datReq->tbInfo[0].lchInfo[0].mBuf[0] = dlSf->raRsp[idx].rar;
319 #ifdef TFU_ALLOC_EVENT_NO_INIT
320 datReq->tbInfo[1].lchInfo[0].mBuf[0] = NULLP;
321 datReq->tbInfo[1].tbPres = FALSE;
323 datReq->tbInfo[0].numLch = 1;
324 datReq->tbInfo[0].lchInfo[0].numPdu = 1;
325 // prc_trace_format_string(0x40,3,"UE Id=(%d) tbSz=(%d)",datReq->rnti, datReq->tbInfo[0].tbSize);
327 cmLListAdd2Tail(&datInfo->pdus, &(datReq->lnk));
328 datReq->lnk.node = (PTR)datReq;
330 /* ccpu00132314-ADD- Adding txPower offset for the PDSCH transmission */
331 datReq->txPwrOffset = dlSf->raRsp[idx].txPwrOffset;
333 dlSf->raRsp[idx].rar = NULLP;
336 /* Fill Dedicated UE data */
337 if (dlSf->tbs.count != 0)
340 while (dlSf->tbs.first)
342 node = dlSf->tbs.first;
343 hqCb = (RgDlHqProcCb*)node->node;
344 if ((ret = rgDHMSndDatReq (cellCb, dlSf, datInfo, hqCb, err)) != ROK)
346 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,
347 "DHM unable to fill DATA request");
348 err->errType = RGERR_TOM_TTIIND;
355 } /* end of rgTOMUtlFillDatReqPdus*/
357 /** @brief This function does all the processing related to a single downlink
362 * Function: rgTOMUtlProcDlSf
365 * - collate control data for all UEs and send to PHY
366 * - collate data buffers for all UEs and send to PHY
368 * @param [in] RgDlSf *dlSf
369 * @param [in] RgCellCb *cellCb
370 * @param [out] RgErrInfo *err
373 /* ADD Changes for Downlink UE Timing Optimization */
374 #ifndef LTEMAC_DLUE_TMGOPTMZ
376 PRIVATE S16 rgTOMUtlProcDlSf
383 PRIVATE S16 rgTOMUtlProcDlSf (dlSf, cellCb, err)
397 S16 rgTOMUtlProcDlSf (dlSf, cellCb, err)
405 TfuDatReqInfo *datInfo;
406 Inst inst = cellCb->macInst - RG_INST_START;
408 TRC2(rgTOMUtlProcDlSf);
410 /* Fill Data Request Info from scheduler to PHY */
411 if ((ret = rgAllocEventMem(inst,(Ptr *)&datInfo,
412 sizeof(TfuDatReqInfo))) != ROK)
414 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to Allocate TfuDatReqInfo");
419 cmLListInit(&datInfo->pdus);
421 RGADDTOCRNTTIME(dlSf->schdTime, datInfo->timingInfo, TFU_DELTA);
423 RGADDTOCRNTTIME(dlSf->schdTime, datInfo->timingInfo, TFU_DLDATA_DLDELTA);
425 datInfo->cellId = cellCb->cellId;
426 if((0 == (datInfo->timingInfo.sfn % 30)) && (0 == datInfo->timingInfo.slot))
428 //printf("5GTF_CHECK rgTOMUtlProcDlSf dat (%d : %d)\n", datInfo->timingInfo.sfn, datInfo->timingInfo.slot);
430 #ifdef TFU_ALLOC_EVENT_NO_INIT
431 datInfo->bchDat.pres = 0;
435 if (dlSf->bch.tb != NULLP)
437 datInfo->bchDat.pres = PRSNT_NODEF;
438 datInfo->bchDat.val = dlSf->bch.tb;
439 dlSf->bch.tb = NULLP;
442 /* Fill the DLSCH PDUs of BCCH, PCCH and Dedicated Channels */
443 if ((ret = rgTOMEmtcUtlFillDatReqPdus(datInfo, dlSf, cellCb, err)) != ROK)
445 RG_FREE_MEM(datInfo);
449 /* Fill the DLSCH PDUs of BCCH, PCCH and Dedicated Channels */
450 if ((ret = rgTOMUtlFillDatReqPdus(datInfo, dlSf, cellCb, err)) != ROK)
452 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to send data for cell");
453 RG_FREE_MEM(datInfo);
456 if((datInfo->pdus.count) || (datInfo->bchDat.pres == TRUE))
458 /* sending the data to Phy */
459 if (rgLIMTfuDatReq(inst,datInfo) != ROK)
461 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to send data info for cell");
466 /* Nothing to send: free the allocated datInfo */
467 RG_FREE_MEM(datInfo);
475 /** @brief This function allocates the RgMacPdu that will be populated by DEMUX
476 * with the SubHeaders list and the values of the Control elements.
480 * Function: rgTOMUtlAllocPduEvnt
483 * @param[in] Inst inst
484 * @param [out] RgMacPdu **pdu
491 PRIVATE S16 rgTOMUtlAllocPduEvnt
497 PRIVATE S16 rgTOMUtlAllocPduEvnt (inst,pdu)
504 RgUstaDgn dgn; /* Alarm diagnostics structure */
505 VOLATILE U32 startTime=0;
507 TRC2(rgTOMUtlAllocPduEvnt);
509 evntMem.region = rgCb[inst].rgInit.region;
510 evntMem.pool = rgCb[inst].rgInit.pool;
513 SStartTask(&startTime, PID_TOMUTL_CMALLCEVT);
515 #ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */
516 MS_BUF_ADD_ALLOC_CALLER();
519 if (cmAllocEvnt (sizeof (RgMacPdu), RG_BLKSZ, &evntMem, (Ptr*)pdu) != ROK)
521 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
522 rgLMMStaInd(inst,LCM_CATEGORY_RESOURCE, LCM_EVENT_DMEM_ALLOC_FAIL,
523 LCM_CAUSE_MEM_ALLOC_FAIL, &dgn);
524 RLOG0(L_ERROR,"Allocation of DUX event failed");
529 SStopTask(startTime, PID_TOMUTL_CMALLCEVT);
534 /** @brief This function frees up the RgMacPdu structure that has been
535 * populated by demux.
539 * Function: rgTOMUtlFreePduEvnt
540 * - Function frees up the RgMacPdu structure, in case of error it shall
541 * free up the buffer's present in the different sdu.
544 * @param [in] Inst inst
545 * @param [in] RgMacPdu *pdu
546 * @param [in] Bool *error
550 PRIVATE Void rgTOMUtlFreePduEvnt
556 PRIVATE Void rgTOMUtlFreePduEvnt (pdu, error)
565 TRC2(rgTOMUtlFreePduEvnt);
566 /* Steps of freeing up the PDU.
567 * 1. loop through the subHdrLst and free up all the buffers.
568 * 2. free up the whole event
570 if ((error == TRUE) && (pdu->sduLst.count > 0))
572 node = pdu->sduLst.first;
575 sdu = (RgMacSdu*)node->node;
576 RG_FREE_MSG(sdu->mBuf);
582 } /* end of rgTOMUtlFreePduEvnt */
584 /** @brief This function allocates the RgMacPdu that will be populated by DEMUX
585 * with the SubHeaders list and the values of the Control elements.
589 * Function: rgTOMInfAllocPduEvnt
592 * @param [in] Inst inst
593 * @param [out] RgMacPdu **pdu
600 PRIVATE S16 rgTOMInfAllocPduEvnt
603 RgInfSfDatInd **sfInfo
606 PRIVATE S16 rgTOMInfAllocPduEvnt (inst,sfInfo)
608 RgInfSfDatInd **sfInfo;
613 RgUstaDgn dgn; /* Alarm diagnostics structure */
614 VOLATILE U32 startTime=0;
616 TRC2(rgTOMInfAllocPduEvnt);
618 evntMem.region = rgCb[inst].rgInit.region;
619 evntMem.pool = rgCb[inst].rgInit.pool;
622 SStartTask(&startTime, PID_TOMINF_CMALLCEVT);
624 #ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */
625 MS_BUF_ADD_ALLOC_CALLER();
627 if (cmAllocEvnt (sizeof (RgInfSfDatInd), RG_BLKSZ, &evntMem, (Ptr*)sfInfo) != ROK)
629 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
630 rgLMMStaInd(inst,LCM_CATEGORY_RESOURCE, LCM_EVENT_DMEM_ALLOC_FAIL,
631 LCM_CAUSE_MEM_ALLOC_FAIL, &dgn);
632 RLOG0(L_ERROR,"Allocation failed");
637 SStopTask(startTime, PID_TOMINF_CMALLCEVT);
642 /** @brief This function frees up the RgMacPdu structure that has been
643 * populated by demux.
647 * Function: rgTOMInfFreePduEvnt
648 * - Function frees up the RgMacPdu structure, in case of error it shall
649 * free up the buffer's present in the different sdu.
652 * @param [in] RgMacPdu *pdu
653 * @param [in] Bool *error
657 PRIVATE Void rgTOMInfFreePduEvnt
659 RgInfSfDatInd *sfInfo
662 PRIVATE Void rgTOMInfFreePduEvnt (sfInfo)
663 RgInfSfDatInd *sfInfo;
666 TRC2(rgTOMInfFreePduEvnt);
670 } /* end of rgTOMUtlFreePduEvnt */
674 /** @brief This function performs the preparation of information needed to set
675 * L2M Scheduled UL Throughput Information for a particular UE.
679 * Function: rgTomUtlPrepareL2MUlThrpInfo
680 * This function performs the preparation of information needed to set
681 * L2M Scheduled UL Throughput Information for a particular UE.
685 * @param [in] RgCellCb *cellCb
686 * @param [in] RgUeCb *ueCb
687 * @param [out] RgRguDedDatInd *dDatInd
691 PRIVATE S16 rgTomUtlPrepareL2MUlThrpInfo
695 RgRguDedDatInd *dDatInd
698 PRIVATE S16 rgTomUtlPrepareL2MUlThrpInfo(cellCb,ueCb,dDatInd)
701 RgRguDedDatInd *dDatInd;
707 TRC2(rgTomUtlPrepareL2MUlThrpInfo);
709 dDatInd->burstInd = RGU_L2M_UL_BURST_END;
710 for(loop=0;loop<dDatInd->numLch;loop++)
712 lcId=dDatInd->lchData[loop].lcId;
715 lcgId = ueCb->ul.lcCb[lcId - 1].lcgId;
716 if(ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs > 0)
718 dDatInd->burstInd = RGU_L2M_UL_BURST_START;
729 /** @brief This function is called by rgTOMDatInd. This function invokes the
730 * scheduler with the information of the received Data and any Control Elements
731 * if present. Also it generates Data indications towards the higher layers.
738 * - Retrieves the RaCb with the rnti provided, if it doesnt exist
740 * - If UE exists then update the Schduler with any MAC CEs if present.
741 * - Invoke RAM module to do Msg3 related processing rgRAMProcMsg3
742 * - Loop through the SDU subheaders and invoke either a common data
743 * indication (rgUIMSndCmnDatInd) or dedicated data indication
744 * (rgUIMSndDedDatInd) towards the higher layers.
746 * @param [in] RgCellCb *cellCb
747 * @param [in] RgUeCb *ueCb
748 * @param [in] CmLteRnti rnti
749 * @param [in] RgMacPdu *pdu
750 * @param [out] U32 *lcgBytes
761 PRIVATE S16 rgTOMUtlProcMsg
773 PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, isSpsRnti,spsToBeActvtd,sduSize, slot, lcgBytes)
783 #else /* LTEMAC_SPS */
785 PRIVATE S16 rgTOMUtlProcMsg
794 PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes)
803 Inst inst = cellCb->macInst - RG_INST_START;
805 RgRguCmnDatInd *cDatInd;
806 RgRguDedDatInd *dDatInd;
813 // RgInfSpsRelInfo relInfo;
820 U16 totalBytesRcvd = 0;
821 U16 sduLen[RGU_MAX_LC] = {0};
822 U8 qciVal[RGU_MAX_LC] = {0};
829 /* Moved outside of LTE_L2_MEAS
830 * scope as this pointer will now be used to
831 * check for valid Logical Channel ID
848 TRC2(rgTOMUtlProcMsg)
854 if(pdu->sduLst.first)
856 sdu = (RgMacSdu*)(pdu->sduLst.first->node);
858 if ((sdu->lcId == RG_CCCH_LCID))
860 /* code for common channel dat indications */
861 if ((ret = rgAllocShrablSBuf (inst,(Data**)&cDatInd, sizeof(RgRguCmnDatInd))) != ROK)
865 cDatInd->cellId = cellCb->cellId;
866 cDatInd->rnti = ueCb->ueId;
867 /* rg001.101: Corrected lcId value for common data indication */
868 cDatInd->lcId = cellCb->ulCcchId;
869 cDatInd->pdu = sdu->mBuf;
870 SFndLenMsg (sdu->mBuf, &ccchSz);
871 /* Fix : syed Contention resolution ID copy should consider only
872 * 6 bytes of information from sdu->mBuf. Incase of CCCH sdu for reest
873 * message/psuedo reest message, ccchSz can go beyond 6 and can corrupt
874 * other fields of ueCb. */
875 if (ccchSz >= RG_CRES_LEN)
877 SCpyMsgFix (sdu->mBuf, (MsgLen)0, RG_CRES_LEN, ueCb->contResId.resId,
880 #ifdef XEON_SPECIFIC_CHANGES
881 CM_LOG_DEBUG(CM_LOG_ID_MAC, "CCCH SDU of size(%d) received for UE(%d) CRES[0x%x 0x%x 0x%x 0x%x 0x%x 0x%x] Time[%d %d]\n", ((S16)ccchSz), ueCb->ueId,ueCb->contResId.resId[0], ueCb->contResId.resId[1], ueCb->contResId.resId[2], ueCb->contResId.resId[3], ueCb->contResId.resId[4], ueCb->contResId.resId[5], cellCb->crntTime.sfn, cellCb->crntTime.slot);
884 rgUIMSndCmnDatInd(inst,cellCb->rguUlSap,cDatInd);
886 } /* end of common channel processing */
888 if ((ret = rgAllocShrablSBuf (inst,(Data**)&dDatInd, sizeof(RgRguDedDatInd))) != ROK)
894 elem = SRngGetWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
899 dDatInd = (RgRguDedDatInd *)elem;
900 cmMemset((U8 *)dDatInd, 0x00, sizeof(RgRguDedDatInd));
902 dDatInd->cellId = cellCb->cellId;
903 dDatInd->rnti = ueCb->ueId;
907 ulSf = &cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)];
908 if(ulSf->ueUlAllocInfo != NULLP)
910 for(idx1 = 0; idx1 < ulSf->numUe; idx1++)
912 if(ulSf->ueUlAllocInfo[idx1].rnti == ueCb->ueId)
914 numPrb = ulSf->ueUlAllocInfo[idx1].numPrb;
920 node = pdu->sduLst.first;
923 sdu = (RgMacSdu*)node->node;
925 ulLcCb = rgDBMGetUlDedLcCb (ueCb, sdu->lcId);
929 RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId,"Unconfigured LCID:%d CRNTI:%d"
930 ,sdu->lcId,ueCb->ueId);
931 /* ccpu00128443: Fix for memory leak */
932 /* Fix : syed Neccessary to set sdu->mBuf = NULLP */
933 RG_FREE_MSG(sdu->mBuf);
937 #ifdef RLC_STA_PROC_IN_MAC/* RLC Status PDU Processing */
939 extern S16 rlcProcDlStatusPdu(Pst *udxPst,SuId suId,
940 CmLteCellId cellId,CmLteRnti rnti,CmLteLcId lcId,Buffer *rlcSdu);
942 if(ROK == rlcProcDlStatusPdu(&(cellCb->rguDlSap->sapCfg.sapPst),
943 cellCb->rguDlSap->sapCfg.suId,
944 cellCb->cellId,ueCb->ueId,sdu->lcId,sdu->mBuf))
946 RG_FREE_MSG(sdu->mBuf);
953 /* ccpu00116477- Fixed the rgUIMSndDedDatInd condition when we receive 11 sdus in the
954 * list we are losing 11th sdu and sending the first 10 sdus again which
955 * is causing the duplicate packets and eNB crashing due to access
956 * of the freed memory */
957 if (dDatInd->numLch >= RGU_MAX_LC)
959 if ((ret = rgUIMSndDedDatInd(inst,ueCb->rguUlSap,dDatInd)) != ROK)
961 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
962 "Failed to send datIndication to RGU CRNTI:%d",ueCb->ueId);
966 if ((ret = rgAllocShrablSBuf (inst,(Data**)&dDatInd, sizeof(RgRguDedDatInd))) != ROK)
971 elem = SRngGetWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
976 dDatInd = (RgRguDedDatInd *)elem;
977 cmMemset((U8 *)dDatInd, 0x00, sizeof(RgRguDedDatInd));
979 dDatInd->cellId = cellCb->cellId;
980 dDatInd->rnti = ueCb->ueId;
983 dDatInd->lchData[dDatInd->numLch].lcId = sdu->lcId;
984 dDatInd->lchData[dDatInd->numLch].pdu.mBuf[dDatInd->lchData[dDatInd->numLch].pdu.numPdu] = sdu->mBuf;
985 dDatInd->lchData[dDatInd->numLch].pdu.numPdu++;
986 lcgId = ulLcCb->lcgId;
987 SFndLenMsg(sdu->mBuf, &bufSz);
991 ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs -= bufSz;
994 //if ((lcgBytes != NULLP) && (ueCb->ul.lcgArr[lcgId].isGbr == TRUE))
995 if (lcgBytes != NULLP)
997 lcgBytes[lcgId] += bufSz;
1002 /* Check if data has come on SPS LC */
1003 /* KWORK_FIX: Modified the index from lcId to lcId-1 for handling lcId 10 properly */
1004 if (ueCb->ul.spsLcId[sdu->lcId-1] == TRUE)
1006 ueCb->ul.spsDatRcvd++;
1011 /* Data rcvd on CRNTI*/
1012 /* Retrieve the LCG ID of the LCID*/
1013 /* SPS LCG has data whose size > SID Size */
1014 /* Activate SPS if data recvd on SPS LCID and size > SID Packet Size */
1015 if((ueCb->ul.spsLcId[sdu->lcId-1] == TRUE) &&
1016 (sdu->len > RG_SPS_SID_PACKET_SIZE))
1018 *spsToBeActvtd = TRUE;
1019 *sduSize = sdu->len;
1026 if(cellCb->qciArray[ulLcCb->qci].mask == TRUE)
1028 sduLen[ulLcCb->qci] = sdu->len;
1029 totalBytesRcvd += sdu->len;
1030 qciVal[ulLcCb->qci] = ulLcCb->qci;
1034 } /* end of while for SubHeaders */
1036 for(idx2 = 0; idx2 < RGU_MAX_LC; idx2++)
1038 if((cellCb->qciArray[qciVal[idx2]].mask == TRUE) &&
1041 cellCb->qciArray[qciVal[idx2]].prbCount +=
1042 ((numPrb * sduLen[idx2]) / totalBytesRcvd);
1046 if(totalBytesRcvd > 0 && qciVal[idx2] > 0)
1048 RG_UPD_GBR_PRB(cellCb, qciVal[idx2], ((numPrb * sduLen[idx2])/totalBytesRcvd));
1053 /*Added for explicit release - start*/
1056 if(isSpsRnti && dDatInd && dDatInd->numLch)
1058 if(ueCb->ul.spsDatRcvd != 0)
1060 ueCb->ul.explRelCntr = 0;
1061 ueCb->ul.spsDatRcvd = 0;
1065 ueCb->ul.explRelCntr++;
1066 if (ueCb->ul.explRelCntr == ueCb->ul.explRelCnt)
1068 ueCb->ul.explRelCntr = 0;
1069 /* Indicate scheduler for explicit release */
1070 cmMemset((U8*)&schPst1, (U8)0, sizeof(Pst));
1071 rgGetPstToInst(&schPst1,inst, cellCb->schInstMap.schInst);
1072 //TODO: commented for compilation without SCH
1074 relInfo.cellSapId = cellCb->schInstMap.cellSapId;
1075 relInfo.cRnti = ueCb->ueId;
1076 relInfo.isExplRel = TRUE;
1077 /* Release indicator is called now through the matrix in the function below */
1078 //TODO: commented for compilation without SCH RgMacSchSpsRel( &schPst1, &relInfo );
1080 ueCb->ul.implRelCntr = 0;
1087 if(ueCb->ul.spsDatRcvd != 0)
1089 //ueCb->ul.implRelCntr = 0;
1090 ueCb->ul.explRelCntr = 0;
1091 ueCb->ul.spsDatRcvd = 0;
1095 /*Added for explicit release - end */
1097 if((dDatInd) && (dDatInd->numLch))
1100 rgTomUtlPrepareL2MUlThrpInfo(cellCb, ueCb,dDatInd);
1102 RG_CALC_TTI_CNT(cellCb, dDatInd->ttiCnt);
1104 if ((ret = rgUIMSndDedDatInd(inst,ueCb->rguUlSap,dDatInd)) != ROK)
1106 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
1107 "Failed to send datIndication to RGU CRNTI:%d",ueCb->ueId);
1112 else if((dDatInd) && (0 == dDatInd->numLch))
1114 /* Free the memory allocated for dDatInd if we
1115 * have no valid LCH PDU to send to RLC.*/
1116 rgFreeSharableSBuf(inst,(Data **)&dDatInd,sizeof(RgRguDedDatInd));
1122 /** @brief This function frees up the RgMacPdu structure that has been
1123 * populated by demux.
1127 * Function: rgTOMUtlInsSchInfo
1128 * - Function frees up the RgMacPdu structure, in case of error it shall
1129 * free up the buffer's present in the different sdu.
1132 * @param [in] RgMacPdu *pdu
1133 * @param [in] Bool *error
1138 PRIVATE S16 rgTOMUtlInsSchInfo
1141 RgInfSfDatInd *sfInfo,
1142 RgInfCeInfo *ceInfo,
1149 PRIVATE S16 rgTOMUtlInsSchInfo (pdu, sfInfo, ceInfo, rnti,spsToBeActvtd,sduSize, lcgBytes)
1151 RgInfSfDatInd *sfInfo;
1152 RgInfCeInfo *ceInfo;
1161 PRIVATE S16 rgTOMUtlInsSchInfo
1164 RgInfSfDatInd *sfInfo,
1165 RgInfCeInfo *ceInfo,
1170 PRIVATE S16 rgTOMUtlInsSchInfo (pdu, sfInfo, ceInfo, rnti, lcgBytes)
1172 RgInfSfDatInd *sfInfo;
1173 RgInfCeInfo *ceInfo;
1180 RgInfUeDatInd *ueInfo;
1184 TRC2(rgTOMUtlInsSchInfo);
1186 RG_TOM_INF_ALLOC(sfInfo, sizeof(RgInfUeDatInd), ueInfo, ret);
1193 ueInfo->rnti = rnti;
1195 ueInfo->ceInfo = *ceInfo;
1196 ueInfo->ueLstEnt.node = (PTR)ueInfo;
1197 for (lcgId = 1, idx = 0; lcgId < RGINF_MAX_LCG_PER_UE; lcgId++)
1199 if (lcgBytes[lcgId] != 0)
1201 /* Only GBR bytes */
1202 ueInfo->lcgInfo[idx].lcgId = lcgId;
1203 ueInfo->lcgInfo[idx++].bytesRcvd = lcgBytes[lcgId];
1204 lcgBytes[lcgId] = 0;
1207 cmLListAdd2Tail(&sfInfo->ueLst, &ueInfo->ueLstEnt);
1209 } /* end of rgTOMUtlInsSchInfo */
1213 * @brief Handler for processing data indication recieved from PHY for UEs.
1217 * Function: rgTOMDatInd
1219 * Handler for processing data indication recieved from PHY for UEs.
1221 * Invoked by: RgLiTfuDatInd of LIM
1224 * For each DataInfo recieved
1225 * - Validate the information received and retrieve cellCb
1226 * Validate cellId, rnti
1227 * - Call De-Mux module to decode the data rgDUXDemuxData
1228 * - If received a CRNTI control element
1229 * - Check if a CCCH SDU is present, if it is return failure
1230 * - Check for the existence of UE, if its isnt present return failure.
1231 * - Delegate the remaining processing to rgTOMUtlProcMsg3 which
1232 * primarily informs the scheduler about the data received and
1233 * generates Data indications towards the higher layer.
1234 * - If only CCCH SDU is present
1235 * - Invoke rgTOMUtlProcMsg3 for further processing.
1236 * - If its a non-Msg3 PDU i.e. received outside of a RA procedure
1237 * - Retrieve the UeCB
1238 * - Validate that the received PDU contains only configured Logical
1240 * - Invoke rgTOMUtlProcDatPdu for further processing. It informs the
1241 * scheduler with the information of the received Data and generates
1242 * DatIndications towards the higher layers.
1244 * @param [in] Inst inst
1245 * @param[in] TfuDatIndInfo *datInd
1254 TfuDatIndInfo *datInd
1257 S16 rgTOMDatInd(inst,datInd)
1259 TfuDatIndInfo *datInd;
1265 RgUeCb *prevUeCb = NULLP;
1268 RgInfSfDatInd *sfInfo;
1272 TfuDatInfo *datInfo;
1276 Bool isSpsRnti=FALSE;
1278 // RgInfSpsRelInfo relInfo;
1279 Bool spsToBeActvtd = FALSE;
1282 U32 lcgBytes[RGINF_MAX_LCG_PER_UE];
1286 #ifdef STUB_TTI_HANDLING_5GTF
1287 node = datInd->datIndLst.first;
1288 for (;node; node=node->next)
1290 datInfo = (TfuDatInfo*)node->node;
1293 SFndLenMsg(datInfo->mBuf, &len);
1294 rgUlrate_tfu += len;
1295 if (rgUlrate_tfu > 100000)
1297 printf("Sowmya:rgTOMDatInd datInfo->mBuf len =%d rgUlrate_tfu=%d",len,rgUlrate_tfu);
1305 cmMemset((U8 *)&lcgBytes, 0, sizeof(lcgBytes));
1307 tfuSap = &(rgCb[inst].tfuSap);
1309 cellCb = rgCb[inst].cell;
1310 if((cellCb == NULLP) ||
1311 (cellCb->cellId != datInd->cellId))
1314 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"Unable to get the cellCb for cell");
1317 /* Avoiding memset as all the fields are getting initialized further */
1319 if (rgTOMInfAllocPduEvnt (inst,&sfInfo) != ROK)
1321 err.errType = RGERR_TOM_DATIND;
1322 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"Unable to Allocate PDU for DUX cell");
1323 node = datInd->datIndLst.first;
1326 cmLListInit(&sfInfo->ueLst);
1327 sfInfo->cellId = datInd->cellId;
1328 sfInfo->timingInfo = datInd->timingInfo;
1329 slot = datInd->timingInfo.slot;
1331 node = datInd->datIndLst.first;
1332 for (;node; node=node->next)
1334 datInfo = (TfuDatInfo*)node->node;
1336 //extern U32 ulrate_tfu;
1338 SFndLenMsg(datInfo->mBuf, &len);
1339 #ifdef STUB_TTI_HANDLING_5GTF
1340 // printf("Sowmya:rgTOMDatInd datInfo->mBuf len =%d",len);
1342 rgUlrate_tfu += len;
1344 grgUlrate_tfu += len;
1347 #ifdef STUB_TTI_HANDLING_5GTF
1348 rgLIMUtlFreeDatIndEvnt(datInd,TRUE);
1350 /* We shall call De-Mux to process the received buffer. We shall try and find
1351 * out the RaCb based on the following -
1352 * 1. If the incoming PDU contained a CCCH SDU i.e. this is message 3.
1353 * 2. If the incoming PDU contained a CRNTI control element, i.e. we should
1354 * have a ueCb also for this
1356 /* Lets allocate the event that needs to be passed to DUX */
1357 if (rgTOMUtlAllocPduEvnt (inst,&pdu) != ROK)
1359 err.errType = RGERR_TOM_DATIND;
1360 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"Unable to Allocate PDU for DUX cell");
1361 rgTOMInfFreePduEvnt (sfInfo);
1365 if ((ret = rgDUXDemuxData (inst,pdu, &ceInfo,
1366 &datInfo->mBuf, &err)) != ROK)
1369 /* Fix: sriky memory corruption precautions */
1370 rgTOMUtlFreePduEvnt (pdu, TRUE);
1371 err.errType = RGERR_TOM_DATIND;
1372 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"DUX processing failed");
1373 tfuSap->sapSts.numPduDrop++;
1376 /* It could be that a non-msg3 pdu contains a CRNTI Control element. We
1377 * should check for CRNTI CE and if it exists the UECb must exist, also an
1378 * if the CRNTI in the CE and the one with which the message came in are
1379 * different we shall look for an raCb as well.
1382 if (ceInfo.bitMask & RG_CCCH_SDU_PRSNT)
1384 ret = rgTOMProcCCCHSduInDatInd(pdu, prevUeCb, \
1385 cellCb, datInfo, &ceInfo, slot);
1388 rgTOMUtlFreePduEvnt (pdu, TRUE);
1389 err.errType = RGERR_TOM_DATIND;
1390 tfuSap->sapSts.numPduDrop++;
1393 } /* end of Msg3 processing */
1395 else if (ceInfo.bitMask & RG_CRNTI_CE_PRSNT)
1397 ret = rgTOMProcCrntiCEInDatInd(pdu, prevUeCb, \
1398 cellCb, datInfo, &ceInfo, slot);
1401 rgTOMUtlFreePduEvnt (pdu, TRUE);
1402 err.errType = RGERR_TOM_DATIND;
1403 tfuSap->sapSts.numPduDrop++;
1407 } /* end of CRNTI based message */
1410 ueCb = rgDBMGetUeCb (cellCb, datInfo->rnti);
1414 /* Try getting the UE using SPS-RNTI. */
1415 ueCb = rgDBMGetSpsUeCb (cellCb, datInfo->rnti);
1419 /* Increment implrelCntr for an empty transmission */
1420 if (pdu->sduLst.count == 0)
1422 ueCb->ul.implRelCntr++;
1423 if (ueCb->ul.implRelCntr == ueCb->ul.implRelCnt)
1425 /* Indicate scheduler for implicit release */
1426 cmMemset((U8*)&schPst1, (U8)0, sizeof(Pst));
1427 rgGetPstToInst(&schPst1,inst, cellCb->schInstMap.schInst);
1429 ueCb->ul.implRelCntr = 0;
1430 ueCb->ul.explRelCntr = 0;
1432 relInfo.cellSapId = cellCb->schInstMap.cellSapId;
1433 relInfo.cRnti = ueCb->ueId;
1434 relInfo.isExplRel= FALSE;
1435 //TODO: commented for compilation without SCH RgMacSchSpsRel(&schPst1, &relInfo);
1441 /* Reset the implrelCntr */
1442 ueCb->ul.implRelCntr = 0;
1448 /* Perform failure if ueCb is still NULLP */
1449 rgTOMUtlFreePduEvnt (pdu, TRUE);
1450 err.errType = RGERR_TOM_DATIND;
1451 RLOG_ARG1(L_ERROR,DBG_CELLID,datInd->cellId,"RNTI:%d Unable to get the UE CB",
1453 tfuSap->sapSts.numPduDrop++;
1458 rgTOMUtlL2MStoreBufSz(ueCb, &ceInfo);
1459 rgTOML2MCompileActiveLCs (cellCb, ueCb, pdu, &ceInfo);
1462 if ((ret = rgTOMUtlProcMsg(cellCb, ueCb, pdu, isSpsRnti,&spsToBeActvtd,&sduSize, slot, (U32 *)&lcgBytes)) != ROK)
1464 if ((ret = rgTOMUtlProcMsg (cellCb, ueCb, pdu, slot, (U32 *)&lcgBytes)) != ROK)
1465 #endif /* LTEMAC_SPS */
1467 rgTOMUtlFreePduEvnt (pdu, TRUE);
1468 err.errType = RGERR_TOM_DATIND;
1469 RLOG_ARG1(L_ERROR,DBG_CELLID,datInd->cellId,
1470 "Unable to handle Data Indication CRNTI:%d",ueCb->ueId);
1471 tfuSap->sapSts.numPduDrop++;
1478 if(rgTOMUtlInsSchInfo(pdu, sfInfo, &ceInfo, datInfo->rnti,spsToBeActvtd,sduSize, (U32 *)&lcgBytes) != ROK)
1480 if(rgTOMUtlInsSchInfo(pdu, sfInfo, &ceInfo, datInfo->rnti, (U32 *)&lcgBytes) != ROK)
1484 rgTOMInfFreePduEvnt (sfInfo);
1485 rgTOMUtlFreePduEvnt (pdu, FALSE);
1488 /* free up the PDU memory */
1489 rgTOMUtlFreePduEvnt (pdu, FALSE);
1491 /* Free the allocated memory for ueUlAllocInfo here */
1493 if(cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)].ueUlAllocInfo != NULLP)
1495 /*ccpu00117052 - MOD - Passing double for proper NULLP
1497 rgFreeSBuf(inst,(Data **)&(cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)].ueUlAllocInfo),
1498 ((cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)].numUe) * sizeof(RgUeUlAlloc)));
1502 /* Update PRB used for all GBR QCIs to scheduler */
1503 cmMemcpy((U8*) &sfInfo->qcisUlPrbCnt[0],
1504 (U8*) &cellCb->qcisUlPrbCnt[0],
1505 (RGM_MAX_QCI_REPORTS * sizeof(U32)));
1506 /* clear the cellCb ul prb value */
1507 cmMemset((U8*)&cellCb->qcisUlPrbCnt[0], 0,
1508 (RGM_MAX_QCI_REPORTS * sizeof(U32)));
1512 rgGetPstToInst(&schPst, inst,cellCb->schInstMap.schInst);
1513 sfInfo->cellSapId = cellCb->schInstMap.cellSapId;
1514 //TODO: commented for compilation without SCH RgMacSchSfRecp(&schPst, sfInfo);
1519 * @brief Function handles allocation for common channels i.e. BCCH-BCH,
1520 * BCCH-DLSCH, PCCH-DLSCH.
1524 * Function : rgHndlCmnChnl
1526 * This function is invoked from RgSchMacSfAllocReq. This function handles
1527 * allocations made for common channels like BCCH and PCCH.
1530 * 1. If BCCH on BCH has been scheduled, send StatusIndication on RGU.
1531 * 2. If PCCH is scheduled, send StatusIndication on RGU.
1532 * 3. If BCCH on DLSCH has been scheduled and sndStatInd is TRUE, send
1533 * StatusIndication on RGU, else copy the bcch buffer onto the downlink
1537 * @param[in] RgCellCb *cell,
1538 * @param[in] CmLteTimingInfo timingInfo,
1539 * @param[in] RgInfCmnLcInfo *cmnLcInfo,
1540 * @param[in/out] RgErrInfo *err,
1546 PRIVATE S16 rgHndlCmnChnl
1549 CmLteTimingInfo timingInfo,
1550 RgInfCmnLcInfo *cmnLcInfo,
1554 PRIVATE S16 rgHndlCmnChnl(cell, timingInfo, cmnLcInfo, err)
1556 CmLteTimingInfo timingInfo;
1557 RgInfCmnLcInfo *cmnLcInfo;
1561 #if (ERRCLASS & ERRCLS_DEBUG)
1565 RgBcchDlschLcCb *bcch;
1566 #if (ERRCLASS & ERRCLS_DEBUG)
1569 #endif/*RGR_SI_SCH*/
1570 RguCStaIndInfo *staInd;
1572 Inst inst = cell->macInst - RG_INST_START;
1576 dlSf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
1578 if(cmnLcInfo->bitMask & RGINF_BCH_INFO)
1581 #if (ERRCLASS & ERRCLS_DEBUG)
1582 if(NULLP == (bch = rgDBMGetBcchOnBch(cell)))
1586 if(cmnLcInfo->bchInfo.lcId != bch->lcId)
1592 if (rgAllocShrablSBuf (inst,(Data**)&staInd, sizeof(RguCStaIndInfo)) != ROK)
1594 err->errCause = RGERR_TOM_MEM_EXHAUST;
1597 staInd->cellId = cell->cellId;
1598 staInd->rnti = RG_INVALID_RNTI;
1599 staInd->lcId = cmnLcInfo->bchInfo.lcId;
1600 staInd->transId = (timingInfo.sfn << 8) | (timingInfo.slot);
1601 /* ADD Changes for Downlink UE Timing Optimization */
1602 #ifdef LTEMAC_DLUE_TMGOPTMZ
1603 dlSf->remDatReqCnt++;
1605 if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK)
1610 /*Store the received BCH Data in the scheduled subframe*/
1611 dlSf->bch.tb = cmnLcInfo->bchInfo.pdu;
1612 #endif/*RGR_SI_SCH*/
1615 if(cmnLcInfo->bitMask & RGINF_PCCH_INFO)
1617 #if (ERRCLASS & ERRCLS_DEBUG)
1618 if(NULLP == (pcch = rgDBMGetPcch(cell)))
1622 if(cmnLcInfo->pcchInfo.lcId != pcch->lcId)
1628 dlSf->pcch.pdcch.rnti =
1629 cmnLcInfo->pcchInfo.rnti;
1630 dlSf->pcch.pdcch.dci =
1631 cmnLcInfo->pcchInfo.dciInfo;
1633 /* ccpu00132314-ADD-Fill the tx Pwr offset from scheduler */
1634 dlSf->pcch.txPwrOffset = cmnLcInfo->pcchInfo.txPwrOffset;
1636 if (rgAllocShrablSBuf (inst,(Data**)&staInd, sizeof(RguCStaIndInfo)) != ROK)
1638 err->errCause = RGERR_TOM_MEM_EXHAUST;
1641 staInd->cellId = cell->cellId;
1642 staInd->rnti = RG_INVALID_RNTI;
1643 staInd->lcId = cmnLcInfo->pcchInfo.lcId;
1644 staInd->transId = (timingInfo.sfn << 8) | (timingInfo.slot);
1645 /* ADD Changes for Downlink UE Timing Optimization */
1646 #ifdef LTEMAC_DLUE_TMGOPTMZ
1647 dlSf->remDatReqCnt++;
1649 /* for consolidated CmnStaInd calling below function from function
1650 * rgHndlSchedUe once CmnStaInd prepared for all UEs
1652 if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK)
1658 if(cmnLcInfo->bitMask & RGINF_BCCH_INFO)
1660 dlSf->bcch.pdcch.rnti =
1661 cmnLcInfo->bcchInfo.rnti;
1662 dlSf->bcch.pdcch.dci =
1663 cmnLcInfo->bcchInfo.dciInfo;
1665 /* ccpu00132314-ADD-Fill the tx Pwr offset from scheduler */
1666 dlSf->bcch.txPwrOffset = cmnLcInfo->bcchInfo.txPwrOffset;
1670 (bcch=rgDBMGetBcchOnDlsch(cell,cmnLcInfo->bcchInfo.lcId)))
1674 if(TRUE == cmnLcInfo->bcchInfo.sndStatInd)
1676 RG_FREE_MSG(bcch->tb);
1677 if (rgAllocShrablSBuf (inst,(Data**)&staInd,
1678 sizeof(RguCStaIndInfo)) != ROK)
1680 err->errCause = RGERR_TOM_MEM_EXHAUST;
1683 staInd->cellId = cell->cellId;
1684 staInd->rnti = RG_INVALID_RNTI;
1685 staInd->lcId = cmnLcInfo->bcchInfo.lcId;
1686 staInd->transId = (timingInfo.sfn << 8) | (timingInfo.slot);
1687 /* ADD Changes for Downlink UE Timing Optimization */
1688 #ifdef LTEMAC_DLUE_TMGOPTMZ
1689 dlSf->remDatReqCnt++;
1691 if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK)
1698 SCpyMsgMsg(bcch->tb, RG_GET_MEM_REGION(rgCb[inst]),
1699 RG_GET_MEM_POOL(rgCb[inst]), &dlSf->bcch.tb);
1702 /*Store the received BCCH Data in the scheduled subframe*/
1703 dlSf->bcch.tb = cmnLcInfo->bcchInfo.pdu;
1704 #endif/*RGR_SI_SCH*/
1708 } /* end of rgHndlCmnChnl */
1711 * @brief Function for handling allocations for dedicated channels for a
1716 * Function : rgHndlSchdUe
1718 * This function shall be invoked whenever scheduler is done with the
1719 * allocations of dedicated channels for a subframe. Invoked by the function
1720 * RgSchMacSfAllocReq.
1722 * Processing steps :
1723 * 1. Loops through the list of UE's scheduled looking for the corresponding
1725 * 2. Finds the corresponding HARQ process.
1726 * 3. Invokes the DHM function to issue StatusIndications on RGU.
1729 * @param[in] RgCellCb *cell,
1730 * @param[in] CmLteTimingInfo timingInfo,
1731 * @param[in] RgInfUeInfo *ueInfo
1732 * @param[in/out] RgErrInfo *err
1738 PRIVATE S16 rgHndlSchdUe
1741 CmLteTimingInfo timingInfo,
1742 RgInfUeInfo *ueInfo,
1746 PRIVATE S16 rgHndlSchdUe(cell, timingInfo, ueInfo, err) /* laa_ut_fix */
1748 CmLteTimingInfo timingInfo;
1749 RgInfUeInfo *ueInfo;
1756 if(NULLP == ueInfo->allocInfo)
1761 rgDHMSndConsolidatedStaInd(cell, ueInfo, timingInfo, err);
1764 } /* end of rgHndlSchdUe */
1768 * @brief Function for handling Uplink allocations for Ue for a
1773 * Function : rgHndlUlUeInfo
1775 * @param[in] RgCellCb *cell,
1776 * @param[in] CmLteTimingInfo timingInfo,
1777 * @param[in] RgInfUlUeInfo *ueInfo
1783 PRIVATE S16 rgHndlUlUeInfo
1786 CmLteTimingInfo timingInfo,
1787 RgInfUlUeInfo *ueInfo
1790 PRIVATE S16 rgHndlUlUeInfo(cell, timingInfo, ueInfo)
1792 CmLteTimingInfo timingInfo;
1793 RgInfUlUeInfo *ueInfo;
1796 Inst inst = cell->macInst - RG_INST_START;
1801 TRC2(rgHndlUlUeInfo)
1803 ulSf = &cell->ulSf[(timingInfo.slot % RGSCH_NUM_SUB_FRAMES)];
1805 /* rg003.301-MOD- Corrected the purifier memory leak */
1806 if (ulSf->numUe != ueInfo->numUes)
1808 if (ulSf->ueUlAllocInfo)
1810 rgFreeSBuf(inst,(Data **)&(ulSf->ueUlAllocInfo),
1811 ulSf->numUe * sizeof(RgUeUlAlloc));
1814 #ifdef XEON_SPECIFIC_CHANGES
1815 CM_MEAS_TIME((cell->crntTime.slot % RGSCH_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MEAS_FREE);
1816 CM_ADD_INFO((cell->crntTime.slot % RGSCH_NUM_SUB_FRAMES), CM_DBG_MEAS_FREE, ulSf->numUe);
1818 ulSf->numUe = ueInfo->numUes;
1819 if((ulSf->ueUlAllocInfo == NULLP) && (ueInfo->numUes > 0))
1821 /* Allocate memory for ulAllocInfo */
1822 if((ret = rgAllocSBuf(inst,(Data**)&(cell->ulSf[(timingInfo.slot % RGSCH_NUM_SUB_FRAMES)].
1823 ueUlAllocInfo), ueInfo->numUes * sizeof(RgUeUlAlloc))) != ROK)
1828 #ifdef XEON_SPECIFIC_CHANGES
1829 CM_MEAS_TIME((cell->crntTime.slot % RGSCH_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MEAS_ALLOC);
1830 CM_ADD_INFO((cell->crntTime.slot % RGSCH_NUM_SUB_FRAMES), CM_DBG_MEAS_ALLOC, ueInfo->numUes);
1832 if (ulSf->ueUlAllocInfo != NULLP)
1834 for(idx = 0; idx < ueInfo->numUes; idx++)
1836 ulSf->ueUlAllocInfo[idx].rnti = ueInfo->ulAllocInfo[idx].rnti;
1837 ulSf->ueUlAllocInfo[idx].numPrb = ueInfo->ulAllocInfo[idx].numPrb;
1840 RGCPYTIMEINFO(timingInfo, ulSf->schdTime);
1842 } /* end of rgHndlUlUeInfo */
1845 * @brief Function for handling RaResp request received from scheduler to MAC
1849 * Function : rgTOMRlsSf
1851 * This function shall be invoked whenever scheduler is done with the
1852 * allocations of random access responses for a subframe.
1853 * This shall invoke RAM to create ueCbs for all the rapIds allocated and
1854 * shall invoke MUX to create RAR PDUs for raRntis allocated.
1857 * @param[in] Inst inst
1858 * @param[in] CmLteCellId cellId,
1859 * @param[in] CmLteTimingInfo timingInfo,
1860 * @param[in] RaRespInfo *rarInfo
1871 Void rgTOMRlsSf(dlSf)
1880 if(dlSf->txDone == FALSE)
1882 RLOG0(L_ERROR, "SUBFRAME Not pushed to the PHY");
1884 if (dlSf->bch.tb != NULLP)
1886 RG_FREE_MSG(dlSf->bch.tb);
1888 if (dlSf->bcch.tb != NULLP)
1890 RG_FREE_MSG(dlSf->bcch.tb);
1892 if (dlSf->pcch.tb != NULLP)
1894 RG_FREE_MSG(dlSf->pcch.tb);
1897 rgTOMEmtcRlsSf(dlSf);
1899 for(idx=0; idx < dlSf->numRaRsp; idx++)
1901 RG_FREE_MSG(dlSf->raRsp[idx].rar);
1904 /* ADD Changes for Downlink UE Timing Optimization */
1905 #ifdef LTEMAC_DLUE_TMGOPTMZ
1906 dlSf->remDatReqCnt = 0;
1907 /* Fix[ccpu00126310]: Tracks Data Requests from RLC for both loosely and tight coupled
1909 dlSf->statIndDone = FALSE;
1911 if (dlSf->tbs.count)
1916 RGDBGERRNEW(inst, (rgPBuf(inst),
1917 "Error Stale TBs in Subframes TBS list\n"));
1918 node = dlSf->tbs.first;
1921 hqP = (RgDlHqProcCb*)node->node;
1925 for(i=0;i< RG_MAX_TB_PER_UE;i++)
1927 if (hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf)
1929 cmLListDelFrm(&dlSf->tbs, &(hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk));
1930 hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node = NULLP;
1931 printf("\n rgTOMRlsSf:: hqP %p \n", (Void *)hqP);
1933 hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf = NULLP;
1938 /*arjun: check if dlSf laaTb list has to be freed???*/
1939 cmLListInit(&dlSf->tbs);
1940 dlSf->txDone = FALSE;
1946 * @brief Function is called by the scheduler once it has completed the
1947 * allocation for the subframe.
1951 * Function : rgHndlFlowCntrl
1952 * This function should fill and send Flow control
1956 * @param[in] Pst *cell
1957 * @param[in] RgInfSfAlloc *sfInfo Carries all the allocation
1966 RgInfSfAlloc *sfInfo
1969 S16 rgHndlFlowCntrl(cell, sfInfo)
1971 RgInfSfAlloc *sfInfo;
1974 RguFlowCntrlInd *flowCntrlInd;
1978 TRC3(rgHndlFlowCntrl);
1980 pst = &cell->rguDlSap->sapCfg.sapPst;
1981 /* flowCntrlInd is alloced in cell init time and will be re-used throughout */
1982 flowCntrlInd = cell->flowCntrlInd;
1983 flowCntrlInd->cellId = sfInfo->cellId;
1984 flowCntrlInd->numUes = sfInfo->flowCntrlInfo.numUes;
1986 for (ueIdx = 0; ueIdx < sfInfo->flowCntrlInfo.numUes; ueIdx++)
1988 flowCntrlInd->ueFlowCntrlInfo[ueIdx].ueId = sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].ueId;
1989 flowCntrlInd->ueFlowCntrlInfo[ueIdx].numLcs = sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].numLcs;
1991 for (lcIdx = 0; lcIdx < RGINF_MAX_NUM_DED_LC; lcIdx++)
1993 flowCntrlInd->ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].lcId =
1994 sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].lcId;
1995 flowCntrlInd->ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].pktAdmitCnt =
1996 sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].pktAdmitCnt;
1998 flowCntrlInd->ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].maxBo4FlowCtrl =
1999 sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].maxBo4FlowCtrl;
2002 RgUiRguFlowCntrlInd(pst, cell->rguDlSap->sapCfg.spId,flowCntrlInd); /* TODO: Rishi confirm if the suId and pst pointer is correct */
2006 * @brief Function is called by the scheduler once it has completed the
2007 * allocation for the subframe.
2011 * Function : RgSchMacSfAllocReq
2013 * This function shall be invoked whenever scheduler is done with the
2014 * allocations of for a subframe. The sfInfo carries all the allocation
2015 * details for the common channels, RA responses and dedicated channel
2018 * Processing steps :
2019 * 1. Reset the information present in the downlink subframe that is
2021 * 2. Handle common channel allocations
2022 * 3. Handle RA Response allocations
2023 * 4. Handle dedicated channel allocations.
2025 * @param[in] Pst *pst
2026 * @param[in] RgInfSfAlloc *sfInfo Carries all the allocation
2032 S16 RgSchMacSfAllocReq
2035 RgInfSfAlloc *sfInfo
2038 S16 RgSchMacSfAllocReq(pst, sfInfo)
2040 RgInfSfAlloc *sfInfo;
2046 VOLATILE U32 startTime=0;
2049 TRC2(RgSchMacSfAllocReq)
2051 RG_IS_INST_VALID(pst->dstInst);
2052 inst = pst->dstInst - RG_INST_START;
2054 SStartTask(&startTime, PID_MAC_SF_ALLOC_REQ);
2061 if((cell = rgCb[inst].cell) == NULLP)
2063 RLOG_ARG0(L_ERROR,DBG_CELLID,sfInfo->cellId, "No cellCb found with cell");
2067 dlSf = &cell->subFrms[(sfInfo->timingInfo.slot % RG_NUM_SUB_FRAMES)];
2069 rgTOMRlsSf(inst,dlSf);
2070 dlSf->schdTime = sfInfo->timingInfo;
2073 rgLaaInitTbInfoLst(cell);
2076 /* Fix : syed Ignore Failure Returns and continue processing.
2077 * Incomplete processing results in state sync loss between MAC-SCH. */
2079 if(TRUE == cell->emtcEnable)
2081 rgEmtcHndl(cell, sfInfo);
2084 rgHndlCmnChnl(cell, sfInfo->timingInfo, &sfInfo->cmnLcInfo, &err);
2086 rgHndlRaResp(cell, sfInfo->timingInfo, &sfInfo->rarInfo, &err);
2089 #ifdef XEON_SPECIFIC_CHANGES
2090 CM_MEAS_TIME((cell->crntTime.slot % RG_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MAC_B4_UE_SCHD);
2092 rgHndlSchdUe(cell, sfInfo->timingInfo, &sfInfo->ueInfo, &err);
2093 #ifdef XEON_SPECIFIC_CHANGES
2094 CM_MEAS_TIME((cell->crntTime.slot % RG_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MAC_UE_SCHD);
2096 rgLaaChkAndReqTbs(dlSf,cell, inst);
2099 rgHndlSchdUe(cell, sfInfo->timingInfo, &sfInfo->ueInfo, &err);
2103 if(rgHndlUlUeInfo(cell, sfInfo->ulUeInfo.timingInfo,
2104 &sfInfo->ulUeInfo) != ROK)
2109 #ifdef XEON_SPECIFIC_CHANGES
2110 CM_MEAS_TIME((cell->crntTime.slot % RG_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MAC_MEAS);
2112 /* Fix[ccpu00126310]: Tracks Data Requests from RLC for both loosely and tight coupled
2116 /* Added the handling for pushing down
2117 * TFU Data request in the retransmission only scenario.*/
2118 #ifdef LTEMAC_DLUE_TMGOPTMZ
2119 dlSf->statIndDone = TRUE;
2120 /* Fix [ccpu00126310]: Tracks Data Requests from RLC for both loosely and tight coupled
2122 if(!(dlSf->txDone) &&
2124 (TRUE == rgLaaChkAllRxTbs(dlSf)) &&
2126 (0 == dlSf->remDatReqCnt) && (dlSf->statIndDone) &&
2127 (RG_TIMEINFO_SAME(cell->crntTime, dlSf->schdTime)))
2129 /*This is the case of rettransmission, so no need
2130 * to wait for TTI Ind to push TFU Data Request. Send
2132 if (ROK != rgTOMUtlProcDlSf (dlSf, cell, &err))
2134 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to process downlink subframe for cell");
2135 err.errType = RGERR_ROM_DEDDATREQ;
2137 /* Mark this frame as sent */
2138 dlSf->txDone = TRUE;
2141 if (sfInfo->flowCntrlInfo.numUes > 0)
2143 rgHndlFlowCntrl(cell,sfInfo);
2146 SStopTask(startTime, PID_MAC_SF_ALLOC_REQ);
2148 } /* end of RgSchMacSfAllocReq */
2150 * @brief Handler for processing data indication recieved from PHY for UEs.
2154 * Function: rgTOMProcCrntiCEInDatInd
2156 * Handler for processing data indication recieved from PHY for UEs.
2158 * Invoked by: RgLiTfuDatInd of LIM
2161 * For each DataInfo recieved
2162 * - If received a CRNTI control element
2163 * - Check if a CCCH SDU is present, if it is return failure
2164 * - Check for the existence of UE, if its isnt present return failure.
2165 * - Delegate the remaining processing to rgTOMUtlProcMsg3 which
2166 * primarily informs the scheduler about the data received and
2167 * generates Data indications towards the higher layer.
2169 * @param RgMacPdu *pdu,
2170 * @param RgUeCb *prevUeCb,
2171 * @param RgCellCb *cellCb,
2172 * @param TfuDatInfo *datInfo,
2173 * @param RgInfCeInfo *ceInfo
2179 PRIVATE S16 rgTOMProcCrntiCEInDatInd
2184 TfuDatInfo *datInfo,
2185 RgInfCeInfo *ceInfo,
2189 PRIVATE S16 rgTOMProcCrntiCEInDatInd( pdu, prevUeCb, cellCb, datInfo, ceInfo, slot)
2193 TfuDatInfo *datInfo;
2194 RgInfCeInfo *ceInfo;
2198 RgUeCb *ueCb = NULLP;
2199 Inst inst = cellCb->macInst - RG_INST_START;
2207 TRC2(rgTOMProcCrntiCEInDatInd)
2213 ueCb = rgDBMGetUeCbFromRachLst (cellCb, datInfo->rnti);
2217 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
2218 "RNTI:%d Received MSG3 with CRNTI,unable to find ueCb", ceInfo->ces.cRnti);
2222 prevUeCb = rgDBMGetUeCb (cellCb, ceInfo->ces.cRnti);
2223 if (prevUeCb == NULLP)
2225 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
2226 "RNTI:%d Received MSG3 with CRNTI,unable to find ueCb", ceInfo->ces.cRnti);
2229 RLOG_ARG2(L_DEBUG,DBG_CELLID,cellCb->cellId,
2230 "CRNTI CE(%d) received through tmpCrnti(%d)",
2231 ceInfo->ces.cRnti, datInfo->rnti);
2232 rgDBMDelUeCbFromRachLst(cellCb, ueCb);
2233 rgRAMFreeUeCb(inst,ueCb);
2236 if ((rgTOMUtlProcMsg(cellCb, ueCb, pdu, FALSE,&spsToBeActvtd,&sduSize, slot, NULLP)) != ROK)
2238 if ((rgTOMUtlProcMsg (cellCb, ueCb, pdu, slot, NULLP)) != ROK)
2239 #endif /* LTEMAC_SPS */
2241 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
2242 "RNTI:%d Processing for MSG3 failed",datInfo->rnti);
2248 * @brief Handler for processing data indication recieved from PHY for UEs.
2252 * Function: rgTOMProcCCCHSduInDatInd
2254 * Handler for processing data indication recieved from PHY for UEs.
2256 * Invoked by: RgLiTfuDatInd of LIM
2259 * For each DataInfo recieved
2260 * - If only CCCH SDU is present
2261 * - Invoke rgTOMUtlProcMsg3 for further processing.
2262 * - If its a non-Msg3 PDU i.e. received outside of a RA procedure
2263 * - Retrieve the UeCB
2264 * - Validate that the received PDU contains only configured Logical
2266 * - Invoke rgTOMUtlProcDatPdu for further processing. It informs the
2267 * scheduler with the information of the received Data and generates
2268 * DatIndications towards the higher layers.
2270 * @param TfuDatIndInfo *datInd
2271 * @param RgMacPdu *pdu,
2272 * @param RgUeCb *prevUeCb,
2273 * @param RgCellCb *cellCb,
2274 * @param TfuDatInfo *datInfo,
2275 * @param RgInfCeInfo *ceInfo
2281 PRIVATE S16 rgTOMProcCCCHSduInDatInd
2286 TfuDatInfo *datInfo,
2287 RgInfCeInfo *ceInfo,
2291 PRIVATE S16 rgTOMProcCCCHSduInDatInd( pdu, prevUeCb, cellCb, datInfo, ceInfo, slot)
2295 TfuDatInfo *datInfo;
2296 RgInfCeInfo *ceInfo;
2300 RgUeCb *ueCb = NULLP;
2301 Inst inst = cellCb->macInst - RG_INST_START;
2309 TRC2(rgTOMProcCCCHSduInDatInd)
2315 if (ceInfo->bitMask & RG_CRNTI_CE_PRSNT)
2317 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
2318 "CRNTI:%d Received MSG3 with CCCH",ceInfo->ces.cRnti);
2322 ueCb = rgDBMGetUeCbFromRachLst (cellCb, datInfo->rnti);
2326 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
2327 "RNTI:%d Processing for MSG3 failed", datInfo->rnti);
2330 /* Fix: syed Drop any duplicate Msg3(CCCH Sdu) */
2331 if (ueCb->dl.hqEnt.numHqProcs)
2333 /* HqE is already initialized by a previuos Msg3 */
2334 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"RNTI:%d Processing for MSG3 failed. Duplicate "
2335 "MSG3 received. Dropping", datInfo->rnti);
2339 if(rgDHMHqEntInit(inst,&ueCb->dl.hqEnt,
2340 cellCb->maxDlHqProcPerUe) != ROK)
2342 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"RNTI:%d Harq Initialization failed ",
2346 RLOG_ARG1(L_DEBUG,DBG_CELLID,cellCb->cellId,
2347 "CCCH SDU received through tmpCrnti(%d)",datInfo->rnti);
2349 if ((rgTOMUtlProcMsg(cellCb, ueCb, pdu, FALSE,&spsToBeActvtd,&sduSize, slot, NULLP)) != ROK)
2351 if ((rgTOMUtlProcMsg (cellCb, ueCb, pdu, slot, NULLP)) != ROK)
2352 #endif /* LTEMAC_SPS */
2354 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"RNTI:%d Processing for MSG3 failed",
2363 /** @brief This function captures the BSR value from Control Element
2364 * Info structure and updates the effective Buffer size into the
2365 * corresponding LCG ID.
2369 * Function: rgTOMUtlL2MStoreBufSz
2372 * - update/append the Data structure based on BSR type
2374 * @param [in] RgUeCb *ueCb
2375 * @param [in] RgInfCeInfo *ceInfo
2380 PRIVATE S16 rgTOMUtlL2MStoreBufSz
2386 PRIVATE S16 rgTOMUtlL2MStoreBufSz (ueCb, ceInfo)
2388 RgInfCeInfo *ceInfo;
2393 TRC2(rgTOMUtlL2MStoreBufSz);
2395 if(ceInfo->bitMask & RG_TRUNC_BSR_CE_PRSNT)
2397 lcgId = ((ceInfo->ces.bsr.truncBsr >> 6) & 0x03);
2398 bsr = ceInfo->ces.bsr.truncBsr & 0x3F;
2399 ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs = rgLwrBsrTbl[bsr];
2401 else if(ceInfo->bitMask & RG_SHORT_BSR_CE_PRSNT)
2403 lcgId = ((ceInfo->ces.bsr.shortBsr >> 6) & 0x03);
2404 bsr = ceInfo->ces.bsr.shortBsr & 0x3F;
2405 ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs = rgLwrBsrTbl[bsr];
2408 else if(ceInfo->bitMask & RG_LONG_BSR_CE_PRSNT)
2410 ueCb->ul.lcgArr[0].lcgBsInfo.outStndngBs = rgLwrBsrTbl[ceInfo->ces.bsr.longBsr.bs1];
2411 ueCb->ul.lcgArr[1].lcgBsInfo.outStndngBs = rgLwrBsrTbl[ceInfo->ces.bsr.longBsr.bs2];
2412 ueCb->ul.lcgArr[2].lcgBsInfo.outStndngBs = rgLwrBsrTbl[ceInfo->ces.bsr.longBsr.bs3];
2413 ueCb->ul.lcgArr[3].lcgBsInfo.outStndngBs = rgLwrBsrTbl[ceInfo->ces.bsr.longBsr.bs4];
2416 } /* end of rgTOMUtlL2MStoreBufSz*/
2418 /** @brief : Compiles list of LCs received in UL data for DTCH RBs
2422 * @param [in] RgCellCb *cellCb
2423 * @param [in] RgUeCb *ueCb
2424 * @param [in] CmLteRnti rnti
2425 * @param [in] RgMacPdu *pdu
2432 PRIVATE Void rgTOML2MCompileActiveLCs
2440 PRIVATE Void rgTOML2MCompileActiveLCs(cellCb, ueCb, pdu, ceInfo)
2444 RgInfCeInfo *ceInfo;
2451 TRC2(rgTOML2MCompileActiveLCs)
2453 node = pdu->sduLst.first;
2456 sdu = (RgMacSdu*)node->node;
2458 if ((ulLcCb = rgDBMGetUlDedLcCb(ueCb, sdu->lcId)), ulLcCb != NULLP)
2460 if (ulLcCb->lcgId != 0)
2462 ceInfo->bitMask |= RG_ACTIVE_LC_PRSNT;
2463 ceInfo->ulActLCs[ulLcCb->lcId - 1] = TRUE;
2474 /**********************************************************************
2477 **********************************************************************/