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 L2 Measurement fucntions
29 **********************************************************************/
31 /** @file rg_sch_l2m.c
32 @brief This file implements the L2 Measurement feature code.
35 /* header include files -- defines (.h) */
36 #include "common_def.h"
43 #include "rg_sch_cmn.h"
44 #include "rg_sch_inf.h" /* typedefs for Scheduler */
45 #include "rg_sch_err.h"
46 #include "rl_interface.h"
47 #include "rl_common.h"
49 /* header/extern include files (.x) */
50 #include "tfu.x" /* TFU types */
51 #include "lrg.x" /* layer management typedefs for MAC */
52 #include "rgr.x" /* layer management typedefs for MAC */
53 #include "rgm.x" /* layer management typedefs for MAC */
54 #include "rg_sch_inf.x" /* typedefs for Scheduler */
55 #include "rg_sch.x" /* typedefs for Scheduler */
56 #include "rg_sch_cmn.x" /* typedefs for Scheduler */
61 static const char* RLOG_MODULE_NAME="MAC";
62 static int RLOG_MODULE_ID=4096;
63 static int RLOG_FILE_ID=166;
65 PRIVATE S16 rgSchL2mInsertMeasCb ARGS((
67 RgSchL2MeasCb *measCb,
68 LrgSchMeasReqInfo *measInfo ));
70 PRIVATE RgSchL2MeasCb * rgSchL2mAllocMeasCb ARGS((
72 LrgSchMeasReqInfo *measInfo,
75 /* Function definitions */
77 /** @brief This function fills the L2 measurement confirm structure
81 * Function: rgSchFillL2MeasCfm
83 * @param [in] RgSchCellCb *cell
84 * @param [in] RgSchL2MeasCb *measCb
85 * @param [out] LrgSchMeasCfmInfo *measCfm
86 * @param [in] measTime
90 PUBLIC S16 rgSchFillL2MeasCfm
93 RgSchL2MeasCb *measCb,
94 LrgSchMeasCfmInfo *cfm,
98 PUBLIC S16 rgSchFillL2MeasCfm(cell, measCb, cfm, measTime)
100 RgSchL2MeasCb *measCb;
101 LrgSchMeasCfmInfo *cfm;
106 LrgSchMeasReqInfo *measInfo;
110 TRC3(rgSchFillL2MeasCfm)
112 measInfo = &measCb->measReq;
114 cfm->hdr.transId = measInfo->hdr.transId;
115 cfm->measType = measInfo->measType;
116 cfm->cellId = measInfo->cellId;
117 cfm->cfm.status = LCM_PRIM_OK;
118 if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_DL) &&
121 cfm->avgPrbDl.prbPerc = ((cell->avgPrbDl.prbCount * 100) /
123 /* Resetting the prbCount to 0, fix for ccpu00125002 */
124 cell->avgPrbDl.prbCount = 0;
126 if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_UL) &&
129 cfm->avgPrbUl.prbPerc = ((cell->avgPrbUl.prbCount * 100) /
131 /* Resetting the prbCount to 0, fix for ccpu00125002 */
132 cell->avgPrbUl.prbCount = 0;
134 if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_PER_QCI_DL) &&
137 cfm->avgPrbQciDlCfm.numQci = measCb->measReq.avgPrbQciDl.numQci;
138 for(idx = 0; idx < measCb->measReq.avgPrbQciDl.numQci; idx++)
140 qciVal = measCb->measReq.avgPrbQciDl.qci[idx];
141 cfm->avgPrbQciDlCfm.prbPercQci[idx].prbPercQci =
142 ((cell->qciArray[qciVal].dlPrbCount * 100) /
144 cfm->avgPrbQciDlCfm.prbPercQci[idx].qciValue = qciVal;
145 cell->qciArray[qciVal].dlPrbCount = 0;
148 if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL) &&
151 cfm->avgPrbQciUlCfm.numQci = measCb->measReq.avgPrbQciUl.numQci;
152 for(idx = 0; idx < measCb->measReq.avgPrbQciUl.numQci; idx++)
154 cfm->avgPrbQciUlCfm.prbPercQci[idx].qciValue =
155 measCb->avgPrbQciUl.prbUsage[idx].qciValue;
157 if(measCb->avgPrbQciUl.prbUsage[idx].prbUsage > measCb->ulTotalBw)
159 measCb->avgPrbQciUl.prbUsage[idx].prbUsage = measCb->ulTotalBw;
162 cfm->avgPrbQciUlCfm.prbPercQci[idx].prbPercQci =
163 ((measCb->avgPrbQciUl.prbUsage[idx].prbUsage * 100) /
167 if(measCb->measReq.measType & LRG_L2MEAS_RA_PREAMBLE)
169 cfm->raPrmbsCfm.dedPreambles = cell->raPrmbs.dedPream;
170 cfm->raPrmbsCfm.randSelPreLowRange = cell->raPrmbs.preamGrpA;
171 cfm->raPrmbsCfm.randSelPreHighRange = cell->raPrmbs.preamGrpB;
172 cell->raPrmbs.dedPream = 0;
173 cell->raPrmbs.preamGrpA = 0;
174 cell->raPrmbs.preamGrpB = 0;
176 if(measCb->measReq.measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_DL)
178 cfm->numUeQciDlCfm.numQci = measInfo->nmbActvUeQciDl.numQci;
179 sampOc = (measTime / measInfo->nmbActvUeQciDl.sampPrd);
183 if (measCb->measReq.nmbActvUeQciDl.numQci)
185 for(idx = 0; idx < measCb->measReq.nmbActvUeQciDl.numQci; idx++)
187 qciVal = measCb->measReq.nmbActvUeQciDl.qci[idx];
189 cell->qciArray[qciVal].dlTotal_UeCount +=
190 cell->qciArray[qciVal].dlUeCount;
191 cfm->numUeQciDlCfm.numActvUeQci[idx].numActvUeQci =
192 cell->qciArray[qciVal].dlTotal_UeCount / sampOc;
193 cfm->numUeQciDlCfm.numActvUeQci[idx].qciValue = qciVal;
195 RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,
196 "L2_MEAS:CFM DL QCI %u TOTAL Count %lu Active UE %d ",
197 qciVal,cell->qciArray[qciVal].dlTotal_UeCount,
198 cfm->numUeQciDlCfm.numActvUeQci[idx].numActvUeQci);
200 cell->qciArray[qciVal].dlTotal_UeCount = 0;
206 for(qciVal = 1; qciVal < LRG_MAX_QCI_PER_REQ; qciVal++)
209 cell->qciArray[qciVal].dlTotal_UeCount +=
210 cell->qciArray[qciVal].dlUeCount;
211 if (cell->qciArray[qciVal].dlTotal_UeCount)
213 cfm->numUeQciDlCfm.numActvUeQci[idx].numActvUeQci =
214 cell->qciArray[qciVal].dlTotal_UeCount / sampOc;
215 cfm->numUeQciDlCfm.numActvUeQci[idx].qciValue = qciVal;
217 RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,
218 "L2_MEAS:CFM DL QCI %u TOTAL Count %lu Active UE %d ",
219 qciVal,cell->qciArray[qciVal].dlTotal_UeCount,
220 cfm->numUeQciDlCfm.numActvUeQci[idx].numActvUeQci);
222 cell->qciArray[qciVal].dlTotal_UeCount = 0;
226 cfm->numUeQciDlCfm.numQci = idx;
230 if(measCb->measReq.measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_UL)
232 cfm->numUeQciUlCfm.numQci = measInfo->nmbActvUeQciUl.numQci;
233 sampOc = (measTime / measInfo->nmbActvUeQciUl.sampPrd);
238 if (measCb->measReq.nmbActvUeQciUl.numQci)
240 for(idx = 0; idx < measCb->measReq.nmbActvUeQciUl.numQci; idx++)
242 cell->qciArray[qciVal].ulTotal_UeCount +=
243 cell->qciArray[qciVal].ulUeCount;
244 qciVal = measCb->measReq.nmbActvUeQciUl.qci[idx];
245 cfm->numUeQciUlCfm.numActvUeQci[idx].numActvUeQci =
246 cell->qciArray[qciVal].ulTotal_UeCount/ sampOc;
247 cfm->numUeQciUlCfm.numActvUeQci[idx].qciValue = qciVal;
249 RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,
250 "L2_MEAS:CFM UL QCI %d TOTAL Count %lu Active UE %d ",
251 qciVal,cell->qciArray[qciVal].ulTotal_UeCount,
252 cfm->numUeQciUlCfm.numActvUeQci[idx].numActvUeQci);
254 cell->qciArray[qciVal].ulTotal_UeCount = 0;
260 for(qciVal = 1; qciVal < LRG_MAX_QCI_PER_REQ; qciVal++)
262 cell->qciArray[qciVal].ulTotal_UeCount +=
263 cell->qciArray[qciVal].ulUeCount;
264 if (cell->qciArray[qciVal].ulTotal_UeCount)
266 cfm->numUeQciUlCfm.numActvUeQci[idx].numActvUeQci =
267 cell->qciArray[qciVal].ulTotal_UeCount/ sampOc;
268 cfm->numUeQciUlCfm.numActvUeQci[idx].qciValue = qciVal;
270 RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,
271 "L2_MEAS:CFM UL QCI %d TOTAL Count %lu Active UE %d ",
272 qciVal,cell->qciArray[qciVal].ulTotal_UeCount,
273 cfm->numUeQciUlCfm.numActvUeQci[idx].numActvUeQci);
275 cell->qciArray[qciVal].ulTotal_UeCount = 0;
279 cfm->numUeQciUlCfm.numQci = idx;
283 if(measCb->measReq.measType & LRG_L2MEAS_TB_TRANS_DL_COUNT)
285 cfm->tbTransDlTotalCnt = cell->dlUlTbCnt.tbTransDlTotalCnt;
286 cell->dlUlTbCnt.tbTransDlTotalCnt = 0;
288 if(measCb->measReq.measType & LRG_L2MEAS_TB_TRANS_DL_FAULTY_COUNT)
290 cfm->tbTransDlFaulty = cell->dlUlTbCnt.tbTransDlFaulty;
291 cell->dlUlTbCnt.tbTransDlFaulty = 0;
293 if(measCb->measReq.measType & LRG_L2MEAS_TB_TRANS_UL_COUNT)
295 cfm->tbTransUlTotalCnt = cell->dlUlTbCnt.tbTransUlTotalCnt;
296 cell->dlUlTbCnt.tbTransUlTotalCnt = 0;
298 if(measCb->measReq.measType & LRG_L2MEAS_TB_TRANS_UL_FAULTY_COUNT)
300 cfm->tbTransUlFaulty = cell->dlUlTbCnt.tbTransUlFaulty;
301 cell->dlUlTbCnt.tbTransUlFaulty = 0;
304 measCb->dlTotalBw = 0;
305 measCb->ulTotalBw = 0;
308 } /* rgSchFillL2MeasCfm */
310 /** @brief This function sends the L2 measurement confirm to LM
315 * Function: rgSchL2mSndCfm
317 * @param [in] Pst *pst
318 * @param [in] RgSchL2MeasCb *measCb
319 * @param [in] Bool isErr
323 PUBLIC S16 rgSchL2mSndCfm
326 RgSchL2MeasCb *measCb,
327 LrgSchMeasReqInfo *measInfo,
331 PUBLIC S16 rgSchL2mSndCfm(pst, measCb, measInfo, isErr)
333 RgSchL2MeasCb *measCb;
334 LrgSchMeasReqInfo *measInfo;
338 LrgSchMeasCfmInfo cfm;
342 cmMemset((U8 *)&cfm, (U8)0, sizeof(LrgSchMeasCfmInfo));
343 cfm.hdr.transId = measInfo->hdr.transId;
344 cfm.measType = measInfo->measType;
345 cfm.cellId = measInfo->cellId;
346 cfm.cfm.status = LCM_PRIM_OK;
349 cfm.cfm.status = LCM_PRIM_NOK;
350 cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL;
351 RgMiLrgSchL2MeasCfm(pst, &cfm);
355 } /* rgSchL2mSndCfm */
357 /** @brief This function fills the LM confirmation pst structure
361 * Function: rgSchL2mFillCfmPst
363 * @param [in] Pst *pst
364 * @param [out] Pst *cfmPst
365 * @param [in] LrgSchMeasReqInfo *measInfo
369 PUBLIC Void rgSchL2mFillCfmPst
373 LrgSchMeasReqInfo *measInfo
376 PUBLIC Void rgSchL2mFillCfmPst(pst, cfmPst, measInfo)
379 LrgSchMeasReqInfo *measInfo;
384 TRC3(rgSchL2mFillCfmPst)
387 cfmPst->srcEnt = pst->dstEnt;
388 cfmPst->srcInst = pst->dstInst;
389 cfmPst->srcProcId = pst->dstProcId;
390 cfmPst->dstEnt = pst->srcEnt;
391 cfmPst->dstInst = pst->srcInst;
392 cfmPst->dstProcId = pst->srcProcId;
394 cfmPst->selector = measInfo->hdr.response.selector;
395 cfmPst->prior = measInfo->hdr.response.prior;
396 cfmPst->route = measInfo->hdr.response.route;
397 cfmPst->region = measInfo->hdr.response.mem.region;
398 cfmPst->pool = measInfo->hdr.response.mem.pool;
401 } /* rgSchL2mFillCfmPst */
403 /** @brief This function inserts the MeasCb in to data base
407 * Function: rgSchL2mInsertMeasCb
409 * @param [in] RgSchCellCb *cell
410 * @param [in] RgSchL2MeasCb *measCb
411 * @param [in] LrgSchMeasReqInfo *measInfo
417 PRIVATE S16 rgSchL2mInsertMeasCb
420 RgSchL2MeasCb *measCb,
421 LrgSchMeasReqInfo *measInfo
424 PRIVATE S16 rgSchL2mInsertMeasCb(cell, measCb, measInfo)
426 RgSchL2MeasCb *measCb;
427 LrgSchMeasReqInfo *measInfo;
431 RgSchL2MeasCb *oldMeasCb;
434 TRC3(rgSchL2mInsertMeasCb)
436 * 1. Check if l2mList has any entries.
438 * 1. Take the first entrie's time period and find the diff with
440 * 2. If the diff is > measInfo->timePeriod then insert before this
442 * 3. Else take the next entry in list
443 * 4. If reached without adding to list . Append at the end of list.
444 * 3. If no entries in l2mList add at the first.
446 lnk = cell->l2mList.first;
447 node = &measCb->measLnk;
448 node->node = (PTR)measCb;
451 oldMeasCb = (RgSchL2MeasCb *)lnk->node;
452 diffTime = (oldMeasCb->measReq.timePrd -
453 (RGSCH_CALC_SF_DIFF(cell->crntTime, oldMeasCb->startTime)));
454 if (diffTime > measInfo->timePrd)
456 cell->l2mList.crnt = lnk;
457 cmLListInsCrnt(&(cell->l2mList), node);
465 cmLListAdd2Tail(&(cell->l2mList), node);
467 } /* rgSchL2mInsertMeasCb */
469 /** @brief This function calculates the Down link prb count
474 * Function: rgSchL2CalDlPrbCount
476 * @param [in] RgSchCellCb *cell
479 PRIVATE Void rgSchL2CalDlPrbCount
484 PRIVATE Void rgSchL2CalDlPrbCount(cell)
489 RgSchDlSf *sf = NULLP;
494 TRC3(rgSchL2CalDlPrbCount)
496 frm = cell->crntTime;
497 RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
498 sf = rgSCHUtlSubFrmGet(cell, frm);
500 idx = (cell->crntTime.slot + RG_SCH_CMN_DL_DELTA) %
501 RGSCH_NUM_SUB_FRAMES;
502 if(RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx))
504 cell->avgPrbDl.prbCount += sf->bwAssigned;
505 dlPrbCnt += sf->bwAssigned;
508 cell->avgPrbDl.prbCount += sf->bwAssigned;
513 /** @brief This function calculates the up link prb count
518 * Function: rgSchL2CalUlPrbCount
520 * @param [in] RgSchCellCb *cell
523 PRIVATE Void rgSchL2CalUlPrbCount
528 PRIVATE Void rgSchL2CalUlPrbCount(cell)
532 RgSchUlSf *sf = NULLP;
533 RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
538 TRC3(rgSchL2CalUlPrbCount)
541 idx = cellUl->schdIdx;
542 if(idx < cellUl->numUlSubfrms)
544 sf = &cellUl->ulSfArr[idx];
545 cell->avgPrbUl.prbCount += sf->totPrb;
548 sf = &cellUl->ulSfArr[cellUl->schdIdx];
549 cell->avgPrbUl.prbCount += sf->totPrb;
553 /** @brief This function allocates memory from the heap
557 * Function: rgSchL2mAllocMeasCb
559 * @param [in] RgSchCellCb *cell
560 * @param [in] RgSchL2MeasCb *measInfo
561 * @param [out] RgSchErrInfo *err
562 * @return RgSchL2MeasCb *
565 PRIVATE RgSchL2MeasCb * rgSchL2mAllocMeasCb
568 LrgSchMeasReqInfo *measInfo,
572 PRIVATE RgSchL2MeasCb * rgSchL2mAllocMeasCb(cell, measInfo, err)
574 LrgSchMeasReqInfo *measInfo;
578 RgSchL2MeasCb *measCb = NULLP;
579 Inst inst = cell->instIdx;
581 TRC3(rgSchL2mAllocMeasCb)
583 if((rgSCHUtlAllocSBuf(inst, (Data **)&measCb,
584 sizeof(RgSchL2MeasCb))) == RFAILED)
586 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSchL2mAllocMeasCb():"
587 "Allocation of RgSchL2MeasCb failed");
590 cmMemcpy((U8 *)&measCb->measReq, (U8 *)measInfo, sizeof(LrgSchMeasReqInfo));
591 RGSCHCPYTIMEINFO(cell->crntTime, measCb->startTime);
593 measCb->dlTotalBw = 0;
594 measCb->ulTotalBw = 0;
597 } /* rgSchL2mAllocMeasCb */
600 * @brief Layer Manager Measurement request handler.
604 * Function : rgSchL2mMeasReq
606 * This function handles measurement request received at scheduler instance
607 * from the Layer Manager.
608 * -# Measurement request will be stored in the list in ascending order of
611 * @param[in] Pst *pst, the post structure
612 * @param[in] LrgSchMeasReqInfo *measInfo, the measurement request structure
613 * @param[out] RgSchErrInfo *err, error information
619 PUBLIC S16 rgSchL2mMeasReq
622 LrgSchMeasReqInfo *measInfo,
626 PUBLIC S16 rgSchL2mMeasReq(cell, measInfo, err)
628 LrgSchMeasReqInfo *measInfo;
632 RgSchL2MeasCb *measCb;
636 TRC3(rgSchL2mMeasReq)
639 if ((measCb = rgSchL2mAllocMeasCb(cell, measInfo, err)) == NULLP)
641 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ,
642 RGSCHERR_SCH_ALLOC_FAILED);
643 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "rgSchL2mMeasReq():"
644 "Allocation of RgSchL2MeasCb failed");
647 /*cmMemcpy((U8 *)&measCb->measReq, (CONSTANT U8 *)measInfo,\
648 sizeof(LrgSchMeasReqInfo));*/
649 rgSchL2mInsertMeasCb(cell, measCb, measInfo);
651 if (measInfo->timePrd == 0)
653 cell->sndL2Meas = FALSE;
654 if (measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_DL)
656 for (idx = 0; idx < measInfo->avgPrbQciDl.numQci; idx++)
658 qciVal = measInfo->avgPrbQciDl.qci[idx];
659 cell->qciArray[qciVal].qci = qciVal;
662 if (measInfo->measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_DL)
664 for (idx = 0; idx < measInfo->nmbActvUeQciDl.numQci; idx++)
666 qciVal = measInfo->nmbActvUeQciDl.qci[idx];
667 cell->qciArray[qciVal].qci = qciVal;
670 if (measInfo->measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_UL)
672 for (idx = 0; idx < measInfo->nmbActvUeQciUl.numQci; idx++)
674 qciVal = measInfo->nmbActvUeQciUl.qci[idx];
675 cell->qciArray[qciVal].qci = qciVal;
679 /* Here post the message to MAC */
680 if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
682 RgInfL2MeasReq measReq;
684 cmMemset((U8 *)&measReq, 0, sizeof(RgInfL2MeasReq));
685 measReq.transId = measInfo->hdr.transId;
686 measReq.measType = measInfo->measType;
687 measReq.timePrd = measInfo->timePrd;
688 measReq.cellId = measInfo->cellId;
689 measReq.t.prbReq.numQci = measInfo->avgPrbQciUl.numQci;
690 for (idx = 0; idx < measInfo->avgPrbQciUl.numQci; idx++)
692 measReq.t.prbReq.qci[idx] = measInfo->avgPrbQciUl.qci[idx];
694 /* Send measReq to MAC */
695 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst);
696 RgSchMacL2Meas(&pst, &measReq);
699 } /* rgSchL2mMeasReq */
702 * @brief This function calculates the measurement for differnt measurement type
703 * and send the end result to the layer manager
707 * Function : rgSCHL2Meas
709 * @param[in] RgSchCellCb *cell
715 PUBLIC S16 rgSCHL2Meas
721 PUBLIC S16 rgschL2Meas(cell,isCalrCrcInd)
726 CmLList *node = NULLP;
727 RgSchL2MeasCb *measCb = NULLP;
729 LrgSchMeasCfmInfo measCfm;
735 Bool isDlDataAllowed;
742 node = cell->l2mList.first;
743 cmMemset((U8 *)&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
746 measCb = (RgSchL2MeasCb *)node->node;
748 if(cell->crntTime.sfn == 1023 && cell->crntTime.slot == 9)
750 /*calculates diff between crnt time and start time*/
751 meas = RGSCH_CALC_SFN_SF_DIFF(cell->crntTime,
752 measCb->sfnCycle, measCb->startTime);
757 /*calculates diff between crnt time and start time*/
758 meas = RGSCH_CALC_SFN_SF_DIFF(cell->crntTime,
759 measCb->sfnCycle, measCb->startTime);
762 if (cell->sndL2Meas || meas == measCb->measReq.timePrd)
765 rem = meas % RGSCH_NUM_SUB_FRAMES;
766 /* Get the total number of DL and UL subframes within the reporting period*/
767 numDlSf = (meas / RGSCH_NUM_SUB_FRAMES) * rgSchTddNumDlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
768 numUlSf = (meas / RGSCH_NUM_SUB_FRAMES) * rgSchTddNumUlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
770 sfIdx = (measCb->startTime.slot + 1) % RGSCH_NUM_SUB_FRAMES;
774 isDlDataAllowed = RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, sfIdx);
779 else if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx][sfIdx] ==
780 RG_SCH_TDD_UL_SUBFRAME)
784 sfIdx = (sfIdx + 1) % RGSCH_NUM_SUB_FRAMES;
788 measCb->dlTotalBw = numDlSf * cell->bwCfg.dlTotalBw;
789 measCb->ulTotalBw = numUlSf * cell->bwCfg.ulTotalBw;
792 measCb->dlTotalBw = meas * cell->bwCfg.dlTotalBw;
793 measCb->ulTotalBw = meas * cell->bwCfg.ulTotalBw;
795 if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL))
799 rgSchFillL2MeasCfm(cell, measCb, &measCfm, meas);
808 rgSchFillL2MeasCfm(cell, measCb, &measCfm, meas);
810 RgMiLrgSchL2MeasCfm(&(rgSchCb[cell->instIdx].rgSchInit.lmPst),
812 cmMemset((U8 *)&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
814 /* Delete this measCb from the list */
815 if(measCb->measReq.timePrd > 0)
817 cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
818 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,
819 sizeof(RgSchL2MeasCb));
821 else/*do not delete measCb, will use for next measurement*/
823 measCb->startTime = cell->crntTime;
824 measCb->sfnCycle = 0;
825 measCb->cfmRcvd = FALSE;
826 cmMemset((U8 *)&measCb->avgPrbQciUl, 0, sizeof(LrgAvgPrbQCICfm));
827 cell->sndL2Meas = FALSE;
829 /* ccpu00117052 - MOD - Passing double pointer
830 for proper NULLP assignment*/
834 /* Just update the AVERAGE UL PRB counter here and return
835 * if the caller is CRCIndication() and the UL scheduling happens
837 #ifdef RG_ULSCHED_AT_CRC
840 if(measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_UL)
842 rgSchL2CalUlPrbCount(cell);
847 /* UL PRB counter gets updated as a part of CRC indication
848 * if the UL scheduling happens there */
849 if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_UL))
851 rgSchL2CalUlPrbCount(cell);
854 if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_DL))
856 rgSchL2CalDlPrbCount(cell);
858 if(measCb->measReq.measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_DL)
860 sfDiff = RGSCH_CALC_SF_DIFF(cell->crntTime, measCb->startTime);
862 if((sfDiff % measCb->measReq.nmbActvUeQciDl.sampPrd) == 0)
864 if (measCb->measReq.nmbActvUeQciDl.numQci)
866 for (idx = 0; idx < measCb->measReq.nmbActvUeQciDl.numQci;
869 qciVal = measCb->measReq.nmbActvUeQciDl.qci[idx];
870 cell->qciArray[qciVal].dlTotal_UeCount +=
871 cell->qciArray[qciVal].dlUeCount;
876 for (qciVal = 1; qciVal < LRG_MAX_QCI_PER_REQ; qciVal++)
878 cell->qciArray[qciVal].dlTotal_UeCount +=
879 cell->qciArray[qciVal].dlUeCount;
884 if(measCb->measReq.measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_UL)
886 sfDiff = RGSCH_CALC_SF_DIFF(cell->crntTime , measCb->startTime);
887 if((sfDiff % measCb->measReq.nmbActvUeQciUl.sampPrd) == 0)
889 if (measCb->measReq.nmbActvUeQciUl.numQci)
891 for (idx = 0; idx < measCb->measReq.nmbActvUeQciUl.numQci;
894 qciVal = measCb->measReq.nmbActvUeQciUl.qci[idx];
895 cell->qciArray[qciVal].ulTotal_UeCount +=
896 cell->qciArray[qciVal].ulUeCount;
901 for (qciVal = 1; qciVal < LRG_MAX_QCI_PER_REQ; qciVal++)
903 cell->qciArray[qciVal].ulTotal_UeCount +=
904 cell->qciArray[qciVal].ulUeCount;
913 #endif /* LTE_L2_MEAS */
914 /**********************************************************************
917 **********************************************************************/