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 "envopt.h" /* environment options */
37 #include "envdep.h" /* environment dependent */
38 #include "envind.h" /* environment independent */
39 #include "gen.h" /* general layer */
40 #include "ssi.h" /* system service interface */
41 #include "cm_hash.h" /* common hash list */
42 #include "cm_llist.h" /* common linked list library */
43 #include "cm_err.h" /* common error */
44 #include "cm_lte.h" /* common LTE */
51 #include "rg_sch_cmn.h"
52 #include "rg_sch_inf.h" /* typedefs for Scheduler */
53 #include "rg_sch_err.h"
54 #include "rl_interface.h"
55 #include "rl_common.h"
57 /* header/extern include files (.x) */
58 #include "gen.x" /* general layer typedefs */
59 #include "ssi.x" /* system services typedefs */
60 #include "cm5.x" /* common timers */
61 #include "cm_hash.x" /* common hash list */
62 #include "cm_lib.x" /* common library */
63 #include "cm_llist.x" /* common linked list */
64 #include "cm_mblk.x" /* memory management */
65 #include "cm_tkns.x" /* common tokens */
66 #include "cm_lte.x" /* common tokens */
67 #include "tfu.x" /* TFU types */
68 #include "lrg.x" /* layer management typedefs for MAC */
69 #include "rgr.x" /* layer management typedefs for MAC */
70 #include "rgm.x" /* layer management typedefs for MAC */
71 #include "rg_sch_inf.x" /* typedefs for Scheduler */
72 #include "rg_sch.x" /* typedefs for Scheduler */
73 #include "rg_sch_cmn.x" /* typedefs for Scheduler */
78 static const char* RLOG_MODULE_NAME="MAC";
79 static int RLOG_MODULE_ID=4096;
80 static int RLOG_FILE_ID=166;
82 PRIVATE S16 rgSchL2mInsertMeasCb ARGS((
84 RgSchL2MeasCb *measCb,
85 LrgSchMeasReqInfo *measInfo ));
87 PRIVATE RgSchL2MeasCb * rgSchL2mAllocMeasCb ARGS((
89 LrgSchMeasReqInfo *measInfo,
92 /* Function definitions */
94 /** @brief This function fills the L2 measurement confirm structure
98 * Function: rgSchFillL2MeasCfm
100 * @param [in] RgSchCellCb *cell
101 * @param [in] RgSchL2MeasCb *measCb
102 * @param [out] LrgSchMeasCfmInfo *measCfm
103 * @param [in] measTime
107 PUBLIC S16 rgSchFillL2MeasCfm
110 RgSchL2MeasCb *measCb,
111 LrgSchMeasCfmInfo *cfm,
115 PUBLIC S16 rgSchFillL2MeasCfm(cell, measCb, cfm, measTime)
117 RgSchL2MeasCb *measCb;
118 LrgSchMeasCfmInfo *cfm;
123 LrgSchMeasReqInfo *measInfo;
127 TRC3(rgSchFillL2MeasCfm)
129 measInfo = &measCb->measReq;
131 cfm->hdr.transId = measInfo->hdr.transId;
132 cfm->measType = measInfo->measType;
133 cfm->cellId = measInfo->cellId;
134 cfm->cfm.status = LCM_PRIM_OK;
135 if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_DL) &&
138 cfm->avgPrbDl.prbPerc = ((cell->avgPrbDl.prbCount * 100) /
140 /* Resetting the prbCount to 0, fix for ccpu00125002 */
141 cell->avgPrbDl.prbCount = 0;
143 if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_UL) &&
146 cfm->avgPrbUl.prbPerc = ((cell->avgPrbUl.prbCount * 100) /
148 /* Resetting the prbCount to 0, fix for ccpu00125002 */
149 cell->avgPrbUl.prbCount = 0;
151 if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_PER_QCI_DL) &&
154 cfm->avgPrbQciDlCfm.numQci = measCb->measReq.avgPrbQciDl.numQci;
155 for(idx = 0; idx < measCb->measReq.avgPrbQciDl.numQci; idx++)
157 qciVal = measCb->measReq.avgPrbQciDl.qci[idx];
158 cfm->avgPrbQciDlCfm.prbPercQci[idx].prbPercQci =
159 ((cell->qciArray[qciVal].dlPrbCount * 100) /
161 cfm->avgPrbQciDlCfm.prbPercQci[idx].qciValue = qciVal;
162 cell->qciArray[qciVal].dlPrbCount = 0;
165 if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL) &&
168 cfm->avgPrbQciUlCfm.numQci = measCb->measReq.avgPrbQciUl.numQci;
169 for(idx = 0; idx < measCb->measReq.avgPrbQciUl.numQci; idx++)
171 cfm->avgPrbQciUlCfm.prbPercQci[idx].qciValue =
172 measCb->avgPrbQciUl.prbUsage[idx].qciValue;
174 if(measCb->avgPrbQciUl.prbUsage[idx].prbUsage > measCb->ulTotalBw)
176 measCb->avgPrbQciUl.prbUsage[idx].prbUsage = measCb->ulTotalBw;
179 cfm->avgPrbQciUlCfm.prbPercQci[idx].prbPercQci =
180 ((measCb->avgPrbQciUl.prbUsage[idx].prbUsage * 100) /
184 if(measCb->measReq.measType & LRG_L2MEAS_RA_PREAMBLE)
186 cfm->raPrmbsCfm.dedPreambles = cell->raPrmbs.dedPream;
187 cfm->raPrmbsCfm.randSelPreLowRange = cell->raPrmbs.preamGrpA;
188 cfm->raPrmbsCfm.randSelPreHighRange = cell->raPrmbs.preamGrpB;
189 cell->raPrmbs.dedPream = 0;
190 cell->raPrmbs.preamGrpA = 0;
191 cell->raPrmbs.preamGrpB = 0;
193 if(measCb->measReq.measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_DL)
195 cfm->numUeQciDlCfm.numQci = measInfo->nmbActvUeQciDl.numQci;
196 sampOc = (measTime / measInfo->nmbActvUeQciDl.sampPrd);
200 if (measCb->measReq.nmbActvUeQciDl.numQci)
202 for(idx = 0; idx < measCb->measReq.nmbActvUeQciDl.numQci; idx++)
204 qciVal = measCb->measReq.nmbActvUeQciDl.qci[idx];
206 cell->qciArray[qciVal].dlTotal_UeCount +=
207 cell->qciArray[qciVal].dlUeCount;
208 cfm->numUeQciDlCfm.numActvUeQci[idx].numActvUeQci =
209 cell->qciArray[qciVal].dlTotal_UeCount / sampOc;
210 cfm->numUeQciDlCfm.numActvUeQci[idx].qciValue = qciVal;
212 RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,
213 "L2_MEAS:CFM DL QCI %u TOTAL Count %lu Active UE %d ",
214 qciVal,cell->qciArray[qciVal].dlTotal_UeCount,
215 cfm->numUeQciDlCfm.numActvUeQci[idx].numActvUeQci);
217 cell->qciArray[qciVal].dlTotal_UeCount = 0;
223 for(qciVal = 1; qciVal < LRG_MAX_QCI_PER_REQ; qciVal++)
226 cell->qciArray[qciVal].dlTotal_UeCount +=
227 cell->qciArray[qciVal].dlUeCount;
228 if (cell->qciArray[qciVal].dlTotal_UeCount)
230 cfm->numUeQciDlCfm.numActvUeQci[idx].numActvUeQci =
231 cell->qciArray[qciVal].dlTotal_UeCount / sampOc;
232 cfm->numUeQciDlCfm.numActvUeQci[idx].qciValue = qciVal;
234 RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,
235 "L2_MEAS:CFM DL QCI %u TOTAL Count %lu Active UE %d ",
236 qciVal,cell->qciArray[qciVal].dlTotal_UeCount,
237 cfm->numUeQciDlCfm.numActvUeQci[idx].numActvUeQci);
239 cell->qciArray[qciVal].dlTotal_UeCount = 0;
243 cfm->numUeQciDlCfm.numQci = idx;
247 if(measCb->measReq.measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_UL)
249 cfm->numUeQciUlCfm.numQci = measInfo->nmbActvUeQciUl.numQci;
250 sampOc = (measTime / measInfo->nmbActvUeQciUl.sampPrd);
255 if (measCb->measReq.nmbActvUeQciUl.numQci)
257 for(idx = 0; idx < measCb->measReq.nmbActvUeQciUl.numQci; idx++)
259 cell->qciArray[qciVal].ulTotal_UeCount +=
260 cell->qciArray[qciVal].ulUeCount;
261 qciVal = measCb->measReq.nmbActvUeQciUl.qci[idx];
262 cfm->numUeQciUlCfm.numActvUeQci[idx].numActvUeQci =
263 cell->qciArray[qciVal].ulTotal_UeCount/ sampOc;
264 cfm->numUeQciUlCfm.numActvUeQci[idx].qciValue = qciVal;
266 RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,
267 "L2_MEAS:CFM UL QCI %d TOTAL Count %lu Active UE %d ",
268 qciVal,cell->qciArray[qciVal].ulTotal_UeCount,
269 cfm->numUeQciUlCfm.numActvUeQci[idx].numActvUeQci);
271 cell->qciArray[qciVal].ulTotal_UeCount = 0;
277 for(qciVal = 1; qciVal < LRG_MAX_QCI_PER_REQ; qciVal++)
279 cell->qciArray[qciVal].ulTotal_UeCount +=
280 cell->qciArray[qciVal].ulUeCount;
281 if (cell->qciArray[qciVal].ulTotal_UeCount)
283 cfm->numUeQciUlCfm.numActvUeQci[idx].numActvUeQci =
284 cell->qciArray[qciVal].ulTotal_UeCount/ sampOc;
285 cfm->numUeQciUlCfm.numActvUeQci[idx].qciValue = qciVal;
287 RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,
288 "L2_MEAS:CFM UL QCI %d TOTAL Count %lu Active UE %d ",
289 qciVal,cell->qciArray[qciVal].ulTotal_UeCount,
290 cfm->numUeQciUlCfm.numActvUeQci[idx].numActvUeQci);
292 cell->qciArray[qciVal].ulTotal_UeCount = 0;
296 cfm->numUeQciUlCfm.numQci = idx;
300 if(measCb->measReq.measType & LRG_L2MEAS_TB_TRANS_DL_COUNT)
302 cfm->tbTransDlTotalCnt = cell->dlUlTbCnt.tbTransDlTotalCnt;
303 cell->dlUlTbCnt.tbTransDlTotalCnt = 0;
305 if(measCb->measReq.measType & LRG_L2MEAS_TB_TRANS_DL_FAULTY_COUNT)
307 cfm->tbTransDlFaulty = cell->dlUlTbCnt.tbTransDlFaulty;
308 cell->dlUlTbCnt.tbTransDlFaulty = 0;
310 if(measCb->measReq.measType & LRG_L2MEAS_TB_TRANS_UL_COUNT)
312 cfm->tbTransUlTotalCnt = cell->dlUlTbCnt.tbTransUlTotalCnt;
313 cell->dlUlTbCnt.tbTransUlTotalCnt = 0;
315 if(measCb->measReq.measType & LRG_L2MEAS_TB_TRANS_UL_FAULTY_COUNT)
317 cfm->tbTransUlFaulty = cell->dlUlTbCnt.tbTransUlFaulty;
318 cell->dlUlTbCnt.tbTransUlFaulty = 0;
321 measCb->dlTotalBw = 0;
322 measCb->ulTotalBw = 0;
325 } /* rgSchFillL2MeasCfm */
327 /** @brief This function sends the L2 measurement confirm to LM
332 * Function: rgSchL2mSndCfm
334 * @param [in] Pst *pst
335 * @param [in] RgSchL2MeasCb *measCb
336 * @param [in] Bool isErr
340 PUBLIC S16 rgSchL2mSndCfm
343 RgSchL2MeasCb *measCb,
344 LrgSchMeasReqInfo *measInfo,
348 PUBLIC S16 rgSchL2mSndCfm(pst, measCb, measInfo, isErr)
350 RgSchL2MeasCb *measCb;
351 LrgSchMeasReqInfo *measInfo;
355 LrgSchMeasCfmInfo cfm;
359 cmMemset((U8 *)&cfm, (U8)0, sizeof(LrgSchMeasCfmInfo));
360 cfm.hdr.transId = measInfo->hdr.transId;
361 cfm.measType = measInfo->measType;
362 cfm.cellId = measInfo->cellId;
363 cfm.cfm.status = LCM_PRIM_OK;
366 cfm.cfm.status = LCM_PRIM_NOK;
367 cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL;
368 RgMiLrgSchL2MeasCfm(pst, &cfm);
372 } /* rgSchL2mSndCfm */
374 /** @brief This function fills the LM confirmation pst structure
378 * Function: rgSchL2mFillCfmPst
380 * @param [in] Pst *pst
381 * @param [out] Pst *cfmPst
382 * @param [in] LrgSchMeasReqInfo *measInfo
386 PUBLIC Void rgSchL2mFillCfmPst
390 LrgSchMeasReqInfo *measInfo
393 PUBLIC Void rgSchL2mFillCfmPst(pst, cfmPst, measInfo)
396 LrgSchMeasReqInfo *measInfo;
401 TRC3(rgSchL2mFillCfmPst)
404 cfmPst->srcEnt = pst->dstEnt;
405 cfmPst->srcInst = pst->dstInst;
406 cfmPst->srcProcId = pst->dstProcId;
407 cfmPst->dstEnt = pst->srcEnt;
408 cfmPst->dstInst = pst->srcInst;
409 cfmPst->dstProcId = pst->srcProcId;
411 cfmPst->selector = measInfo->hdr.response.selector;
412 cfmPst->prior = measInfo->hdr.response.prior;
413 cfmPst->route = measInfo->hdr.response.route;
414 cfmPst->region = measInfo->hdr.response.mem.region;
415 cfmPst->pool = measInfo->hdr.response.mem.pool;
418 } /* rgSchL2mFillCfmPst */
420 /** @brief This function inserts the MeasCb in to data base
424 * Function: rgSchL2mInsertMeasCb
426 * @param [in] RgSchCellCb *cell
427 * @param [in] RgSchL2MeasCb *measCb
428 * @param [in] LrgSchMeasReqInfo *measInfo
434 PRIVATE S16 rgSchL2mInsertMeasCb
437 RgSchL2MeasCb *measCb,
438 LrgSchMeasReqInfo *measInfo
441 PRIVATE S16 rgSchL2mInsertMeasCb(cell, measCb, measInfo)
443 RgSchL2MeasCb *measCb;
444 LrgSchMeasReqInfo *measInfo;
448 RgSchL2MeasCb *oldMeasCb;
451 TRC3(rgSchL2mInsertMeasCb)
453 * 1. Check if l2mList has any entries.
455 * 1. Take the first entrie's time period and find the diff with
457 * 2. If the diff is > measInfo->timePeriod then insert before this
459 * 3. Else take the next entry in list
460 * 4. If reached without adding to list . Append at the end of list.
461 * 3. If no entries in l2mList add at the first.
463 lnk = cell->l2mList.first;
464 node = &measCb->measLnk;
465 node->node = (PTR)measCb;
468 oldMeasCb = (RgSchL2MeasCb *)lnk->node;
469 diffTime = (oldMeasCb->measReq.timePrd -
470 (RGSCH_CALC_SF_DIFF(cell->crntTime, oldMeasCb->startTime)));
471 if (diffTime > measInfo->timePrd)
473 cell->l2mList.crnt = lnk;
474 cmLListInsCrnt(&(cell->l2mList), node);
482 cmLListAdd2Tail(&(cell->l2mList), node);
484 } /* rgSchL2mInsertMeasCb */
486 /** @brief This function calculates the Down link prb count
491 * Function: rgSchL2CalDlPrbCount
493 * @param [in] RgSchCellCb *cell
496 PRIVATE Void rgSchL2CalDlPrbCount
501 PRIVATE Void rgSchL2CalDlPrbCount(cell)
506 RgSchDlSf *sf = NULLP;
511 TRC3(rgSchL2CalDlPrbCount)
513 frm = cell->crntTime;
514 RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
515 sf = rgSCHUtlSubFrmGet(cell, frm);
517 idx = (cell->crntTime.subframe + RG_SCH_CMN_DL_DELTA) %
518 RGSCH_NUM_SUB_FRAMES;
519 if(RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx))
521 cell->avgPrbDl.prbCount += sf->bwAssigned;
522 dlPrbCnt += sf->bwAssigned;
525 cell->avgPrbDl.prbCount += sf->bwAssigned;
530 /** @brief This function calculates the up link prb count
535 * Function: rgSchL2CalUlPrbCount
537 * @param [in] RgSchCellCb *cell
540 PRIVATE Void rgSchL2CalUlPrbCount
545 PRIVATE Void rgSchL2CalUlPrbCount(cell)
549 RgSchUlSf *sf = NULLP;
550 RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
555 TRC3(rgSchL2CalUlPrbCount)
558 idx = cellUl->schdIdx;
559 if(idx < cellUl->numUlSubfrms)
561 sf = &cellUl->ulSfArr[idx];
562 cell->avgPrbUl.prbCount += sf->totPrb;
565 sf = &cellUl->ulSfArr[cellUl->schdIdx];
566 cell->avgPrbUl.prbCount += sf->totPrb;
570 /** @brief This function allocates memory from the heap
574 * Function: rgSchL2mAllocMeasCb
576 * @param [in] RgSchCellCb *cell
577 * @param [in] RgSchL2MeasCb *measInfo
578 * @param [out] RgSchErrInfo *err
579 * @return RgSchL2MeasCb *
582 PRIVATE RgSchL2MeasCb * rgSchL2mAllocMeasCb
585 LrgSchMeasReqInfo *measInfo,
589 PRIVATE RgSchL2MeasCb * rgSchL2mAllocMeasCb(cell, measInfo, err)
591 LrgSchMeasReqInfo *measInfo;
595 RgSchL2MeasCb *measCb = NULLP;
596 Inst inst = cell->instIdx;
598 TRC3(rgSchL2mAllocMeasCb)
600 if((rgSCHUtlAllocSBuf(inst, (Data **)&measCb,
601 sizeof(RgSchL2MeasCb))) == RFAILED)
603 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSchL2mAllocMeasCb():"
604 "Allocation of RgSchL2MeasCb failed");
607 cmMemcpy((U8 *)&measCb->measReq, (U8 *)measInfo, sizeof(LrgSchMeasReqInfo));
608 RGSCHCPYTIMEINFO(cell->crntTime, measCb->startTime);
610 measCb->dlTotalBw = 0;
611 measCb->ulTotalBw = 0;
614 } /* rgSchL2mAllocMeasCb */
617 * @brief Layer Manager Measurement request handler.
621 * Function : rgSchL2mMeasReq
623 * This function handles measurement request received at scheduler instance
624 * from the Layer Manager.
625 * -# Measurement request will be stored in the list in ascending order of
628 * @param[in] Pst *pst, the post structure
629 * @param[in] LrgSchMeasReqInfo *measInfo, the measurement request structure
630 * @param[out] RgSchErrInfo *err, error information
636 PUBLIC S16 rgSchL2mMeasReq
639 LrgSchMeasReqInfo *measInfo,
643 PUBLIC S16 rgSchL2mMeasReq(cell, measInfo, err)
645 LrgSchMeasReqInfo *measInfo;
649 RgSchL2MeasCb *measCb;
653 TRC3(rgSchL2mMeasReq)
656 if ((measCb = rgSchL2mAllocMeasCb(cell, measInfo, err)) == NULLP)
658 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ,
659 RGSCHERR_SCH_ALLOC_FAILED);
660 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "rgSchL2mMeasReq():"
661 "Allocation of RgSchL2MeasCb failed");
664 /*cmMemcpy((U8 *)&measCb->measReq, (CONSTANT U8 *)measInfo,\
665 sizeof(LrgSchMeasReqInfo));*/
666 rgSchL2mInsertMeasCb(cell, measCb, measInfo);
668 if (measInfo->timePrd == 0)
670 cell->sndL2Meas = FALSE;
671 if (measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_DL)
673 for (idx = 0; idx < measInfo->avgPrbQciDl.numQci; idx++)
675 qciVal = measInfo->avgPrbQciDl.qci[idx];
676 cell->qciArray[qciVal].qci = qciVal;
679 if (measInfo->measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_DL)
681 for (idx = 0; idx < measInfo->nmbActvUeQciDl.numQci; idx++)
683 qciVal = measInfo->nmbActvUeQciDl.qci[idx];
684 cell->qciArray[qciVal].qci = qciVal;
687 if (measInfo->measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_UL)
689 for (idx = 0; idx < measInfo->nmbActvUeQciUl.numQci; idx++)
691 qciVal = measInfo->nmbActvUeQciUl.qci[idx];
692 cell->qciArray[qciVal].qci = qciVal;
696 /* Here post the message to MAC */
697 if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
699 RgInfL2MeasReq measReq;
701 cmMemset((U8 *)&measReq, 0, sizeof(RgInfL2MeasReq));
702 measReq.transId = measInfo->hdr.transId;
703 measReq.measType = measInfo->measType;
704 measReq.timePrd = measInfo->timePrd;
705 measReq.cellId = measInfo->cellId;
706 measReq.t.prbReq.numQci = measInfo->avgPrbQciUl.numQci;
707 for (idx = 0; idx < measInfo->avgPrbQciUl.numQci; idx++)
709 measReq.t.prbReq.qci[idx] = measInfo->avgPrbQciUl.qci[idx];
711 /* Send measReq to MAC */
712 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst);
713 RgSchMacL2Meas(&pst, &measReq);
716 } /* rgSchL2mMeasReq */
719 * @brief This function calculates the measurement for differnt measurement type
720 * and send the end result to the layer manager
724 * Function : rgSCHL2Meas
726 * @param[in] RgSchCellCb *cell
732 PUBLIC S16 rgSCHL2Meas
738 PUBLIC S16 rgschL2Meas(cell,isCalrCrcInd)
743 CmLList *node = NULLP;
744 RgSchL2MeasCb *measCb = NULLP;
746 LrgSchMeasCfmInfo measCfm;
752 Bool isDlDataAllowed;
759 node = cell->l2mList.first;
760 cmMemset((U8 *)&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
763 measCb = (RgSchL2MeasCb *)node->node;
765 if(cell->crntTime.sfn == 1023 && cell->crntTime.subframe == 9)
767 /*calculates diff between crnt time and start time*/
768 meas = RGSCH_CALC_SFN_SF_DIFF(cell->crntTime,
769 measCb->sfnCycle, measCb->startTime);
774 /*calculates diff between crnt time and start time*/
775 meas = RGSCH_CALC_SFN_SF_DIFF(cell->crntTime,
776 measCb->sfnCycle, measCb->startTime);
779 if (cell->sndL2Meas || meas == measCb->measReq.timePrd)
782 rem = meas % RGSCH_NUM_SUB_FRAMES;
783 /* Get the total number of DL and UL subframes within the reporting period*/
784 numDlSf = (meas / RGSCH_NUM_SUB_FRAMES) * rgSchTddNumDlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
785 numUlSf = (meas / RGSCH_NUM_SUB_FRAMES) * rgSchTddNumUlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
787 sfIdx = (measCb->startTime.subframe + 1) % RGSCH_NUM_SUB_FRAMES;
791 isDlDataAllowed = RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, sfIdx);
796 else if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx][sfIdx] ==
797 RG_SCH_TDD_UL_SUBFRAME)
801 sfIdx = (sfIdx + 1) % RGSCH_NUM_SUB_FRAMES;
805 measCb->dlTotalBw = numDlSf * cell->bwCfg.dlTotalBw;
806 measCb->ulTotalBw = numUlSf * cell->bwCfg.ulTotalBw;
809 measCb->dlTotalBw = meas * cell->bwCfg.dlTotalBw;
810 measCb->ulTotalBw = meas * cell->bwCfg.ulTotalBw;
812 if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL))
816 rgSchFillL2MeasCfm(cell, measCb, &measCfm, meas);
825 rgSchFillL2MeasCfm(cell, measCb, &measCfm, meas);
827 RgMiLrgSchL2MeasCfm(&(rgSchCb[cell->instIdx].rgSchInit.lmPst),
829 cmMemset((U8 *)&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
831 /* Delete this measCb from the list */
832 if(measCb->measReq.timePrd > 0)
834 cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
835 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,
836 sizeof(RgSchL2MeasCb));
838 else/*do not delete measCb, will use for next measurement*/
840 measCb->startTime = cell->crntTime;
841 measCb->sfnCycle = 0;
842 measCb->cfmRcvd = FALSE;
843 cmMemset((U8 *)&measCb->avgPrbQciUl, 0, sizeof(LrgAvgPrbQCICfm));
844 cell->sndL2Meas = FALSE;
846 /* ccpu00117052 - MOD - Passing double pointer
847 for proper NULLP assignment*/
851 /* Just update the AVERAGE UL PRB counter here and return
852 * if the caller is CRCIndication() and the UL scheduling happens
854 #ifdef RG_ULSCHED_AT_CRC
857 if(measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_UL)
859 rgSchL2CalUlPrbCount(cell);
864 /* UL PRB counter gets updated as a part of CRC indication
865 * if the UL scheduling happens there */
866 if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_UL))
868 rgSchL2CalUlPrbCount(cell);
871 if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_DL))
873 rgSchL2CalDlPrbCount(cell);
875 if(measCb->measReq.measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_DL)
877 sfDiff = RGSCH_CALC_SF_DIFF(cell->crntTime, measCb->startTime);
879 if((sfDiff % measCb->measReq.nmbActvUeQciDl.sampPrd) == 0)
881 if (measCb->measReq.nmbActvUeQciDl.numQci)
883 for (idx = 0; idx < measCb->measReq.nmbActvUeQciDl.numQci;
886 qciVal = measCb->measReq.nmbActvUeQciDl.qci[idx];
887 cell->qciArray[qciVal].dlTotal_UeCount +=
888 cell->qciArray[qciVal].dlUeCount;
893 for (qciVal = 1; qciVal < LRG_MAX_QCI_PER_REQ; qciVal++)
895 cell->qciArray[qciVal].dlTotal_UeCount +=
896 cell->qciArray[qciVal].dlUeCount;
901 if(measCb->measReq.measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_UL)
903 sfDiff = RGSCH_CALC_SF_DIFF(cell->crntTime , measCb->startTime);
904 if((sfDiff % measCb->measReq.nmbActvUeQciUl.sampPrd) == 0)
906 if (measCb->measReq.nmbActvUeQciUl.numQci)
908 for (idx = 0; idx < measCb->measReq.nmbActvUeQciUl.numQci;
911 qciVal = measCb->measReq.nmbActvUeQciUl.qci[idx];
912 cell->qciArray[qciVal].ulTotal_UeCount +=
913 cell->qciArray[qciVal].ulUeCount;
918 for (qciVal = 1; qciVal < LRG_MAX_QCI_PER_REQ; qciVal++)
920 cell->qciArray[qciVal].ulTotal_UeCount +=
921 cell->qciArray[qciVal].ulUeCount;
930 #endif /* LTE_L2_MEAS */
931 /**********************************************************************
934 **********************************************************************/