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 static S16 rgTOMUtlProcDlSf ARGS(( RgDlSf *dlSf, RgCellCb *cellCb,
69 S16 rgTOMUtlProcDlSf ARGS((RgDlSf *dlSf, RgCellCb *cellCb,
72 static S16 rgTOMProcCrntiCEInDatInd ARGS((
81 static S16 rgTOMProcCCCHSduInDatInd ARGS((
96 S16 RgUiRguFlowCntrlInd(Pst* pst, SuId suId, RguFlowCntrlInd *flowCntrlInd);
98 S16 rgEmtcHndl(RgCellCb *cell,RgInfSfAlloc *sfInfo);
99 S16 rgTOMEmtcUtlFillDatReqPdus(TfuDatReqInfo *datInfo, RgDlSf *dlSf, RgCellCb *cell, RgErrInfo *err);
100 Void rgTOMEmtcRlsSf(RgDlSf *dlSf);
103 static Void rgTOML2MCompileActiveLCs ARGS
110 static S16 rgTOMUtlL2MStoreBufSz ARGS
116 static 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 static uint32_t 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 static uint32_t 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 */
159 uint32_t rgUlrate_tfu;
161 uint32_t 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 static S16 rgTOMUtlFillDatReqPdus
187 TfuDatReqInfo *datInfo,
193 static 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;
208 /* first lets send the BCCH data down to PHY */
209 if (dlSf->bcch.tb != NULLP)
211 if ((ret = rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo),
212 &(datInfo->memCp))) != ROK)
214 err->errCause = RGERR_TOM_MEM_EXHAUST;
215 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Memory Exhaustion ");
218 #ifdef TFU_ALLOC_EVENT_NO_INIT
222 datReq->tbInfo[0].lchInfo[0].mBuf[0]=NULLP;
225 datReq->rnti = RG_SI_RNTI;
226 datReq->dciInfo = dlSf->bcch.pdcch.dci;
227 /* Note: SCpyMsgMsg is not done since free of unsent buffer
228 * has been taken care through cell delete by invoking rgTomRlsSf
230 datReq->nmbOfTBs = 1;
232 datReq->mBuf[0] = dlSf->bcch.tb;
234 SFndLenMsg((Buffer *)dlSf->bcch.tb, &(datReq->tbInfo[0].tbSize));
235 datReq->tbInfo[0].tbPres = TRUE;
236 datReq->tbInfo[0].lchInfo[0].mBuf[0] = dlSf->bcch.tb;
237 datReq->tbInfo[0].numLch = 1;
238 datReq->tbInfo[0].lchInfo[0].numPdu = 1;
240 #ifdef TFU_ALLOC_EVENT_NO_INIT
241 datReq->tbInfo[1].tbPres = FALSE;
242 datReq->tbInfo[1].lchInfo[0].mBuf[0] = NULLP;
245 cmLListAdd2Tail(&datInfo->pdus, &(datReq->lnk));
246 datReq->lnk.node = (PTR)datReq;
248 /* ccpu00132314-ADD- Adding txPower offset for the PDSCH transmission */
249 datReq->txPwrOffset = dlSf->bcch.txPwrOffset;
251 /* Setting the pointer to NULL post transmission */
252 dlSf->bcch.tb = NULLP;
255 if (dlSf->pcch.tb != NULLP)
257 if ((ret = rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo),
258 &(datInfo->memCp))) != ROK)
260 err->errCause = RGERR_TOM_MEM_EXHAUST;
261 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Memory Exhaustion CRNTI:%d",datReq->rnti);
264 #ifdef TFU_ALLOC_EVENT_NO_INIT
269 datReq->rnti = RG_P_RNTI;
270 datReq->dciInfo = dlSf->pcch.pdcch.dci;
271 datReq->nmbOfTBs = 1;
273 datReq->mBuf[0] = dlSf->pcch.tb;
275 SFndLenMsg((Buffer *)dlSf->pcch.tb, &datReq->tbInfo[0].tbSize);
276 datReq->tbInfo[0].tbPres = TRUE;
277 datReq->tbInfo[0].lchInfo[0].mBuf[0] = dlSf->pcch.tb;
278 #ifdef TFU_ALLOC_EVENT_NO_INIT
279 datReq->tbInfo[1].tbPres = FALSE;
280 datReq->tbInfo[1].lchInfo[0].mBuf[0] = NULLP;
282 datReq->tbInfo[0].numLch = 1;
283 datReq->tbInfo[0].lchInfo[0].numPdu = 1;
285 cmLListAdd2Tail(&datInfo->pdus, &(datReq->lnk));
286 datReq->lnk.node = (PTR)datReq;
288 /* ccpu00132314-ADD- Adding txPower offset for the PDSCH transmission */
289 datReq->txPwrOffset = dlSf->pcch.txPwrOffset;
291 dlSf->pcch.tb = NULLP;
294 for(idx=0; idx < dlSf->numRaRsp; idx++)
296 if ((ret = rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo),
297 &(datInfo->memCp))) != ROK)
299 err->errCause = RGERR_TOM_MEM_EXHAUST;
300 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Memory Exhaustion CRNTI:%d",
304 #ifdef TFU_ALLOC_EVENT_NO_INIT
309 datReq->rnti = dlSf->raRsp[idx].pdcch.rnti;
310 datReq->dciInfo = dlSf->raRsp[idx].pdcch.dci;
311 datReq->nmbOfTBs = 1;
313 datReq->mBuf[0] = dlSf->raRsp[idx].rar;
315 SFndLenMsg((Buffer *)dlSf->raRsp[idx].rar, &datReq->tbInfo[0].tbSize);
316 datReq->tbInfo[0].tbPres = TRUE;
317 datReq->tbInfo[0].lchInfo[0].mBuf[0] = dlSf->raRsp[idx].rar;
318 #ifdef TFU_ALLOC_EVENT_NO_INIT
319 datReq->tbInfo[1].lchInfo[0].mBuf[0] = NULLP;
320 datReq->tbInfo[1].tbPres = FALSE;
322 datReq->tbInfo[0].numLch = 1;
323 datReq->tbInfo[0].lchInfo[0].numPdu = 1;
324 // prc_trace_format_string(0x40,3,"UE Id=(%d) tbSz=(%d)",datReq->rnti, datReq->tbInfo[0].tbSize);
326 cmLListAdd2Tail(&datInfo->pdus, &(datReq->lnk));
327 datReq->lnk.node = (PTR)datReq;
329 /* ccpu00132314-ADD- Adding txPower offset for the PDSCH transmission */
330 datReq->txPwrOffset = dlSf->raRsp[idx].txPwrOffset;
332 dlSf->raRsp[idx].rar = NULLP;
335 /* Fill Dedicated UE data */
336 if (dlSf->tbs.count != 0)
339 while (dlSf->tbs.first)
341 node = dlSf->tbs.first;
342 hqCb = (RgDlHqProcCb*)node->node;
343 if ((ret = rgDHMSndDatReq (cellCb, dlSf, datInfo, hqCb, err)) != ROK)
345 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,
346 "DHM unable to fill DATA request");
347 err->errType = RGERR_TOM_TTIIND;
354 } /* end of rgTOMUtlFillDatReqPdus*/
356 /** @brief This function does all the processing related to a single downlink
361 * Function: rgTOMUtlProcDlSf
364 * - collate control data for all UEs and send to PHY
365 * - collate data buffers for all UEs and send to PHY
367 * @param [in] RgDlSf *dlSf
368 * @param [in] RgCellCb *cellCb
369 * @param [out] RgErrInfo *err
372 /* ADD Changes for Downlink UE Timing Optimization */
373 #ifndef LTEMAC_DLUE_TMGOPTMZ
375 static S16 rgTOMUtlProcDlSf
382 static S16 rgTOMUtlProcDlSf (dlSf, cellCb, err)
396 S16 rgTOMUtlProcDlSf (dlSf, cellCb, err)
404 TfuDatReqInfo *datInfo;
405 Inst inst = cellCb->macInst - RG_INST_START;
408 /* Fill Data Request Info from scheduler to PHY */
409 if ((ret = rgAllocEventMem(inst,(Ptr *)&datInfo,
410 sizeof(TfuDatReqInfo))) != ROK)
412 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to Allocate TfuDatReqInfo");
417 cmLListInit(&datInfo->pdus);
419 RGADDTOCRNTTIME(dlSf->schdTime, datInfo->timingInfo, TFU_DELTA);
421 RGADDTOCRNTTIME(dlSf->schdTime, datInfo->timingInfo, TFU_DLDATA_DLDELTA);
423 datInfo->cellId = cellCb->cellId;
424 if((0 == (datInfo->timingInfo.sfn % 30)) && (0 == datInfo->timingInfo.slot))
426 //printf("5GTF_CHECK rgTOMUtlProcDlSf dat (%d : %d)\n", datInfo->timingInfo.sfn, datInfo->timingInfo.slot);
428 #ifdef TFU_ALLOC_EVENT_NO_INIT
429 datInfo->bchDat.pres = 0;
433 if (dlSf->bch.tb != NULLP)
435 datInfo->bchDat.pres = PRSNT_NODEF;
436 datInfo->bchDat.val = dlSf->bch.tb;
437 dlSf->bch.tb = NULLP;
440 /* Fill the DLSCH PDUs of BCCH, PCCH and Dedicated Channels */
441 if ((ret = rgTOMEmtcUtlFillDatReqPdus(datInfo, dlSf, cellCb, err)) != ROK)
443 RG_FREE_MEM(datInfo);
447 /* Fill the DLSCH PDUs of BCCH, PCCH and Dedicated Channels */
448 if ((ret = rgTOMUtlFillDatReqPdus(datInfo, dlSf, cellCb, err)) != ROK)
450 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to send data for cell");
451 RG_FREE_MEM(datInfo);
454 if((datInfo->pdus.count) || (datInfo->bchDat.pres == TRUE))
456 /* sending the data to Phy */
457 if (rgLIMTfuDatReq(inst,datInfo) != ROK)
459 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to send data info for cell");
464 /* Nothing to send: free the allocated datInfo */
465 RG_FREE_MEM(datInfo);
473 /** @brief This function allocates the RgMacPdu that will be populated by DEMUX
474 * with the SubHeaders list and the values of the Control elements.
478 * Function: rgTOMUtlAllocPduEvnt
481 * @param[in] Inst inst
482 * @param [out] RgMacPdu **pdu
489 static S16 rgTOMUtlAllocPduEvnt
495 static S16 rgTOMUtlAllocPduEvnt (inst,pdu)
502 RgUstaDgn dgn; /* Alarm diagnostics structure */
503 volatile uint32_t startTime=0;
506 evntMem.region = rgCb[inst].rgInit.region;
507 evntMem.pool = rgCb[inst].rgInit.pool;
510 SStartTask(&startTime, PID_TOMUTL_CMALLCEVT);
512 #ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */
513 MS_BUF_ADD_ALLOC_CALLER();
516 if (cmAllocEvnt (sizeof (RgMacPdu), RG_BLKSZ, &evntMem, (Ptr*)pdu) != ROK)
518 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
519 rgLMMStaInd(inst,LCM_CATEGORY_RESOURCE, LCM_EVENT_DMEM_ALLOC_FAIL,
520 LCM_CAUSE_MEM_ALLOC_FAIL, &dgn);
521 RLOG0(L_ERROR,"Allocation of DUX event failed");
526 SStopTask(startTime, PID_TOMUTL_CMALLCEVT);
531 /** @brief This function frees up the RgMacPdu structure that has been
532 * populated by demux.
536 * Function: rgTOMUtlFreePduEvnt
537 * - Function frees up the RgMacPdu structure, in case of error it shall
538 * free up the buffer's present in the different sdu.
541 * @param [in] Inst inst
542 * @param [in] RgMacPdu *pdu
543 * @param [in] Bool *error
547 static Void rgTOMUtlFreePduEvnt
553 static Void rgTOMUtlFreePduEvnt (pdu, error)
562 /* Steps of freeing up the PDU.
563 * 1. loop through the subHdrLst and free up all the buffers.
564 * 2. free up the whole event
566 if ((error == TRUE) && (pdu->sduLst.count > 0))
568 node = pdu->sduLst.first;
571 sdu = (RgMacSdu*)node->node;
572 RG_FREE_MSG(sdu->mBuf);
578 } /* end of rgTOMUtlFreePduEvnt */
580 /** @brief This function allocates the RgMacPdu that will be populated by DEMUX
581 * with the SubHeaders list and the values of the Control elements.
585 * Function: rgTOMInfAllocPduEvnt
588 * @param [in] Inst inst
589 * @param [out] RgMacPdu **pdu
596 static S16 rgTOMInfAllocPduEvnt
599 RgInfSfDatInd **sfInfo
602 static S16 rgTOMInfAllocPduEvnt (inst,sfInfo)
604 RgInfSfDatInd **sfInfo;
609 RgUstaDgn dgn; /* Alarm diagnostics structure */
610 volatile uint32_t startTime=0;
613 evntMem.region = rgCb[inst].rgInit.region;
614 evntMem.pool = rgCb[inst].rgInit.pool;
617 SStartTask(&startTime, PID_TOMINF_CMALLCEVT);
619 #ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */
620 MS_BUF_ADD_ALLOC_CALLER();
622 if (cmAllocEvnt (sizeof (RgInfSfDatInd), RG_BLKSZ, &evntMem, (Ptr*)sfInfo) != ROK)
624 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
625 rgLMMStaInd(inst,LCM_CATEGORY_RESOURCE, LCM_EVENT_DMEM_ALLOC_FAIL,
626 LCM_CAUSE_MEM_ALLOC_FAIL, &dgn);
627 RLOG0(L_ERROR,"Allocation failed");
632 SStopTask(startTime, PID_TOMINF_CMALLCEVT);
637 /** @brief This function frees up the RgMacPdu structure that has been
638 * populated by demux.
642 * Function: rgTOMInfFreePduEvnt
643 * - Function frees up the RgMacPdu structure, in case of error it shall
644 * free up the buffer's present in the different sdu.
647 * @param [in] RgMacPdu *pdu
648 * @param [in] Bool *error
652 static Void rgTOMInfFreePduEvnt
654 RgInfSfDatInd *sfInfo
657 static Void rgTOMInfFreePduEvnt (sfInfo)
658 RgInfSfDatInd *sfInfo;
664 } /* end of rgTOMUtlFreePduEvnt */
668 /** @brief This function performs the preparation of information needed to set
669 * L2M Scheduled UL Throughput Information for a particular UE.
673 * Function: rgTomUtlPrepareL2MUlThrpInfo
674 * This function performs the preparation of information needed to set
675 * L2M Scheduled UL Throughput Information for a particular UE.
679 * @param [in] RgCellCb *cellCb
680 * @param [in] RgUeCb *ueCb
681 * @param [out] RgRguDedDatInd *dDatInd
685 static S16 rgTomUtlPrepareL2MUlThrpInfo
689 RgRguDedDatInd *dDatInd
692 static S16 rgTomUtlPrepareL2MUlThrpInfo(cellCb,ueCb,dDatInd)
695 RgRguDedDatInd *dDatInd;
702 dDatInd->burstInd = RGU_L2M_UL_BURST_END;
703 for(loop=0;loop<dDatInd->numLch;loop++)
705 lcId=dDatInd->lchData[loop].lcId;
708 lcgId = ueCb->ul.lcCb[lcId - 1].lcgId;
709 if(ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs > 0)
711 dDatInd->burstInd = RGU_L2M_UL_BURST_START;
722 /** @brief This function is called by rgTOMDatInd. This function invokes the
723 * scheduler with the information of the received Data and any Control Elements
724 * if present. Also it generates Data indications towards the higher layers.
731 * - Retrieves the RaCb with the rnti provided, if it doesnt exist
733 * - If UE exists then update the Schduler with any MAC CEs if present.
734 * - Invoke RAM module to do Msg3 related processing rgRAMProcMsg3
735 * - Loop through the SDU subheaders and invoke either a common data
736 * indication (rgUIMSndCmnDatInd) or dedicated data indication
737 * (rgUIMSndDedDatInd) towards the higher layers.
739 * @param [in] RgCellCb *cellCb
740 * @param [in] RgUeCb *ueCb
741 * @param [in] CmLteRnti rnti
742 * @param [in] RgMacPdu *pdu
743 * @param [out] uint32_t *lcgBytes
754 static S16 rgTOMUtlProcMsg
766 static S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, isSpsRnti,spsToBeActvtd,sduSize, slot, lcgBytes)
776 #else /* LTEMAC_SPS */
778 static S16 rgTOMUtlProcMsg
787 static S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes)
796 Inst inst = cellCb->macInst - RG_INST_START;
798 RgRguCmnDatInd *cDatInd;
799 RgRguDedDatInd *dDatInd;
806 // RgInfSpsRelInfo relInfo;
813 uint16_t totalBytesRcvd = 0;
814 uint16_t sduLen[RGU_MAX_LC] = {0};
815 uint8_t qciVal[RGU_MAX_LC] = {0};
822 /* Moved outside of LTE_L2_MEAS
823 * scope as this pointer will now be used to
824 * check for valid Logical Channel ID
846 if(pdu->sduLst.first)
848 sdu = (RgMacSdu*)(pdu->sduLst.first->node);
850 if ((sdu->lcId == RG_CCCH_LCID))
852 /* code for common channel dat indications */
853 if ((ret = rgAllocShrablSBuf (inst,(Data**)&cDatInd, sizeof(RgRguCmnDatInd))) != ROK)
857 cDatInd->cellId = cellCb->cellId;
858 cDatInd->rnti = ueCb->ueId;
859 /* rg001.101: Corrected lcId value for common data indication */
860 cDatInd->lcId = cellCb->ulCcchId;
861 cDatInd->pdu = sdu->mBuf;
862 SFndLenMsg (sdu->mBuf, &ccchSz);
863 /* Fix : syed Contention resolution ID copy should consider only
864 * 6 bytes of information from sdu->mBuf. Incase of CCCH sdu for reest
865 * message/psuedo reest message, ccchSz can go beyond 6 and can corrupt
866 * other fields of ueCb. */
867 if (ccchSz >= RG_CRES_LEN)
869 SCpyMsgFix (sdu->mBuf, (MsgLen)0, RG_CRES_LEN, ueCb->contResId.resId,
872 #ifdef XEON_SPECIFIC_CHANGES
873 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);
876 rgUIMSndCmnDatInd(inst,cellCb->rguUlSap,cDatInd);
878 } /* end of common channel processing */
880 if ((ret = rgAllocShrablSBuf (inst,(Data**)&dDatInd, sizeof(RgRguDedDatInd))) != ROK)
886 elem = SRngGetWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
891 dDatInd = (RgRguDedDatInd *)elem;
892 memset(dDatInd, 0x00, sizeof(RgRguDedDatInd));
894 dDatInd->cellId = cellCb->cellId;
895 dDatInd->rnti = ueCb->ueId;
899 ulSf = &cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)];
900 if(ulSf->ueUlAllocInfo != NULLP)
902 for(idx1 = 0; idx1 < ulSf->numUe; idx1++)
904 if(ulSf->ueUlAllocInfo[idx1].rnti == ueCb->ueId)
906 numPrb = ulSf->ueUlAllocInfo[idx1].numPrb;
912 node = pdu->sduLst.first;
915 sdu = (RgMacSdu*)node->node;
917 ulLcCb = rgDBMGetUlDedLcCb (ueCb, sdu->lcId);
921 RLOG_ARG2(L_ERROR,DBG_CELLID,cellCb->cellId,"Unconfigured LCID:%d CRNTI:%d"
922 ,sdu->lcId,ueCb->ueId);
923 /* ccpu00128443: Fix for memory leak */
924 /* Fix : syed Neccessary to set sdu->mBuf = NULLP */
925 RG_FREE_MSG(sdu->mBuf);
929 #ifdef RLC_STA_PROC_IN_MAC/* RLC Status PDU Processing */
931 S16 rlcProcDlStatusPdu(Pst *udxPst,SuId suId,
932 CmLteCellId cellId,CmLteRnti rnti,CmLteLcId lcId,Buffer *rlcSdu);
934 if(ROK == rlcProcDlStatusPdu(&(cellCb->rguDlSap->sapCfg.sapPst),
935 cellCb->rguDlSap->sapCfg.suId,
936 cellCb->cellId,ueCb->ueId,sdu->lcId,sdu->mBuf))
938 RG_FREE_MSG(sdu->mBuf);
945 /* ccpu00116477- Fixed the rgUIMSndDedDatInd condition when we receive 11 sdus in the
946 * list we are losing 11th sdu and sending the first 10 sdus again which
947 * is causing the duplicate packets and eNB crashing due to access
948 * of the freed memory */
949 if (dDatInd->numLch >= RGU_MAX_LC)
951 if ((ret = rgUIMSndDedDatInd(inst,ueCb->rguUlSap,dDatInd)) != ROK)
953 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
954 "Failed to send datIndication to RGU CRNTI:%d",ueCb->ueId);
958 if ((ret = rgAllocShrablSBuf (inst,(Data**)&dDatInd, sizeof(RgRguDedDatInd))) != ROK)
963 elem = SRngGetWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
968 dDatInd = (RgRguDedDatInd *)elem;
969 memset(dDatInd, 0x00, sizeof(RgRguDedDatInd));
971 dDatInd->cellId = cellCb->cellId;
972 dDatInd->rnti = ueCb->ueId;
975 dDatInd->lchData[dDatInd->numLch].lcId = sdu->lcId;
976 dDatInd->lchData[dDatInd->numLch].pdu.mBuf[dDatInd->lchData[dDatInd->numLch].pdu.numPdu] = sdu->mBuf;
977 dDatInd->lchData[dDatInd->numLch].pdu.numPdu++;
978 lcgId = ulLcCb->lcgId;
979 SFndLenMsg(sdu->mBuf, &bufSz);
983 ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs -= bufSz;
986 //if ((lcgBytes != NULLP) && (ueCb->ul.lcgArr[lcgId].isGbr == TRUE))
987 if (lcgBytes != NULLP)
989 lcgBytes[lcgId] += bufSz;
994 /* Check if data has come on SPS LC */
995 /* KWORK_FIX: Modified the index from lcId to lcId-1 for handling lcId 10 properly */
996 if (ueCb->ul.spsLcId[sdu->lcId-1] == TRUE)
998 ueCb->ul.spsDatRcvd++;
1003 /* Data rcvd on CRNTI*/
1004 /* Retrieve the LCG ID of the LCID*/
1005 /* SPS LCG has data whose size > SID Size */
1006 /* Activate SPS if data recvd on SPS LCID and size > SID Packet Size */
1007 if((ueCb->ul.spsLcId[sdu->lcId-1] == TRUE) &&
1008 (sdu->len > RG_SPS_SID_PACKET_SIZE))
1010 *spsToBeActvtd = TRUE;
1011 *sduSize = sdu->len;
1018 if(cellCb->qciArray[ulLcCb->qci].mask == TRUE)
1020 sduLen[ulLcCb->qci] = sdu->len;
1021 totalBytesRcvd += sdu->len;
1022 qciVal[ulLcCb->qci] = ulLcCb->qci;
1026 } /* end of while for SubHeaders */
1028 for(idx2 = 0; idx2 < RGU_MAX_LC; idx2++)
1030 if((cellCb->qciArray[qciVal[idx2]].mask == TRUE) &&
1033 cellCb->qciArray[qciVal[idx2]].prbCount +=
1034 ((numPrb * sduLen[idx2]) / totalBytesRcvd);
1038 if(totalBytesRcvd > 0 && qciVal[idx2] > 0)
1040 RG_UPD_GBR_PRB(cellCb, qciVal[idx2], ((numPrb * sduLen[idx2])/totalBytesRcvd));
1045 /*Added for explicit release - start*/
1048 if(isSpsRnti && dDatInd && dDatInd->numLch)
1050 if(ueCb->ul.spsDatRcvd != 0)
1052 ueCb->ul.explRelCntr = 0;
1053 ueCb->ul.spsDatRcvd = 0;
1057 ueCb->ul.explRelCntr++;
1058 if (ueCb->ul.explRelCntr == ueCb->ul.explRelCnt)
1060 ueCb->ul.explRelCntr = 0;
1061 /* Indicate scheduler for explicit release */
1062 memset(&schPst1, 0, sizeof(Pst));
1063 rgGetPstToInst(&schPst1,inst, cellCb->schInstMap.schInst);
1064 //TODO: commented for compilation without SCH
1066 relInfo.cellSapId = cellCb->schInstMap.cellSapId;
1067 relInfo.cRnti = ueCb->ueId;
1068 relInfo.isExplRel = TRUE;
1069 /* Release indicator is called now through the matrix in the function below */
1070 //TODO: commented for compilation without SCH RgMacSchSpsRel( &schPst1, &relInfo );
1072 ueCb->ul.implRelCntr = 0;
1079 if(ueCb->ul.spsDatRcvd != 0)
1081 //ueCb->ul.implRelCntr = 0;
1082 ueCb->ul.explRelCntr = 0;
1083 ueCb->ul.spsDatRcvd = 0;
1087 /*Added for explicit release - end */
1089 if((dDatInd) && (dDatInd->numLch))
1092 rgTomUtlPrepareL2MUlThrpInfo(cellCb, ueCb,dDatInd);
1094 RG_CALC_TTI_CNT(cellCb, dDatInd->ttiCnt);
1096 if ((ret = rgUIMSndDedDatInd(inst,ueCb->rguUlSap,dDatInd)) != ROK)
1098 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
1099 "Failed to send datIndication to RGU CRNTI:%d",ueCb->ueId);
1104 else if((dDatInd) && (0 == dDatInd->numLch))
1106 /* Free the memory allocated for dDatInd if we
1107 * have no valid LCH PDU to send to RLC.*/
1108 rgFreeSharableSBuf(inst,(Data **)&dDatInd,sizeof(RgRguDedDatInd));
1114 /** @brief This function frees up the RgMacPdu structure that has been
1115 * populated by demux.
1119 * Function: rgTOMUtlInsSchInfo
1120 * - Function frees up the RgMacPdu structure, in case of error it shall
1121 * free up the buffer's present in the different sdu.
1124 * @param [in] RgMacPdu *pdu
1125 * @param [in] Bool *error
1130 static S16 rgTOMUtlInsSchInfo
1133 RgInfSfDatInd *sfInfo,
1134 RgInfCeInfo *ceInfo,
1141 static S16 rgTOMUtlInsSchInfo (pdu, sfInfo, ceInfo, rnti,spsToBeActvtd,sduSize, lcgBytes)
1143 RgInfSfDatInd *sfInfo;
1144 RgInfCeInfo *ceInfo;
1153 static S16 rgTOMUtlInsSchInfo
1156 RgInfSfDatInd *sfInfo,
1157 RgInfCeInfo *ceInfo,
1162 static S16 rgTOMUtlInsSchInfo (pdu, sfInfo, ceInfo, rnti, lcgBytes)
1164 RgInfSfDatInd *sfInfo;
1165 RgInfCeInfo *ceInfo;
1172 RgInfUeDatInd *ueInfo;
1177 RG_TOM_INF_ALLOC(sfInfo, sizeof(RgInfUeDatInd), ueInfo, ret);
1184 ueInfo->rnti = rnti;
1186 ueInfo->ceInfo = *ceInfo;
1187 ueInfo->ueLstEnt.node = (PTR)ueInfo;
1188 for (lcgId = 1, idx = 0; lcgId < RGINF_MAX_LCG_PER_UE; lcgId++)
1190 if (lcgBytes[lcgId] != 0)
1192 /* Only GBR bytes */
1193 ueInfo->lcgInfo[idx].lcgId = lcgId;
1194 ueInfo->lcgInfo[idx++].bytesRcvd = lcgBytes[lcgId];
1195 lcgBytes[lcgId] = 0;
1198 cmLListAdd2Tail(&sfInfo->ueLst, &ueInfo->ueLstEnt);
1200 } /* end of rgTOMUtlInsSchInfo */
1204 * @brief Handler for processing data indication recieved from PHY for UEs.
1208 * Function: rgTOMDatInd
1210 * Handler for processing data indication recieved from PHY for UEs.
1212 * Invoked by: RgLiTfuDatInd of LIM
1215 * For each DataInfo recieved
1216 * - Validate the information received and retrieve cellCb
1217 * Validate cellId, rnti
1218 * - Call De-Mux module to decode the data rgDUXDemuxData
1219 * - If received a CRNTI control element
1220 * - Check if a CCCH SDU is present, if it is return failure
1221 * - Check for the existence of UE, if its isnt present return failure.
1222 * - Delegate the remaining processing to rgTOMUtlProcMsg3 which
1223 * primarily informs the scheduler about the data received and
1224 * generates Data indications towards the higher layer.
1225 * - If only CCCH SDU is present
1226 * - Invoke rgTOMUtlProcMsg3 for further processing.
1227 * - If its a non-Msg3 PDU i.e. received outside of a RA procedure
1228 * - Retrieve the UeCB
1229 * - Validate that the received PDU contains only configured Logical
1231 * - Invoke rgTOMUtlProcDatPdu for further processing. It informs the
1232 * scheduler with the information of the received Data and generates
1233 * DatIndications towards the higher layers.
1235 * @param [in] Inst inst
1236 * @param[in] TfuDatIndInfo *datInd
1245 TfuDatIndInfo *datInd
1248 S16 rgTOMDatInd(inst,datInd)
1250 TfuDatIndInfo *datInd;
1256 RgUeCb *prevUeCb = NULLP;
1259 RgInfSfDatInd *sfInfo;
1263 TfuDatInfo *datInfo;
1267 Bool isSpsRnti=FALSE;
1269 // RgInfSpsRelInfo relInfo;
1270 Bool spsToBeActvtd = FALSE;
1271 uint16_t sduSize = 0;
1273 uint32_t lcgBytes[RGINF_MAX_LCG_PER_UE];
1276 #ifdef STUB_TTI_HANDLING_5GTF
1277 node = datInd->datIndLst.first;
1278 for (;node; node=node->next)
1280 datInfo = (TfuDatInfo*)node->node;
1283 SFndLenMsg(datInfo->mBuf, &len);
1284 rgUlrate_tfu += len;
1285 if (rgUlrate_tfu > 100000)
1287 printf("Sowmya:rgTOMDatInd datInfo->mBuf len =%d rgUlrate_tfu=%d",len,rgUlrate_tfu);
1295 memset(&lcgBytes, 0, sizeof(lcgBytes));
1297 tfuSap = &(rgCb[inst].tfuSap);
1299 cellCb = rgCb[inst].cell;
1300 if((cellCb == NULLP) ||
1301 (cellCb->cellId != datInd->cellId))
1304 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"Unable to get the cellCb for cell");
1307 /* Avoiding memset as all the fields are getting initialized further */
1309 if (rgTOMInfAllocPduEvnt (inst,&sfInfo) != ROK)
1311 err.errType = RGERR_TOM_DATIND;
1312 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"Unable to Allocate PDU for DUX cell");
1313 node = datInd->datIndLst.first;
1316 cmLListInit(&sfInfo->ueLst);
1317 sfInfo->cellId = datInd->cellId;
1318 sfInfo->timingInfo = datInd->timingInfo;
1319 slot = datInd->timingInfo.slot;
1321 node = datInd->datIndLst.first;
1322 for (;node; node=node->next)
1324 datInfo = (TfuDatInfo*)node->node;
1326 //uint32_t ulrate_tfu;
1328 SFndLenMsg(datInfo->mBuf, &len);
1329 #ifdef STUB_TTI_HANDLING_5GTF
1330 // printf("Sowmya:rgTOMDatInd datInfo->mBuf len =%d",len);
1332 rgUlrate_tfu += len;
1334 grgUlrate_tfu += len;
1337 #ifdef STUB_TTI_HANDLING_5GTF
1338 rgLIMUtlFreeDatIndEvnt(datInd,TRUE);
1340 /* We shall call De-Mux to process the received buffer. We shall try and find
1341 * out the RaCb based on the following -
1342 * 1. If the incoming PDU contained a CCCH SDU i.e. this is message 3.
1343 * 2. If the incoming PDU contained a CRNTI control element, i.e. we should
1344 * have a ueCb also for this
1346 /* Lets allocate the event that needs to be passed to DUX */
1347 if (rgTOMUtlAllocPduEvnt (inst,&pdu) != ROK)
1349 err.errType = RGERR_TOM_DATIND;
1350 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"Unable to Allocate PDU for DUX cell");
1351 rgTOMInfFreePduEvnt (sfInfo);
1355 if ((ret = rgDUXDemuxData (inst,pdu, &ceInfo,
1356 &datInfo->mBuf, &err)) != ROK)
1359 /* Fix: sriky memory corruption precautions */
1360 rgTOMUtlFreePduEvnt (pdu, TRUE);
1361 err.errType = RGERR_TOM_DATIND;
1362 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"DUX processing failed");
1363 tfuSap->sapSts.numPduDrop++;
1366 /* It could be that a non-msg3 pdu contains a CRNTI Control element. We
1367 * should check for CRNTI CE and if it exists the UECb must exist, also an
1368 * if the CRNTI in the CE and the one with which the message came in are
1369 * different we shall look for an raCb as well.
1372 if (ceInfo.bitMask & RG_CCCH_SDU_PRSNT)
1374 ret = rgTOMProcCCCHSduInDatInd(pdu, prevUeCb, \
1375 cellCb, datInfo, &ceInfo, slot);
1378 rgTOMUtlFreePduEvnt (pdu, TRUE);
1379 err.errType = RGERR_TOM_DATIND;
1380 tfuSap->sapSts.numPduDrop++;
1383 } /* end of Msg3 processing */
1385 else if (ceInfo.bitMask & RG_CRNTI_CE_PRSNT)
1387 ret = rgTOMProcCrntiCEInDatInd(pdu, prevUeCb, \
1388 cellCb, datInfo, &ceInfo, slot);
1391 rgTOMUtlFreePduEvnt (pdu, TRUE);
1392 err.errType = RGERR_TOM_DATIND;
1393 tfuSap->sapSts.numPduDrop++;
1397 } /* end of CRNTI based message */
1400 ueCb = rgDBMGetUeCb (cellCb, datInfo->rnti);
1404 /* Try getting the UE using SPS-RNTI. */
1405 ueCb = rgDBMGetSpsUeCb (cellCb, datInfo->rnti);
1409 /* Increment implrelCntr for an empty transmission */
1410 if (pdu->sduLst.count == 0)
1412 ueCb->ul.implRelCntr++;
1413 if (ueCb->ul.implRelCntr == ueCb->ul.implRelCnt)
1415 /* Indicate scheduler for implicit release */
1416 memset(&schPst1, 0, sizeof(Pst));
1417 rgGetPstToInst(&schPst1,inst, cellCb->schInstMap.schInst);
1419 ueCb->ul.implRelCntr = 0;
1420 ueCb->ul.explRelCntr = 0;
1422 relInfo.cellSapId = cellCb->schInstMap.cellSapId;
1423 relInfo.cRnti = ueCb->ueId;
1424 relInfo.isExplRel= FALSE;
1425 //TODO: commented for compilation without SCH RgMacSchSpsRel(&schPst1, &relInfo);
1431 /* Reset the implrelCntr */
1432 ueCb->ul.implRelCntr = 0;
1438 /* Perform failure if ueCb is still NULLP */
1439 rgTOMUtlFreePduEvnt (pdu, TRUE);
1440 err.errType = RGERR_TOM_DATIND;
1441 RLOG_ARG1(L_ERROR,DBG_CELLID,datInd->cellId,"RNTI:%d Unable to get the UE CB",
1443 tfuSap->sapSts.numPduDrop++;
1448 rgTOMUtlL2MStoreBufSz(ueCb, &ceInfo);
1449 rgTOML2MCompileActiveLCs (cellCb, ueCb, pdu, &ceInfo);
1452 if ((ret = rgTOMUtlProcMsg(cellCb, ueCb, pdu, isSpsRnti,&spsToBeActvtd,&sduSize, slot, (uint32_t *)&lcgBytes)) != ROK)
1454 if ((ret = rgTOMUtlProcMsg (cellCb, ueCb, pdu, slot, (uint32_t *)&lcgBytes)) != ROK)
1455 #endif /* LTEMAC_SPS */
1457 rgTOMUtlFreePduEvnt (pdu, TRUE);
1458 err.errType = RGERR_TOM_DATIND;
1459 RLOG_ARG1(L_ERROR,DBG_CELLID,datInd->cellId,
1460 "Unable to handle Data Indication CRNTI:%d",ueCb->ueId);
1461 tfuSap->sapSts.numPduDrop++;
1468 if(rgTOMUtlInsSchInfo(pdu, sfInfo, &ceInfo, datInfo->rnti,spsToBeActvtd,sduSize, (uint32_t *)&lcgBytes) != ROK)
1470 if(rgTOMUtlInsSchInfo(pdu, sfInfo, &ceInfo, datInfo->rnti, (uint32_t *)&lcgBytes) != ROK)
1474 rgTOMInfFreePduEvnt (sfInfo);
1475 rgTOMUtlFreePduEvnt (pdu, FALSE);
1478 /* free up the PDU memory */
1479 rgTOMUtlFreePduEvnt (pdu, FALSE);
1481 /* Free the allocated memory for ueUlAllocInfo here */
1483 if(cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)].ueUlAllocInfo != NULLP)
1485 /*ccpu00117052 - MOD - Passing double for proper NULLP
1487 rgFreeSBuf(inst,(Data **)&(cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)].ueUlAllocInfo),
1488 ((cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)].numUe) * sizeof(RgUeUlAlloc)));
1492 /* Update PRB used for all GBR QCIs to scheduler */
1493 memcpy( &sfInfo->qcisUlPrbCnt[0],
1494 &cellCb->qcisUlPrbCnt[0],
1495 (RGM_MAX_QCI_REPORTS * sizeof(uint32_t)));
1496 /* clear the cellCb ul prb value */
1497 memset(&cellCb->qcisUlPrbCnt[0], 0,
1498 (RGM_MAX_QCI_REPORTS * sizeof(uint32_t)));
1502 rgGetPstToInst(&schPst, inst,cellCb->schInstMap.schInst);
1503 sfInfo->cellSapId = cellCb->schInstMap.cellSapId;
1504 //TODO: commented for compilation without SCH RgMacSchSfRecp(&schPst, sfInfo);
1509 * @brief Function handles allocation for common channels i.e. BCCH-BCH,
1510 * BCCH-DLSCH, PCCH-DLSCH.
1514 * Function : rgHndlCmnChnl
1516 * This function is invoked from RgSchMacSfAllocReq. This function handles
1517 * allocations made for common channels like BCCH and PCCH.
1520 * 1. If BCCH on BCH has been scheduled, send StatusIndication on RGU.
1521 * 2. If PCCH is scheduled, send StatusIndication on RGU.
1522 * 3. If BCCH on DLSCH has been scheduled and sndStatInd is TRUE, send
1523 * StatusIndication on RGU, else copy the bcch buffer onto the downlink
1527 * @param[in] RgCellCb *cell,
1528 * @param[in] CmLteTimingInfo timingInfo,
1529 * @param[in] RgInfCmnLcInfo *cmnLcInfo,
1530 * @param[in/out] RgErrInfo *err,
1536 static S16 rgHndlCmnChnl
1539 CmLteTimingInfo timingInfo,
1540 RgInfCmnLcInfo *cmnLcInfo,
1544 static S16 rgHndlCmnChnl(cell, timingInfo, cmnLcInfo, err)
1546 CmLteTimingInfo timingInfo;
1547 RgInfCmnLcInfo *cmnLcInfo;
1551 #if (ERRCLASS & ERRCLS_DEBUG)
1555 RgBcchDlschLcCb *bcch;
1556 #if (ERRCLASS & ERRCLS_DEBUG)
1559 #endif/*RGR_SI_SCH*/
1560 RguCStaIndInfo *staInd;
1562 Inst inst = cell->macInst - RG_INST_START;
1565 dlSf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
1567 if(cmnLcInfo->bitMask & RGINF_BCH_INFO)
1570 #if (ERRCLASS & ERRCLS_DEBUG)
1571 if(NULLP == (bch = rgDBMGetBcchOnBch(cell)))
1575 if(cmnLcInfo->bchInfo.lcId != bch->lcId)
1581 if (rgAllocShrablSBuf (inst,(Data**)&staInd, sizeof(RguCStaIndInfo)) != ROK)
1583 err->errCause = RGERR_TOM_MEM_EXHAUST;
1586 staInd->cellId = cell->cellId;
1587 staInd->rnti = RG_INVALID_RNTI;
1588 staInd->lcId = cmnLcInfo->bchInfo.lcId;
1589 staInd->transId = (timingInfo.sfn << 8) | (timingInfo.slot);
1590 /* ADD Changes for Downlink UE Timing Optimization */
1591 #ifdef LTEMAC_DLUE_TMGOPTMZ
1592 dlSf->remDatReqCnt++;
1594 if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK)
1599 /*Store the received BCH Data in the scheduled subframe*/
1600 dlSf->bch.tb = cmnLcInfo->bchInfo.pdu;
1601 #endif/*RGR_SI_SCH*/
1604 if(cmnLcInfo->bitMask & RGINF_PCCH_INFO)
1606 #if (ERRCLASS & ERRCLS_DEBUG)
1607 if(NULLP == (pcch = rgDBMGetPcch(cell)))
1611 if(cmnLcInfo->pcchInfo.lcId != pcch->lcId)
1617 dlSf->pcch.pdcch.rnti =
1618 cmnLcInfo->pcchInfo.rnti;
1619 dlSf->pcch.pdcch.dci =
1620 cmnLcInfo->pcchInfo.dciInfo;
1622 /* ccpu00132314-ADD-Fill the tx Pwr offset from scheduler */
1623 dlSf->pcch.txPwrOffset = cmnLcInfo->pcchInfo.txPwrOffset;
1625 if (rgAllocShrablSBuf (inst,(Data**)&staInd, sizeof(RguCStaIndInfo)) != ROK)
1627 err->errCause = RGERR_TOM_MEM_EXHAUST;
1630 staInd->cellId = cell->cellId;
1631 staInd->rnti = RG_INVALID_RNTI;
1632 staInd->lcId = cmnLcInfo->pcchInfo.lcId;
1633 staInd->transId = (timingInfo.sfn << 8) | (timingInfo.slot);
1634 /* ADD Changes for Downlink UE Timing Optimization */
1635 #ifdef LTEMAC_DLUE_TMGOPTMZ
1636 dlSf->remDatReqCnt++;
1638 /* for consolidated CmnStaInd calling below function from function
1639 * rgHndlSchedUe once CmnStaInd prepared for all UEs
1641 if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK)
1647 if(cmnLcInfo->bitMask & RGINF_BCCH_INFO)
1649 dlSf->bcch.pdcch.rnti =
1650 cmnLcInfo->bcchInfo.rnti;
1651 dlSf->bcch.pdcch.dci =
1652 cmnLcInfo->bcchInfo.dciInfo;
1654 /* ccpu00132314-ADD-Fill the tx Pwr offset from scheduler */
1655 dlSf->bcch.txPwrOffset = cmnLcInfo->bcchInfo.txPwrOffset;
1659 (bcch=rgDBMGetBcchOnDlsch(cell,cmnLcInfo->bcchInfo.lcId)))
1663 if(TRUE == cmnLcInfo->bcchInfo.sndStatInd)
1665 RG_FREE_MSG(bcch->tb);
1666 if (rgAllocShrablSBuf (inst,(Data**)&staInd,
1667 sizeof(RguCStaIndInfo)) != ROK)
1669 err->errCause = RGERR_TOM_MEM_EXHAUST;
1672 staInd->cellId = cell->cellId;
1673 staInd->rnti = RG_INVALID_RNTI;
1674 staInd->lcId = cmnLcInfo->bcchInfo.lcId;
1675 staInd->transId = (timingInfo.sfn << 8) | (timingInfo.slot);
1676 /* ADD Changes for Downlink UE Timing Optimization */
1677 #ifdef LTEMAC_DLUE_TMGOPTMZ
1678 dlSf->remDatReqCnt++;
1680 if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK)
1687 SCpyMsgMsg(bcch->tb, RG_GET_MEM_REGION(rgCb[inst]),
1688 RG_GET_MEM_POOL(rgCb[inst]), &dlSf->bcch.tb);
1691 /*Store the received BCCH Data in the scheduled subframe*/
1692 dlSf->bcch.tb = cmnLcInfo->bcchInfo.pdu;
1693 #endif/*RGR_SI_SCH*/
1697 } /* end of rgHndlCmnChnl */
1700 * @brief Function for handling allocations for dedicated channels for a
1705 * Function : rgHndlSchdUe
1707 * This function shall be invoked whenever scheduler is done with the
1708 * allocations of dedicated channels for a subframe. Invoked by the function
1709 * RgSchMacSfAllocReq.
1711 * Processing steps :
1712 * 1. Loops through the list of UE's scheduled looking for the corresponding
1714 * 2. Finds the corresponding HARQ process.
1715 * 3. Invokes the DHM function to issue StatusIndications on RGU.
1718 * @param[in] RgCellCb *cell,
1719 * @param[in] CmLteTimingInfo timingInfo,
1720 * @param[in] RgInfUeInfo *ueInfo
1721 * @param[in/out] RgErrInfo *err
1727 static S16 rgHndlSchdUe
1730 CmLteTimingInfo timingInfo,
1731 RgInfUeInfo *ueInfo,
1735 static S16 rgHndlSchdUe(cell, timingInfo, ueInfo, err) /* laa_ut_fix */
1737 CmLteTimingInfo timingInfo;
1738 RgInfUeInfo *ueInfo;
1744 if(NULLP == ueInfo->allocInfo)
1749 rgDHMSndConsolidatedStaInd(cell, ueInfo, timingInfo, err);
1752 } /* end of rgHndlSchdUe */
1756 * @brief Function for handling Uplink allocations for Ue for a
1761 * Function : rgHndlUlUeInfo
1763 * @param[in] RgCellCb *cell,
1764 * @param[in] CmLteTimingInfo timingInfo,
1765 * @param[in] RgInfUlUeInfo *ueInfo
1771 static S16 rgHndlUlUeInfo
1774 CmLteTimingInfo timingInfo,
1775 RgInfUlUeInfo *ueInfo
1778 static S16 rgHndlUlUeInfo(cell, timingInfo, ueInfo)
1780 CmLteTimingInfo timingInfo;
1781 RgInfUlUeInfo *ueInfo;
1784 Inst inst = cell->macInst - RG_INST_START;
1790 ulSf = &cell->ulSf[(timingInfo.slot % RGSCH_NUM_SUB_FRAMES)];
1792 /* rg003.301-MOD- Corrected the purifier memory leak */
1793 if (ulSf->numUe != ueInfo->numUes)
1795 if (ulSf->ueUlAllocInfo)
1797 rgFreeSBuf(inst,(Data **)&(ulSf->ueUlAllocInfo),
1798 ulSf->numUe * sizeof(RgUeUlAlloc));
1801 #ifdef XEON_SPECIFIC_CHANGES
1802 CM_MEAS_TIME((cell->crntTime.slot % RGSCH_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MEAS_FREE);
1803 CM_ADD_INFO((cell->crntTime.slot % RGSCH_NUM_SUB_FRAMES), CM_DBG_MEAS_FREE, ulSf->numUe);
1805 ulSf->numUe = ueInfo->numUes;
1806 if((ulSf->ueUlAllocInfo == NULLP) && (ueInfo->numUes > 0))
1808 /* Allocate memory for ulAllocInfo */
1809 if((ret = rgAllocSBuf(inst,(Data**)&(cell->ulSf[(timingInfo.slot % RGSCH_NUM_SUB_FRAMES)].
1810 ueUlAllocInfo), ueInfo->numUes * sizeof(RgUeUlAlloc))) != ROK)
1815 #ifdef XEON_SPECIFIC_CHANGES
1816 CM_MEAS_TIME((cell->crntTime.slot % RGSCH_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MEAS_ALLOC);
1817 CM_ADD_INFO((cell->crntTime.slot % RGSCH_NUM_SUB_FRAMES), CM_DBG_MEAS_ALLOC, ueInfo->numUes);
1819 if (ulSf->ueUlAllocInfo != NULLP)
1821 for(idx = 0; idx < ueInfo->numUes; idx++)
1823 ulSf->ueUlAllocInfo[idx].rnti = ueInfo->ulAllocInfo[idx].rnti;
1824 ulSf->ueUlAllocInfo[idx].numPrb = ueInfo->ulAllocInfo[idx].numPrb;
1827 RGCPYTIMEINFO(timingInfo, ulSf->schdTime);
1829 } /* end of rgHndlUlUeInfo */
1832 * @brief Function for handling RaResp request received from scheduler to MAC
1836 * Function : rgTOMRlsSf
1838 * This function shall be invoked whenever scheduler is done with the
1839 * allocations of random access responses for a subframe.
1840 * This shall invoke RAM to create ueCbs for all the rapIds allocated and
1841 * shall invoke MUX to create RAR PDUs for raRntis allocated.
1844 * @param[in] Inst inst
1845 * @param[in] CmLteCellId cellId,
1846 * @param[in] CmLteTimingInfo timingInfo,
1847 * @param[in] RaRespInfo *rarInfo
1858 Void rgTOMRlsSf(dlSf)
1866 if(dlSf->txDone == FALSE)
1868 RLOG0(L_ERROR, "SUBFRAME Not pushed to the PHY");
1870 if (dlSf->bch.tb != NULLP)
1872 RG_FREE_MSG(dlSf->bch.tb);
1874 if (dlSf->bcch.tb != NULLP)
1876 RG_FREE_MSG(dlSf->bcch.tb);
1878 if (dlSf->pcch.tb != NULLP)
1880 RG_FREE_MSG(dlSf->pcch.tb);
1883 rgTOMEmtcRlsSf(dlSf);
1885 for(idx=0; idx < dlSf->numRaRsp; idx++)
1887 RG_FREE_MSG(dlSf->raRsp[idx].rar);
1890 /* ADD Changes for Downlink UE Timing Optimization */
1891 #ifdef LTEMAC_DLUE_TMGOPTMZ
1892 dlSf->remDatReqCnt = 0;
1893 /* Fix[ccpu00126310]: Tracks Data Requests from RLC for both loosely and tight coupled
1895 dlSf->statIndDone = FALSE;
1897 if (dlSf->tbs.count)
1902 RGDBGERRNEW(inst, (rgPBuf(inst),
1903 "Error Stale TBs in Subframes TBS list\n"));
1904 node = dlSf->tbs.first;
1907 hqP = (RgDlHqProcCb*)node->node;
1911 for(i=0;i< RG_MAX_TB_PER_UE;i++)
1913 if (hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf)
1915 cmLListDelFrm(&dlSf->tbs, &(hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk));
1916 hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node = NULLP;
1917 printf("\n rgTOMRlsSf:: hqP %p \n", (Void *)hqP);
1919 hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf = NULLP;
1924 /*arjun: check if dlSf laaTb list has to be freed???*/
1925 cmLListInit(&dlSf->tbs);
1926 dlSf->txDone = FALSE;
1932 * @brief Function is called by the scheduler once it has completed the
1933 * allocation for the subframe.
1937 * Function : rgHndlFlowCntrl
1938 * This function should fill and send Flow control
1942 * @param[in] Pst *cell
1943 * @param[in] RgInfSfAlloc *sfInfo Carries all the allocation
1952 RgInfSfAlloc *sfInfo
1955 S16 rgHndlFlowCntrl(cell, sfInfo)
1957 RgInfSfAlloc *sfInfo;
1960 RguFlowCntrlInd *flowCntrlInd;
1965 pst = &cell->rguDlSap->sapCfg.sapPst;
1966 /* flowCntrlInd is alloced in cell init time and will be re-used throughout */
1967 flowCntrlInd = cell->flowCntrlInd;
1968 flowCntrlInd->cellId = sfInfo->cellId;
1969 flowCntrlInd->numUes = sfInfo->flowCntrlInfo.numUes;
1971 for (ueIdx = 0; ueIdx < sfInfo->flowCntrlInfo.numUes; ueIdx++)
1973 flowCntrlInd->ueFlowCntrlInfo[ueIdx].ueId = sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].ueId;
1974 flowCntrlInd->ueFlowCntrlInfo[ueIdx].numLcs = sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].numLcs;
1976 for (lcIdx = 0; lcIdx < RGINF_MAX_NUM_DED_LC; lcIdx++)
1978 flowCntrlInd->ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].lcId =
1979 sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].lcId;
1980 flowCntrlInd->ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].pktAdmitCnt =
1981 sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].pktAdmitCnt;
1983 flowCntrlInd->ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].maxBo4FlowCtrl =
1984 sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].maxBo4FlowCtrl;
1987 RgUiRguFlowCntrlInd(pst, cell->rguDlSap->sapCfg.spId,flowCntrlInd); /* TODO: Rishi confirm if the suId and pst pointer is correct */
1991 * @brief Function is called by the scheduler once it has completed the
1992 * allocation for the subframe.
1996 * Function : RgSchMacSfAllocReq
1998 * This function shall be invoked whenever scheduler is done with the
1999 * allocations of for a subframe. The sfInfo carries all the allocation
2000 * details for the common channels, RA responses and dedicated channel
2003 * Processing steps :
2004 * 1. Reset the information present in the downlink subframe that is
2006 * 2. Handle common channel allocations
2007 * 3. Handle RA Response allocations
2008 * 4. Handle dedicated channel allocations.
2010 * @param[in] Pst *pst
2011 * @param[in] RgInfSfAlloc *sfInfo Carries all the allocation
2017 S16 RgSchMacSfAllocReq
2020 RgInfSfAlloc *sfInfo
2023 S16 RgSchMacSfAllocReq(pst, sfInfo)
2025 RgInfSfAlloc *sfInfo;
2031 volatile uint32_t startTime=0;
2035 RG_IS_INST_VALID(pst->dstInst);
2036 inst = pst->dstInst - RG_INST_START;
2038 SStartTask(&startTime, PID_MAC_SF_ALLOC_REQ);
2045 if((cell = rgCb[inst].cell) == NULLP)
2047 RLOG_ARG0(L_ERROR,DBG_CELLID,sfInfo->cellId, "No cellCb found with cell");
2051 dlSf = &cell->subFrms[(sfInfo->timingInfo.slot % RG_NUM_SUB_FRAMES)];
2053 rgTOMRlsSf(inst,dlSf);
2054 dlSf->schdTime = sfInfo->timingInfo;
2057 rgLaaInitTbInfoLst(cell);
2060 /* Fix : syed Ignore Failure Returns and continue processing.
2061 * Incomplete processing results in state sync loss between MAC-SCH. */
2063 if(TRUE == cell->emtcEnable)
2065 rgEmtcHndl(cell, sfInfo);
2068 rgHndlCmnChnl(cell, sfInfo->timingInfo, &sfInfo->cmnLcInfo, &err);
2070 rgHndlRaResp(cell, sfInfo->timingInfo, &sfInfo->rarInfo, &err);
2073 #ifdef XEON_SPECIFIC_CHANGES
2074 CM_MEAS_TIME((cell->crntTime.slot % RG_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MAC_B4_UE_SCHD);
2076 rgHndlSchdUe(cell, sfInfo->timingInfo, &sfInfo->ueInfo, &err);
2077 #ifdef XEON_SPECIFIC_CHANGES
2078 CM_MEAS_TIME((cell->crntTime.slot % RG_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MAC_UE_SCHD);
2080 rgLaaChkAndReqTbs(dlSf,cell, inst);
2083 rgHndlSchdUe(cell, sfInfo->timingInfo, &sfInfo->ueInfo, &err);
2087 if(rgHndlUlUeInfo(cell, sfInfo->ulUeInfo.timingInfo,
2088 &sfInfo->ulUeInfo) != ROK)
2093 #ifdef XEON_SPECIFIC_CHANGES
2094 CM_MEAS_TIME((cell->crntTime.slot % RG_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MAC_MEAS);
2096 /* Fix[ccpu00126310]: Tracks Data Requests from RLC for both loosely and tight coupled
2100 /* Added the handling for pushing down
2101 * TFU Data request in the retransmission only scenario.*/
2102 #ifdef LTEMAC_DLUE_TMGOPTMZ
2103 dlSf->statIndDone = TRUE;
2104 /* Fix [ccpu00126310]: Tracks Data Requests from RLC for both loosely and tight coupled
2106 if(!(dlSf->txDone) &&
2108 (TRUE == rgLaaChkAllRxTbs(dlSf)) &&
2110 (0 == dlSf->remDatReqCnt) && (dlSf->statIndDone) &&
2111 (RG_TIMEINFO_SAME(cell->crntTime, dlSf->schdTime)))
2113 /*This is the case of rettransmission, so no need
2114 * to wait for TTI Ind to push TFU Data Request. Send
2116 if (ROK != rgTOMUtlProcDlSf (dlSf, cell, &err))
2118 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to process downlink subframe for cell");
2119 err.errType = RGERR_ROM_DEDDATREQ;
2121 /* Mark this frame as sent */
2122 dlSf->txDone = TRUE;
2125 if (sfInfo->flowCntrlInfo.numUes > 0)
2127 rgHndlFlowCntrl(cell,sfInfo);
2130 SStopTask(startTime, PID_MAC_SF_ALLOC_REQ);
2132 } /* end of RgSchMacSfAllocReq */
2134 * @brief Handler for processing data indication recieved from PHY for UEs.
2138 * Function: rgTOMProcCrntiCEInDatInd
2140 * Handler for processing data indication recieved from PHY for UEs.
2142 * Invoked by: RgLiTfuDatInd of LIM
2145 * For each DataInfo recieved
2146 * - If received a CRNTI control element
2147 * - Check if a CCCH SDU is present, if it is return failure
2148 * - Check for the existence of UE, if its isnt present return failure.
2149 * - Delegate the remaining processing to rgTOMUtlProcMsg3 which
2150 * primarily informs the scheduler about the data received and
2151 * generates Data indications towards the higher layer.
2153 * @param RgMacPdu *pdu,
2154 * @param RgUeCb *prevUeCb,
2155 * @param RgCellCb *cellCb,
2156 * @param TfuDatInfo *datInfo,
2157 * @param RgInfCeInfo *ceInfo
2163 static S16 rgTOMProcCrntiCEInDatInd
2168 TfuDatInfo *datInfo,
2169 RgInfCeInfo *ceInfo,
2173 static S16 rgTOMProcCrntiCEInDatInd( pdu, prevUeCb, cellCb, datInfo, ceInfo, slot)
2177 TfuDatInfo *datInfo;
2178 RgInfCeInfo *ceInfo;
2182 RgUeCb *ueCb = NULLP;
2183 Inst inst = cellCb->macInst - RG_INST_START;
2196 ueCb = rgDBMGetUeCbFromRachLst (cellCb, datInfo->rnti);
2200 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
2201 "RNTI:%d Received MSG3 with CRNTI,unable to find ueCb", ceInfo->ces.cRnti);
2205 prevUeCb = rgDBMGetUeCb (cellCb, ceInfo->ces.cRnti);
2206 if (prevUeCb == NULLP)
2208 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
2209 "RNTI:%d Received MSG3 with CRNTI,unable to find ueCb", ceInfo->ces.cRnti);
2212 RLOG_ARG2(L_DEBUG,DBG_CELLID,cellCb->cellId,
2213 "CRNTI CE(%d) received through tmpCrnti(%d)",
2214 ceInfo->ces.cRnti, datInfo->rnti);
2215 rgDBMDelUeCbFromRachLst(cellCb, ueCb);
2216 rgRAMFreeUeCb(inst,ueCb);
2219 if ((rgTOMUtlProcMsg(cellCb, ueCb, pdu, FALSE,&spsToBeActvtd,&sduSize, slot, NULLP)) != ROK)
2221 if ((rgTOMUtlProcMsg (cellCb, ueCb, pdu, slot, NULLP)) != ROK)
2222 #endif /* LTEMAC_SPS */
2224 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
2225 "RNTI:%d Processing for MSG3 failed",datInfo->rnti);
2231 * @brief Handler for processing data indication recieved from PHY for UEs.
2235 * Function: rgTOMProcCCCHSduInDatInd
2237 * Handler for processing data indication recieved from PHY for UEs.
2239 * Invoked by: RgLiTfuDatInd of LIM
2242 * For each DataInfo recieved
2243 * - If only CCCH SDU is present
2244 * - Invoke rgTOMUtlProcMsg3 for further processing.
2245 * - If its a non-Msg3 PDU i.e. received outside of a RA procedure
2246 * - Retrieve the UeCB
2247 * - Validate that the received PDU contains only configured Logical
2249 * - Invoke rgTOMUtlProcDatPdu for further processing. It informs the
2250 * scheduler with the information of the received Data and generates
2251 * DatIndications towards the higher layers.
2253 * @param TfuDatIndInfo *datInd
2254 * @param RgMacPdu *pdu,
2255 * @param RgUeCb *prevUeCb,
2256 * @param RgCellCb *cellCb,
2257 * @param TfuDatInfo *datInfo,
2258 * @param RgInfCeInfo *ceInfo
2264 static S16 rgTOMProcCCCHSduInDatInd
2269 TfuDatInfo *datInfo,
2270 RgInfCeInfo *ceInfo,
2274 static S16 rgTOMProcCCCHSduInDatInd( pdu, prevUeCb, cellCb, datInfo, ceInfo, slot)
2278 TfuDatInfo *datInfo;
2279 RgInfCeInfo *ceInfo;
2283 RgUeCb *ueCb = NULLP;
2284 Inst inst = cellCb->macInst - RG_INST_START;
2297 if (ceInfo->bitMask & RG_CRNTI_CE_PRSNT)
2299 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
2300 "CRNTI:%d Received MSG3 with CCCH",ceInfo->ces.cRnti);
2304 ueCb = rgDBMGetUeCbFromRachLst (cellCb, datInfo->rnti);
2308 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
2309 "RNTI:%d Processing for MSG3 failed", datInfo->rnti);
2312 /* Fix: syed Drop any duplicate Msg3(CCCH Sdu) */
2313 if (ueCb->dl.hqEnt.numHqProcs)
2315 /* HqE is already initialized by a previuos Msg3 */
2316 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"RNTI:%d Processing for MSG3 failed. Duplicate "
2317 "MSG3 received. Dropping", datInfo->rnti);
2321 if(rgDHMHqEntInit(inst,&ueCb->dl.hqEnt,
2322 cellCb->maxDlHqProcPerUe) != ROK)
2324 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"RNTI:%d Harq Initialization failed ",
2328 RLOG_ARG1(L_DEBUG,DBG_CELLID,cellCb->cellId,
2329 "CCCH SDU received through tmpCrnti(%d)",datInfo->rnti);
2331 if ((rgTOMUtlProcMsg(cellCb, ueCb, pdu, FALSE,&spsToBeActvtd,&sduSize, slot, NULLP)) != ROK)
2333 if ((rgTOMUtlProcMsg (cellCb, ueCb, pdu, slot, NULLP)) != ROK)
2334 #endif /* LTEMAC_SPS */
2336 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"RNTI:%d Processing for MSG3 failed",
2345 /** @brief This function captures the BSR value from Control Element
2346 * Info structure and updates the effective Buffer size into the
2347 * corresponding LCG ID.
2351 * Function: rgTOMUtlL2MStoreBufSz
2354 * - update/append the Data structure based on BSR type
2356 * @param [in] RgUeCb *ueCb
2357 * @param [in] RgInfCeInfo *ceInfo
2362 static S16 rgTOMUtlL2MStoreBufSz
2368 static S16 rgTOMUtlL2MStoreBufSz (ueCb, ceInfo)
2370 RgInfCeInfo *ceInfo;
2376 if(ceInfo->bitMask & RG_TRUNC_BSR_CE_PRSNT)
2378 lcgId = ((ceInfo->ces.bsr.truncBsr >> 6) & 0x03);
2379 bsr = ceInfo->ces.bsr.truncBsr & 0x3F;
2380 ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs = rgLwrBsrTbl[bsr];
2382 else if(ceInfo->bitMask & RG_SHORT_BSR_CE_PRSNT)
2384 lcgId = ((ceInfo->ces.bsr.shortBsr >> 6) & 0x03);
2385 bsr = ceInfo->ces.bsr.shortBsr & 0x3F;
2386 ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs = rgLwrBsrTbl[bsr];
2389 else if(ceInfo->bitMask & RG_LONG_BSR_CE_PRSNT)
2391 ueCb->ul.lcgArr[0].lcgBsInfo.outStndngBs = rgLwrBsrTbl[ceInfo->ces.bsr.longBsr.bs1];
2392 ueCb->ul.lcgArr[1].lcgBsInfo.outStndngBs = rgLwrBsrTbl[ceInfo->ces.bsr.longBsr.bs2];
2393 ueCb->ul.lcgArr[2].lcgBsInfo.outStndngBs = rgLwrBsrTbl[ceInfo->ces.bsr.longBsr.bs3];
2394 ueCb->ul.lcgArr[3].lcgBsInfo.outStndngBs = rgLwrBsrTbl[ceInfo->ces.bsr.longBsr.bs4];
2397 } /* end of rgTOMUtlL2MStoreBufSz*/
2399 /** @brief : Compiles list of LCs received in UL data for DTCH RBs
2403 * @param [in] RgCellCb *cellCb
2404 * @param [in] RgUeCb *ueCb
2405 * @param [in] CmLteRnti rnti
2406 * @param [in] RgMacPdu *pdu
2413 static Void rgTOML2MCompileActiveLCs
2421 static Void rgTOML2MCompileActiveLCs(cellCb, ueCb, pdu, ceInfo)
2425 RgInfCeInfo *ceInfo;
2433 node = pdu->sduLst.first;
2436 sdu = (RgMacSdu*)node->node;
2438 if ((ulLcCb = rgDBMGetUlDedLcCb(ueCb, sdu->lcId)), ulLcCb != NULLP)
2440 if (ulLcCb->lcgId != 0)
2442 ceInfo->bitMask |= RG_ACTIVE_LC_PRSNT;
2443 ceInfo->ulActLCs[ulLcCb->lcId - 1] = TRUE;
2454 /**********************************************************************
2457 **********************************************************************/