1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /************************************************************************
25 Desc: C source code for Entry point fucntions
29 **********************************************************************/
32 @brief This module handles the configuration of MAC by RRC and RRM.
35 static const char* RLOG_MODULE_NAME="MAC";
36 static int RLOG_FILE_ID=180;
37 static int RLOG_MODULE_ID=4096;
39 /* header include files -- defines (.h) */
40 #include "common_def.h"
41 #include "lrg.h" /* Layer manager interface includes*/
42 #include "crg.h" /* CRG interface includes*/
43 #include "rgu.h" /* RGU interface includes*/
44 #include "tfu.h" /* TFU interface includes */
45 #include "rg_sch_inf.h" /* SCH interface includes */
46 #include "rg_prg.h" /* PRG (MAC-MAC) interface includes*/
47 #include "rg_env.h" /* MAC environmental includes*/
48 #include "rg.h" /* MAC includes*/
49 #include "rg_err.h" /* MAC error includes*/
51 /* header/extern include files (.x) */
52 #include "rgu.x" /* RGU types */
53 #include "tfu.x" /* RGU types */
54 #include "lrg.x" /* layer management typedefs for MAC */
55 #include "crg.x" /* CRG interface includes */
56 #include "rg_sch_inf.x" /* SCH interface typedefs */
57 #include "rg_prg.x" /* PRG (MAC-MAC) Interface typedefs */
58 #include "du_app_mac_inf.h"
59 #include "rg.x" /* typedefs for MAC */
61 #include "rg_pom_scell.x"
63 /* LTE-MAC Control Block Structure */
64 RgCb rgCb[RG_MAX_INST];
67 static S16 rgCFGVldtCrgDedLcCfg ARGS((Inst inst,CrgLchCfg *lcCfg, RgCellCb **cell,
68 RgUeCb **ue, RgErrInfo *errInfo));
69 static S16 rgCFGVldtCrgCmnLcCfg ARGS((Inst inst,CrgLchCfg *lcCfg, RgCellCb **cell,
71 static S16 rgCFGCrgDedLcCfg ARGS((RgCellCb *cell, RgUeCb *ue,
72 CrgLchCfg *lcCfg, RgErrInfo *errInfo));
73 static S16 rgCFGCrgCmnLcCfg ARGS((Inst inst,RgCellCb *cell, CrgLchCfg *lcCfg,
76 static Void rgCFGFreeCmnLcLst ARGS((RgCellCb *cell));
77 static Void rgCFGFreeUeLst ARGS((RgCellCb *cell));
78 /* Added support for SPS*/
80 static Void rgCFGFreeSpsUeLst ARGS((RgCellCb *cell));
81 #endif /* LTEMAC_SPS */
88 /* forward references */
94 * @brief Validates the cell configuration request from RRC to MAC.
98 * Function : rgCFGVldtCrgCellCfg
101 * - Validate the cell configuration request from RRC to MAC at CFG:
102 * validate the value range for the configured values.
103 * - If validated successfully,
108 * @param[in] Inst inst
109 * @param[in] CrgCellCfg *cellCfg
110 * @param[out] RgErrInfo *errInfo
115 S16 rgCFGVldtCrgCellCfg
122 errInfo->errCause = RGERR_CFG_INVALID_CRG_CELL_CFG;
123 if ((rgCb[inst].cell != NULLP)
124 || rgCb[inst].inactiveCell != NULLP)
126 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Cell already exists");
129 if ((cellCfg->bwCfg.dlTotalBw < RG_MIN_DL_BW
130 || cellCfg->bwCfg.dlTotalBw > RG_MAX_DL_BW)
131 || (cellCfg->bwCfg.ulTotalBw < RG_MIN_UL_BW
132 || cellCfg->bwCfg.ulTotalBw > RG_MAX_UL_BW))
134 RLOG_ARG2(L_ERROR,DBG_CELLID,cellCfg->cellId,
135 "Invalid Bandwidth configuration: ul %d dl %d",
136 cellCfg->bwCfg.ulTotalBw, cellCfg->bwCfg.dlTotalBw);
139 if (cellCfg->rachCfg.maxMsg3Tx < RG_MIN_HQ_TX)
141 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCfg->cellId,
142 "Invalid RACH configuration: maxMsg3Tx %d",cellCfg->rachCfg.maxMsg3Tx);
145 #ifdef TENB_MULT_CELL_SUPPRT
146 if((cellCfg->rguDlSapId > rgCb[inst].numRguSaps) ||
147 (cellCfg->rguUlSapId > rgCb[inst].numRguSaps))
149 RGDBGERRNEW(inst,(rgPBuf(inst), "Invald Sap Id: DL %d UL %d for CellId %d failed\n",
156 errInfo->errCause = RGERR_NONE;
158 } /* rgCFGVldtCrgCellCfg */
162 * @brief Validates the UE configuration request from RRC to MAC.
166 * Function : rgCFGVldtCrgUeCfg
169 * - Validate the UE configuration request from RRC to MAC at CFG:
170 * validate the value range for the configured values.
171 * - If validated successfully,
172 * - Return ROK and pointer to the cell of UE.
176 * @param[in] Inst inst
177 * @param[in] CrgUeCfg *ueCfg
178 * @param[out] RgCellCb **cell
179 * @param[out] RgErrInfo *errInfo
184 S16 rgCFGVldtCrgUeCfg
192 errInfo->errCause = RGERR_CFG_INVALID_CRG_UE_CFG;
193 if ((ueCfg->txMode.pres == PRSNT_NODEF) &&
194 (ueCfg->txMode.tm == CRG_UE_TM_5))
196 RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"Transmission Mode=%d not supported",
201 /* Fetch the Active cell */
202 if(((*cell = rgCb[inst].cell) == NULLP) ||
203 ((*cell)->cellId != ueCfg->cellId))
205 RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti,"Active Cell does not exist for cellId%d",
209 /* Check if Ue already configured */
210 if (rgDBMGetUeCb(*cell, ueCfg->crnti) != NULLP)
212 RLOG_ARG0(L_ERROR,DBG_CRNTI,ueCfg->crnti,"Ue already exists");
216 if (ueCfg->ueUlHqCfg.maxUlHqTx < RG_MIN_HQ_TX)
218 RLOG_ARG1(L_ERROR,DBG_CRNTI,ueCfg->crnti, "Invalid Uplink HARQ config %d ",
219 ueCfg->ueUlHqCfg.maxUlHqTx);
222 #ifdef TENB_MULT_CELL_SUPPRT
223 if((ueCfg->rguDlSapId > rgCb[inst].numRguSaps) ||
224 (ueCfg->rguUlSapId > rgCb[inst].numRguSaps))
226 RGDBGERRNEW(inst,(rgPBuf(inst), "Invald Sap Id: DL %d UL %d for ueId %d failed\n",
234 errInfo->errCause = RGERR_NONE;
236 } /* rgCFGVldtCrgUeCfg */
240 * @brief Validates the logical channel configuration request from RRC to MAC.
244 * Function : rgCFGVldtCrgLcCfg
247 * - Validate the logical channel configuration request from RRC to
248 * MAC at CFG: validate if configured values are within the range.
249 * - If validated successfully,
250 * - Return ROK and pointer to the cell for common channels. Return
251 * pointer to cell and UE for dedicated logical channels.
255 * @param[in] CrgLchCfg *lcCfg
256 * @param[in] Inst inst
257 * @param[out] RgCellCb **cell
258 * @param[out] RgUeCb **ue
259 * @param[out] RgErrInfo *errInfo
264 S16 rgCFGVldtCrgLcCfg
274 if (lcCfg->lcType == CM_LTE_LCH_DTCH || lcCfg->lcType == CM_LTE_LCH_DCCH)
276 /* Dedicated logical channels */
277 if ((rgCFGVldtCrgDedLcCfg(inst,lcCfg, cell, ue, errInfo)) != ROK)
279 RLOG_ARG0(L_ERROR,DBG_CRNTI,lcCfg->crnti,"Validation for dedicated LC failed");
283 else if (lcCfg->lcType == CM_LTE_LCH_BCCH
284 || lcCfg->lcType == CM_LTE_LCH_PCCH
285 || lcCfg->lcType == CM_LTE_LCH_CCCH)
287 if ((rgCFGVldtCrgCmnLcCfg(inst,lcCfg, cell, errInfo)) != ROK)
289 RLOG_ARG0(L_ERROR,DBG_CRNTI,lcCfg->crnti,"Validation for common logical channels failed");
295 RLOG_ARG1(L_ERROR,DBG_CRNTI,lcCfg->crnti,"Invalid logical channel type %d",
300 if ( lcCfg->qci < RG_QCI_MIN ||
301 lcCfg->qci > RG_QCI_MAX
304 RLOG_ARG1(L_ERROR,DBG_CRNTI,lcCfg->crnti,"Invalid qci %x",lcCfg->qci);
308 #endif /*LTE_L2_MEAS */
310 errInfo->errCause = RGERR_NONE;
312 } /* rgCFGVldtCrgLcCfg */
316 * @brief Validates the cell re-configuration request from RRC to MAC.
320 * Function : rgCFGVldtCrgCellRecfg
323 * - Retrieve the cell control block.
325 * - Validate the range of re-configured values recieved in
326 * re-configuration request.
327 * - If validated successfully,
328 * - Return ROK and pointer to the cell.
331 * - Else return RFAILED.
333 * @param[in] Inst inst
334 * @param[in] CrgCellRecfg *cellRecfg
335 * @param[out] RgCellCb **cell
336 * @param[out] RgErrInfo *errInfo
341 S16 rgCFGVldtCrgCellRecfg
344 CrgCellRecfg *cellRecfg,
349 errInfo->errCause = RGERR_CFG_INVALID_CRG_CELL_RECFG;
351 if (((*cell = rgCb[inst].cell) == NULLP)
352 && ((*cell = rgCb[inst].inactiveCell) == NULLP))
354 RLOG_ARG0(L_ERROR,DBG_CELLID,cellRecfg->cellId,"Cell does not exist");
358 if((*cell)->cellId != cellRecfg->cellId)
360 RLOG_ARG1(L_ERROR,DBG_CELLID,cellRecfg->cellId, "Cell does not exist %d\n",cellRecfg->cellId);
363 if (cellRecfg->rachRecfg.maxMsg3Tx < RG_MIN_HQ_TX)
365 RLOG_ARG1(L_ERROR,DBG_CELLID,cellRecfg->cellId,
366 "Invalid RACH configuration: maxMsg3Tx %d",cellRecfg->rachRecfg.maxMsg3Tx);
369 errInfo->errCause = RGERR_NONE;
371 } /* rgCFGVldtCrgCellRecfg */
375 * @brief Validates the UE re-configuration request from RRC to MAC.
379 * Function : rgCFGVldtCrgUeRecfg
382 * - Retrieve the UE control block.
384 * - Validate the range of re-configured values recieved in
385 * re-configuration request.
386 * - If validated successfully,
387 * - Return ROK and pointer to the cell and ue.
390 * - Else return RFAILED.
392 * @param[in] Inst inst
393 * @param[in] CrgUeRecfg *ueRecfg
394 * @param[out] RgCellCb **cell
395 * @param[out] RgUeCb **ue
396 * @param[out] RgErrInfo *errInfo
401 S16 rgCFGVldtCrgUeRecfg
410 errInfo->errCause = RGERR_CFG_INVALID_CRG_UE_RECFG;
412 if ((ueRecfg->txMode.pres == PRSNT_NODEF) &&
413 (ueRecfg->txMode.tm == CRG_UE_TM_5))
415 RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Transmission Mode=%d not supported",
420 /* Fetch the Active cell */
421 if (((*cell = rgCb[inst].cell) == NULLP)
422 || ((*cell)->cellId != ueRecfg->cellId))
424 RLOG_ARG0(L_ERROR,DBG_CELLID,ueRecfg->cellId, "Active Cell does not exist\n");
428 /* Fix : syed UE ID change at MAC will now be controlled
430 if ((*ue = rgDBMGetUeCb(*cell, ueRecfg->oldCrnti)) == NULLP)
432 RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"[%d]Old Ue does not exist", ueRecfg->oldCrnti);
435 if (ueRecfg->ueUlHqRecfg.maxUlHqTx < RG_MIN_HQ_TX)
437 RLOG_ARG1(L_ERROR,DBG_CELLID,ueRecfg->cellId,"Invalid Uplink HARQ config for UE %d",
438 ueRecfg->ueUlHqRecfg.maxUlHqTx);
441 errInfo->errCause = RGERR_NONE;
443 } /* rgCFGVldtCrgUeRecfg */
447 * @brief Validates the logical channel re-configuration request from
452 * Function : rgCFGVldtCrgLcRecfg
455 * - Retrieve the uplink and downlink logical channel control block.
457 * - Validate the range of re-configured values recieved in
458 * re-configuration request.
459 * - If validated successfully,
460 * - Return ROK and pointer to the cell, UE and logical channel.
463 * - Else return RFAILED.
465 * @param[in] Inst inst
466 * @param[in] CrgLchRecfg *lcRecfg
467 * @param[out] RgCellCb **cell
468 * @param[out] RgUeCb **ue
469 * @param[out] RgUlLcCb **ulLc
470 * @param[out] RgDlLcCb **dlLc
471 * @param[out] RgErrInfo *errInfo
476 S16 rgCFGVldtCrgLcRecfg
479 CrgLchRecfg *lcRecfg,
486 errInfo->errCause = RGERR_CFG_INVALID_CRG_LC_RECFG;
489 if ((((*cell = rgCb[inst].cell)) == NULLP)
490 || ((*cell)->cellId != lcRecfg->cellId))
492 RLOG_ARG2(L_ERROR,DBG_CRNTI,lcRecfg->crnti,"Active Cell %u does not exist for UE %u", lcRecfg->cellId, lcRecfg->crnti);
495 /* Fetch the Ue for dedicated channels */
496 if ((*ue = rgDBMGetUeCb(*cell, lcRecfg->crnti)) == NULLP)
498 RLOG_ARG0(L_ERROR,DBG_CRNTI,lcRecfg->crnti,"Ue does not exist for dedicated logical channel");
502 if ((*ulLc = rgDBMGetUlDedLcCb((*ue), lcRecfg->lcId)) == NULLP)
504 RLOG_ARG1(L_ERROR, DBG_CRNTI,lcRecfg->crnti,"Dedicated UL LC does not exist %d",lcRecfg->lcId);
508 if (lcRecfg->ulRecfg.lcgId > (RG_MAX_LCG_PER_UE - 1))
510 RLOG_ARG2(L_ERROR,DBG_CRNTI,lcRecfg->crnti,"Invalid lcgId for uplink logical channel lcg %d lc %d",
511 lcRecfg->ulRecfg.lcgId, lcRecfg->lcId);
515 errInfo->errCause = RGERR_NONE;
517 } /* rgCFGVldtCrgLcRecfg */
519 /* Start: LTEMAC_2.1_DEV_CFG */
521 * @brief Validates the UE Reset request from RRC to MAC.
525 * Function : rgCFGVldtCrgUeReset
528 * - Retrieve the CELL control block.
531 * - Retrieve the UE control block.
535 * @param[in] Inst inst
536 * @param[in] CrgRst *reset,
537 * @param[out] RgCellCb **cell
538 * @param[out] RgUeCb **ue
539 * @param[out] RgErrInfo *errInfo
544 S16 rgCFGVldtCrgUeReset
553 errInfo->errCause = RGERR_CFG_INVALID_CRG_UE_RESET;
555 /* Fetch the Active cell */
556 if (((*cell = rgCb[inst].cell) == NULLP)
557 || ((*cell)->cellId != reset->cellId))
559 RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]Active Cell does not exist %d\n",reset->crnti, reset->cellId));
560 RLOG_ARG1(L_ERROR,DBG_CRNTI,reset->crnti,"Active Cell does not exist %d",reset->cellId);
565 if ((*ue = rgDBMGetUeCb(*cell, reset->crnti)) == NULLP)
567 RLOG_ARG0(L_ERROR,DBG_CRNTI,reset->crnti,"UE does not exist");
571 errInfo->errCause = RGERR_NONE;
573 } /* rgCFGVldtCrgUeReset*/
574 /* End: LTEMAC_2.1_DEV_CFG */
579 * @brief Handler for the cell configuration request from RRC to MAC.
583 * Function : rgCFGCrgCellCfg
586 * - Allocate and create cell control block.
587 * - Update cell control block with the values recieved in the
589 * - Add the control block to hash list of cells.
590 * - Update the statistics.
591 * - If successful, return ROK else return RFAILED.
593 * @param[in] Inst inst
594 * @param[in] CrgCellCfg *cellCfg
595 * @param[out] RgErrInfo *errInfo
608 RgCellCb *cell = NULLP;
612 /* RLC SAP to allocate flowCntrlInd buffer*/
615 errInfo->errCause = RGERR_CFG_CRG_CELL_CFG;
617 /* Allocate the cell control block */
618 if((ret = rgAllocSBuf(inst,(Data**)&cell, sizeof(RgCellCb))) != ROK)
620 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"Memory allocation FAILED for cell");
625 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId, "Memory allocation FAILED for cell");
629 /* Initialize the cell */
630 cell->cellId = cellCfg->cellId;
631 cell->rachCfg = cellCfg->rachCfg;
632 cell->bwCfg = cellCfg->bwCfg;
634 if(cellCfg->emtcEnable)
636 cell->emtcEnable = cellCfg->emtcEnable;
639 /* Initialize UL and DL CCCH logical channels */
640 cell->ulCcchId = RG_INVALID_LC_ID;
641 cell->dlCcchId = RG_INVALID_LC_ID;
644 /* Initialize the lists of the cell */
645 ret = rgDBMInitCell(cell);
648 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCfg->cellId,"DBM initialization for cell failed");
649 rgCFGFreeInactvCellCb(cell);
654 if (RFAILED == RgLaaCellCbInit(cell))
656 rgCFGFreeInactvCellCb(cell);
661 for(idx=0;idx < RG_NUM_SUB_FRAMES; idx++)
663 cell->subFrms[idx].txDone = TRUE;
666 cell->macInst = inst + RG_INST_START;
667 /* Insert cell in the incative cell list */
668 rgCb[inst].inactiveCell = cell;
669 rgCb[inst].cell = NULLP;
670 #ifdef TENB_MULT_CELL_SUPPRT
671 rguDlSapId = cellCfg->rguDlSapId;
672 rguUlSapId = cellCfg->rguUlSapId;
674 if(rgCb[inst].numRguSaps > 1)
679 cell->rguDlSap = &(rgCb[inst].rguSap[rguDlSapId]);
680 cell->rguUlSap = &(rgCb[inst].rguSap[rguUlSapId]);
684 cmLListInit(&cell->l2mList);
685 for(idx = 0; idx < RG_NUM_UL_SUB_FRAMES; idx++)
687 memset(&cell->ulSf[idx], 0, sizeof(RgUlSf));
690 cell->ttiCycle = (uint32_t)RG_TTI_CYCLE_INVLD;
692 /* Update Statistics */
693 rgUpdtCellCnt(inst,RG_CFG_ADD);
694 errInfo->errCause = RGERR_NONE;
696 pst = &rgCb[inst].rguSap[rguDlSapId].sapCfg.sapPst;
697 /* Allocate a buffer for flowCntrlInd.*/
698 SGetSBuf(pst->region, pst->pool, (Data **)&cell->flowCntrlInd,
699 sizeof(RguFlowCntrlInd));
701 } /* rgCFGCrgCellCfg */
705 * @brief Add SCell Cfg recvd from primary MAC instance.
709 * Function : rgCfgAddUeSCellCfg
712 * - Allocate and create UE control block.
713 * - Update UE control block with the values recieved in the
715 * - If successful, add the control block to hash list of UEs for the cell
716 * else Rollback and FAIL.
718 * @param[in] Inst dstMacInst
719 * @param[in] RgPrgUeSCellCfgInfo *ueSCellCb
720 * @param[in] RgCellCb cell
726 S16 rgCfgAddUeSCellCfg
729 RgPrgUeSCellCfgInfo *ueSCellCb,
733 RgUeCb *ueCb = NULLP;
740 rguDlSapId = ueSCellCb->rguDlSapId;
741 rguUlSapId = ueSCellCb->rguUlSapId;
743 #ifndef TENB_MULT_CELL_SUPPRT
744 if(rgCb[dstMacInst].numRguSaps > 1)
750 if ((ueCb = rgDBMGetUeCb(cell, ueSCellCb->ueId)) != NULLP)
752 RGDBGERRNEW(dstMacInst,(rgPBuf(dstMacInst),
753 "[%d]Ue already exist in scell %d during scell addition\n",
760 if((ueCb = rgRAMCreateUeCb(cell, ueSCellCb->ueId,
761 FALSE, &errInfo)) == NULLP)
763 RGDBGERRNEW(dstMacInst, (rgPBuf(dstMacInst),
764 "[%d]UeCb creation failed\n", ueSCellCb->ueId));
768 if(rgDHMHqEntInit(dstMacInst, &ueCb->dl.hqEnt,
769 (rgCb[dstMacInst].cell)->maxDlHqProcPerUe) != ROK)
771 RGDBGERRNEW(dstMacInst,(rgPBuf(dstMacInst),
772 "[%d]UeCb Harq Entity Initialization failed\n", ueSCellCb->ueId));
775 rgDBMInsUeCb(cell, ueCb);
778 ueCb->rguDlSap = &(rgCb[dstMacInst].rguSap[rguDlSapId]);
779 ueCb->rguUlSap = &(rgCb[dstMacInst].rguSap[rguUlSapId]);
781 /* Update satistics */
782 rgUpdtUeCnt(dstMacInst, RG_CFG_ADD);
783 /*Commit Added SCell info to UeCb */
785 ueCb->sCelAddInfo[idx].isSCellAdded = TRUE;
786 ueCb->sCelAddInfo[idx].macInst = dstMacInst;
787 ueCb->sCelAddInfo[idx].sCellId = ueSCellCb->cellId;
790 ueCb->txMode = ueSCellCb->txMode;
791 ueCb->ul.hqEnt.maxHqRetx = ueSCellCb->maxUlHqRetx;
793 for (idx =0; idx <RG_MAX_LC_PER_UE; idx++)
795 ueCb->ul.lcCb[idx] = ueSCellCb->ulLcInfo[idx];
796 ueCb->dl.lcCb[idx] = ueSCellCb->dlLcInfo[idx];
799 for (idx =0; idx < RG_MAX_LCG_PER_UE; idx++)
801 ueCb->ul.lcgArr[idx].lcgId = ueSCellCb->lcgInfo[idx].lcgId;
802 ueCb->ul.lcgArr[idx].lcCount = ueSCellCb->lcgInfo[idx].lcCount;
803 ueCb->ul.lcgArr[idx].isGbr = ueSCellCb->lcgInfo[idx].isGbr;
806 }/* rgCfgAddUeSCellCfg */
809 * @brief SCell Config Filling for added cell from RRC to MAC.
813 * Function : rgFillAndAddSCellCfg
816 * - Update UE control block with the values recieved in the
818 * - Update UE control block with the values present in the
820 * - If successful, add the control block to hash list of UEs for the cell
821 * else Rollback and FAIL.
823 * @param[in] Inst inst
824 * @param[in] RgCellCb *cell
825 * @param[in] CrgUeCfg *ueCfg
826 * @param[in] CrgCfgTransId transId
831 S16 rgFillAndAddSCellCfg
836 CrgCfgTransId transId,
843 RgPrgUeSCellCfgInfo ueSCellCb;
846 /* Fetch the Active cell */
847 if(((cell = rgCb[inst].cell) == NULLP) ||
848 (cell->cellId != ueRecfg->cellId))
850 RGDBGERRNEW(inst,(rgPBuf(inst),
851 "[%d]Active Cell does not exist %d\n",
852 ueRecfg->oldCrnti, ueRecfg->cellId));
856 RGDBGPRM(inst,(rgPBuf(inst),
857 "Filling SCell Config : cellId %d ueId %d\n",
858 cell->cellId, cell->ueId));
860 if ((ue = rgDBMGetUeCb(cell, ueRecfg->oldCrnti)) == NULLP)
862 RGDBGERRNEW(inst,(rgPBuf(inst),
863 "[%d]Ue does not exist\n", ueRecfg->oldCrnti));
867 /* Initialize cfgCfmInfo in the ueCb. This is used while processing SCellAdd
869 ue->cfgCfmInfo.numSCells = ueRecfg->crgSCellCfg.numSCells;
870 ue->cfgCfmInfo.cfgCfgCount = 0;
871 ue->cfgCfmInfo.mask = 0x0;
873 memcpy(&(ue->cfgCfmInfo.transId), &transId,
874 sizeof(CrgCfgTransId));
875 ueSCellCb.ueId = ueRecfg->oldCrnti;
876 ueSCellCb.txMode = ue->txMode;
877 ueSCellCb.maxUlHqRetx = ue->ul.hqEnt.maxHqRetx;
878 memcpy(ueSCellCb.ulLcInfo, ue->ul.lcCb, sizeof(ue->ul.lcCb));
879 memcpy(ueSCellCb.dlLcInfo, ue->dl.lcCb, sizeof(ue->dl.lcCb));
880 for (idx =0; idx < RG_MAX_LCG_PER_UE; idx++)
882 ueSCellCb.lcgInfo[idx].lcgId = ue->ul.lcgArr[idx].lcgId;
883 ueSCellCb.lcgInfo[idx].lcCount = ue->ul.lcgArr[idx].lcCount;
884 ueSCellCb.lcgInfo[idx].isGbr = ue->ul.lcgArr[idx].isGbr;
888 idx < ueRecfg->crgSCellCfg.numSCells; idx++)
890 dstMacInst = ueRecfg->crgSCellCfg.ueSCellCfg[idx].macInst - RG_INST_START;
891 ueSCellCb.cellId = ueRecfg->crgSCellCfg.ueSCellCfg[idx].sCellId;
892 ueSCellCb.rguDlSapId = ueRecfg->crgSCellCfg.ueSCellCfg[idx].rguDlSapId;
893 ueSCellCb.rguUlSapId = ueRecfg->crgSCellCfg.ueSCellCfg[idx].rguUlSapId;
895 /* Get post structure of the cell to whom ueSCellCb needs to be sent
896 * And then send the sCell Add based on Mac instances */
897 rgGetPstToInst(&dstInstPst, inst, dstMacInst);
898 RgPrgPMacSMacUeSCellCfg(&dstInstPst, &ueSCellCb);
900 /*Commit Added SCell info to UeCb is moved to config confirm*/
901 } /*end of for loop */
905 } /* rgFillAndAddSCellCfg */
909 * @brief Handler for the UE configuration request from RRC to MAC.
913 * Function : rgCFGCrgUeCfg
916 * - Allocate and create UE control block.
917 * - Update UE control block with the values recieved in the
919 * - Invoke RAM, SCH, UHM and DHM with created UE control block, to
920 * update random access, scheduler, uplink harq and downlink harq
921 * specific information respectively.
922 * - If successful, add the control block to hash list of UEs for the cell
923 * else Rollback and FAIL.
925 * @param[in] Inst inst
926 * @param[in] RgCellCb *cell
927 * @param[in] CrgUeCfg *ueCfg
928 * @param[out] RgErrInfo *errInfo
942 Bool handover = FALSE;
946 errInfo->errCause = RGERR_CFG_CRG_UE_CFG;
948 /* Start: LTEMAC_2.1_DEV_CFG */
949 if ((ue = rgDBMGetUeCbFromRachLst(cell, ueCfg->crnti)) == NULLP)
951 /* Create UeCb and Insert in Rach List */
952 if((ue=rgRAMCreateUeCb(cell, ueCfg->crnti, FALSE, errInfo)) == NULLP)
954 RLOG_ARG0(L_ERROR,DBG_CRNTI,ueCfg->crnti,"UeCb creation failed");
957 if(rgDHMHqEntInit(inst,&ue->dl.hqEnt, cell->maxDlHqProcPerUe) != ROK)
959 RLOG_ARG0(L_ERROR,DBG_CRNTI,ueCfg->crnti,"UeCb Harq Entity Initialization failed");
964 /* End: LTEMAC_2.1_DEV_CFG */
966 if(handover == FALSE)
968 /* Remove from the rachLst */
969 rgDBMDelUeCbFromRachLst(cell, ue);
973 /* Initialize uplink HARQ related information for UE */
974 rgUHMCrgUeCfg(cell, ue, ueCfg);
976 rgDBMInsUeCb(cell, ue);
978 #ifdef TENB_MULT_CELL_SUPPRT
979 rguDlSapId = ueCfg->rguDlSapId;
980 rguUlSapId = ueCfg->rguUlSapId;
982 if(rgCb[inst].numRguSaps > 1)
988 ue->rguDlSap = &(rgCb[inst].rguSap[rguDlSapId]);
989 ue->rguUlSap = &(rgCb[inst].rguSap[rguUlSapId]);
992 /* Update satistics */
993 rgUpdtUeCnt(inst,RG_CFG_ADD);
994 errInfo->errCause = RGERR_NONE;
996 } /* rgCFGCrgUeCfg */
1000 * @brief Handler for the logical channel configuration request from
1005 * Function : rgCFGCrgLcCfg
1008 * - Check if the configuration is for dedicated or common logical channel.
1009 * - For Dedicated logical channels:
1010 * - Update the dedicated logical channel Cb with the configured values.
1011 * - Invoke SCH will cell, UE and logical channel Cb to update scheduler
1012 * specific information.
1013 * - For Common logical channels:
1014 * - Update the common logical channel Cb with the configured values.
1015 * - Move cell to active list of cells if cell becomes ACTIVE.
1016 * - If successful, return ROK else RFAILED.
1018 * @param[in] Inst inst
1019 * @param[in] RgCellCb *cell
1020 * @param[in] RgUeCb *ue
1021 * @param[in] CrgLchCfg *lcCfg
1022 * @param[out] RgErrInfo *errInfo
1023 * @param[in] Bool *isCfmRqrd
1036 CrgCfgTransId transId
1040 /* Handle Config for dedicated/common logical channels */
1041 if (lcCfg->lcType == CM_LTE_LCH_DTCH || lcCfg->lcType == CM_LTE_LCH_DCCH)
1044 if ((rgCFGCrgDedLcCfg(cell, ue, lcCfg, errInfo)) != ROK)
1046 RLOG_ARG1(L_ERROR,DBG_CRNTI,lcCfg->crnti,
1047 "Dedicated logical channel configuration failed %d",lcCfg->lcId);
1051 /*ERAB Multl Cell fix*/
1052 memcpy(&(ue->cfgCfmInfo.transId), &transId,
1053 sizeof(CrgCfgTransId));
1054 rgPomSndUeSCellLchAddToSmac(inst, cell, ue, lcCfg,isCfmRqrd);
1059 if ((rgCFGCrgCmnLcCfg(inst,cell, lcCfg, errInfo)) != ROK)
1061 RLOG_ARG1(L_ERROR, DBG_CRNTI, lcCfg->crnti, "Common logical channel configuration"
1062 "failed %d\n", lcCfg->lcId);
1067 errInfo->errCause = RGERR_NONE;
1068 RLOG_ARG1(L_INFO, DBG_CRNTI,lcCfg->crnti, "CRG LC config done for UE: lcId %d\n", lcCfg->lcId);
1070 } /* rgCFGCrgLcCfg */
1074 * @brief Handler for the cell re-configuration request from RRC to MAC.
1078 * Function : rgCFGCrgCellRecfg
1081 * - Invoke SCH with updated Cell Cb to update scheduler specific
1083 * - Update the cell Cb with the reconfigured values.
1084 * - If successful, return ROK else RFAILED.
1086 * @param[in] Inst inst
1087 * @param[in] RgCellCb *cell
1088 * @param[in] CrgCellRecfg *cellRecfg
1089 * @param[out] RgErrInfo *errInfo
1094 S16 rgCFGCrgCellRecfg
1098 CrgCellRecfg *cellRecfg,
1102 /* Store the given rachCfg */
1103 cell->rachCfg = cellRecfg->rachRecfg;
1105 errInfo->errCause = RGERR_NONE;
1107 } /* rgCFGCrgCellRecfg */
1111 * @brief Handler for the UE re-configuration request from RRC to MAC.
1115 * Function : rgCFGCrgUeRecfg
1118 * - If rnti changes,
1119 * - Invoke RAM for UE reconfiguration.
1120 * - Delete old UE from the list.
1121 * - Update the new rnti and re-insert the UE in the list.
1122 * - Update the UE control block with the reconfigured values.
1123 * - Invoke SCH, UHM and DHM with updated UE control block to
1124 * update scheduler, uplink HARQ and downlink HARQ specific
1126 * - If successful, return ROK else RFAILED.
1128 * @param[in] Inst inst
1129 * @param[in] RgCellCb *cell
1130 * @param[in] RgUeCb *ue
1131 * @param[in] CrgUeRecfg *ueRecfg
1132 * @param[out] RgErrInfo *errInfo
1142 CrgUeRecfg *ueRecfg,
1146 errInfo->errCause = RGERR_CFG_CRG_UE_RECFG;
1148 /* Fix : syed UE ID change at MAC will now be controlled
1151 /* Update uplink HARQ related information for UE */
1152 rgUHMCrgUeRecfg(cell, ue, ueRecfg);
1154 errInfo->errCause = RGERR_NONE;
1156 } /* rgCFGCrgUeRecfg */
1160 * @brief Handler for the logical channel re-configuration request from
1165 * Function : rgCFGCrgLcRecfg
1168 * - Invoke scheduler to update scheduler specific information.
1169 * - Update the dedicated logical channel Cb with the re-configured
1171 * - If successful, return ROK else RFAILED.
1173 * @param[in] Inst inst
1174 * @param[in] RgUlCellCb *cell
1175 * @param[in] RgUlUeCb *ue
1176 * @param[in] RgUlLcCb *ulLc
1177 * @param[in] RgDlLcCb *dlLc
1178 * @param[in] CrgLchRecfg *lcRecfg
1179 * @param[out] RgErrInfo *errInfo
1190 CrgLchRecfg *lcRecfg,
1196 if (ulLc->lcgId != lcRecfg->ulRecfg.lcgId)
1198 rgDBMUpdUlDedLcCb(ue, ulLc, lcRecfg->ulRecfg.lcgId);
1200 rgPomSndUeSCellLchModToSmac(inst, cell, ue, lcRecfg,isCfmRqrd);
1204 errInfo->errCause = RGERR_NONE;
1206 } /* rgCFGCrgLcRecfg */
1208 /* Start: LTEMAC_2.1_DEV_CFG */
1210 * @brief Handler for the logical channel re-configuration request from
1215 * Function : rgCFGCrgUeReset
1219 * @param[in] RgUlCellCb *cell
1220 * @param[in] RgUlUeCb *ue
1221 * @param[in] CrgRst *reset
1222 * @param[out] RgErrInfo *errInfo
1236 RLOG_ARG1(L_DEBUG, DBG_CRNTI, ue->ueId, "UE: of cell %d Reset\n", cell->cellId);
1237 rgDHMUeReset(cell, &ue->dl.hqEnt);
1239 errInfo->errCause = RGERR_NONE;
1242 } /* rgCFGCrgUeReset */
1243 /* End: LTEMAC_2.1_DEV_CFG */
1246 * @brief Handler for the cell delete request from RRC to MAC.
1250 * Function : rgCFGCrgCellDel
1253 * - Fetch the cell control block.
1254 * - Remove the cell control block from the hash list of cells.
1255 * - Free the cell control block.
1256 * - If successful, return ROK else return RFAILED.
1258 * @param[in] Inst inst
1259 * @param[in] CrgDel *cellDelInfo
1260 * @param[out] RgErrInfo *errInfo
1268 CrgDel *cellDelInfo,
1276 errInfo->errCause = RGERR_CFG_CRG_CELL_DEL;
1277 if (((cell = rgCb[inst].cell) == NULLP)
1278 ||(cell->cellId != cellDelInfo->u.cellDel.cellId))
1280 if(((cell = rgCb[inst].inactiveCell) == NULLP)
1281 ||(cell->cellId != cellDelInfo->u.cellDel.cellId))
1285 RLOG_ARG0(L_ERROR,DBG_CELLID,cellDelInfo->u.cellDel.cellId,"Cell does not exist");
1289 /* Delete cell from inactive list */
1290 rgCb[inst].inactiveCell = NULLP ;
1292 /* Free the inactive cell */
1293 rgCFGFreeInactvCellCb(cell);
1295 errInfo->errCause = RGERR_NONE;
1299 /* Delete from the cell list */
1300 //rgDBMDelCellCb(cell);
1301 for(idx=0;idx < RG_NUM_SUB_FRAMES; idx++)
1303 rgTOMRlsSf(inst,&cell->subFrms[idx]);
1306 /* Free the active cell */
1307 rgCFGFreeCellCb(cell);
1309 rgCb[inst].cell = NULLP;
1311 errInfo->errCause = RGERR_NONE;
1312 RGDBGINFO(inst,(rgPBuf(inst), "Cell %d deleted\n", cellDelInfo->u.cellDel.cellId));
1314 } /* rgCFGCrgCellDel */
1318 * @brief Handler for the UE delete request from RRC to MAC.
1322 * Function : rgCFGCrgUeDel
1325 * - Fetch the UE control block.
1326 * - Remove the UE control block from the hash list of UEs for the cell.
1327 * - Free the UE control block.
1328 * - If successful, return ROK else return RFAILED.
1330 * @param[in] Inst inst
1331 * @param[in] CrgDel *ueDelInfo
1332 * @param[out] RgErrInfo *errInfo
1345 errInfo->errCause = RGERR_CFG_CRG_UE_DEL;
1347 RLOG_ARG1(L_DEBUG, DBG_CRNTI, ueDelInfo->u.ueDel.crnti, "UE %d Deletion Req at MAC\n", \
1348 ueDelInfo->u.ueDel.crnti);
1349 if ((rgCb[inst].cell == NULLP)
1350 || (rgCb[inst].cell->cellId != ueDelInfo->u.ueDel.cellId))
1352 RLOG_ARG1(L_ERROR,DBG_CRNTI,ueDelInfo->u.ueDel.crnti,"Cell does not exist %d",
1353 ueDelInfo->u.ueDel.cellId);
1357 errInfo->errCause = RGERR_NONE;
1358 /* Fix: syed Context Deletion is relied upon SCH indication */
1360 } /* rgCFGCrgUeDel */
1364 * @brief Handler for the logical channel delete request from
1369 * Function : rgCFGCrgLcDel
1372 * - Fetch the logical channel control block.
1373 * - Free the logical channel control block.
1374 * - If successful, return ROK else return RFAILED.
1376 * @param[in] Inst inst
1377 * @param[in] CrgDel *lcDelInfo
1378 * @param[out] RgErrInfo *errInfo
1389 CrgCfgTransId transId
1392 Bool dirVld = FALSE;
1398 errInfo->errCause = RGERR_CFG_CRG_LC_DEL;
1400 /* Fetch the Active cell */
1401 if (((cell = rgCb[inst].cell) == NULLP) ||
1402 (rgCb[inst].cell->cellId != lcDelInfo->u.lchDel.cellId))
1404 RLOG_ARG1(L_ERROR,DBG_CRNTI,lcDelInfo->u.lchDel.crnti,"Cell does not exist %d",
1405 lcDelInfo->u.lchDel.cellId);
1410 if ((ue = rgDBMGetUeCb(cell, lcDelInfo->u.lchDel.crnti)) == NULLP)
1412 RLOG_ARG0(L_ERROR,DBG_CRNTI,lcDelInfo->u.lchDel.crnti,
1413 "UE does not exist for dedicated logical channel");
1417 /* Validate downlink info */
1418 if (lcDelInfo->u.lchDel.dir & CRG_DIR_TX)
1420 if ((dlLc = rgDBMGetDlDedLcCb(ue, lcDelInfo->u.lchDel.lcId))
1423 RLOG_ARG1(L_ERROR,DBG_CRNTI,lcDelInfo->u.lchDel.crnti,"DL LC %d does not exist",
1424 lcDelInfo->u.lchDel.lcId);
1427 rgDBMDelDlDedLcCb(ue, dlLc);
1431 /* Validate uplink info */
1432 if (lcDelInfo->u.lchDel.dir & CRG_DIR_RX)
1434 if ((ulLc = rgDBMGetUlDedLcCb(ue, lcDelInfo->u.lchDel.lcId))
1437 RLOG_ARG1(L_ERROR,DBG_CRNTI,lcDelInfo->u.lchDel.crnti,"UL LC %d does not exist",
1438 lcDelInfo->u.lchDel.lcId);
1441 rgDBMDelUlDedLcCb(ue, ulLc);
1447 RLOG_ARG1(L_ERROR,DBG_CRNTI,lcDelInfo->u.lchDel.crnti,"Invalid direction %d for LC Delete",
1448 lcDelInfo->u.lchDel.dir);
1452 /*ERAB - multicell fix*/
1453 memcpy( &(ue->cfgCfmInfo.transId), &transId,
1454 sizeof(CrgCfgTransId));
1455 rgPomSndUeSCellLchDelToSmac(inst, lcDelInfo, isCfmRqrd);
1457 errInfo->errCause = RGERR_NONE;
1459 } /* rgCFGCrgLcDel */
1461 /***********************************************************
1463 * Func : rgCFGVldtCrgDedLcCfg
1466 * Desc : Validates dedicated logical channel configuration recieved from RRC.
1476 **********************************************************/
1477 static S16 rgCFGVldtCrgDedLcCfg
1486 uint8_t dirVld = FALSE;
1488 errInfo->errCause = RGERR_CFG_INVALID_CRG_DED_LC_CFG;
1490 /* Fetch the Active cell */
1491 if (((*cell = rgCb[inst].cell) == NULLP)
1492 || ((*cell)->cellId != lcCfg->cellId))
1494 RLOG_ARG1(L_ERROR,DBG_CRNTI,lcCfg->crnti,"Active Cell does not exist: Cell %d",
1500 if ((*ue = rgDBMGetUeCb(*cell, lcCfg->crnti)) == NULLP)
1502 RLOG_ARG1(L_ERROR,DBG_CRNTI,lcCfg->crnti,"UE does not exist for dedicated logical channel %d",
1507 /* Validate logical channel Id */
1508 if ((lcCfg->lcId < RG_DEDLC_MIN_LCID)
1509 ||(lcCfg->lcId > RG_DEDLC_MAX_LCID))
1511 RLOG_ARG1(L_ERROR,DBG_CRNTI,lcCfg->crnti,"Invalid logical channel Id %d",
1516 /* Validate downlink info */
1517 if (lcCfg->dir & CRG_DIR_TX)
1519 if (rgDBMGetDlDedLcCb((*ue), lcCfg->lcId) != NULLP)
1521 RLOG_ARG1(L_ERROR,DBG_CRNTI,lcCfg->crnti,"UE: Dedicated DL LC %d already configured",
1528 /* Validate uplink info */
1529 if (lcCfg->dir & CRG_DIR_RX)
1531 if (lcCfg->ulInfo.lcgId > (RG_MAX_LCG_PER_UE - 1))
1533 RLOG_ARG1(L_ERROR,DBG_CRNTI,lcCfg->crnti,"UE: Invalid lcgId for uplink logical channel %d",
1534 lcCfg->ulInfo.lcgId);
1537 if (rgDBMGetUlDedLcCb((*ue), lcCfg->lcId) != NULLP)
1539 RLOG_ARG1(L_ERROR,DBG_CRNTI,lcCfg->crnti,"UE: Dedicated UL LC %d already configured",
1548 RLOG_ARG1(L_ERROR,DBG_CRNTI,lcCfg->crnti,"Invalid Direction %d",
1554 } /* rgCFGVldtCrgDedLcCfg */
1557 /***********************************************************
1559 * Func : rgCFGVldtCrgCmnLcCfg
1562 * Desc : Validates common logical channel configuration recieved from RRC.
1572 **********************************************************/
1573 static S16 rgCFGVldtCrgCmnLcCfg
1581 uint8_t dirVld = FALSE;
1583 errInfo->errCause = RGERR_CFG_INVALID_CRG_CMN_LC_CFG;
1585 /* Ensure cell is not in the active list */
1586 if (((*cell = rgCb[inst].cell) != NULLP)
1587 && ((*cell)->cellId != lcCfg->cellId))
1589 RLOG_ARG0(L_ERROR,DBG_CELLID,lcCfg->cellId,"Active Cell exists for common channels");
1593 /* Fetch the inactive cell for common logical channels */
1594 if (((*cell = rgCb[inst].inactiveCell) == NULLP)
1595 || ((*cell)->cellId != lcCfg->cellId))
1598 RLOG_ARG0(L_ERROR,DBG_CELLID,lcCfg->cellId,"Inactive Cell does not exist for common channels");
1601 /* Validate downlink info */
1602 if (lcCfg->dir & CRG_DIR_TX)
1604 if (lcCfg->lcType == CM_LTE_LCH_BCCH)
1606 if (lcCfg->dlInfo.dlTrchType == CM_LTE_TRCH_DL_SCH)
1608 if (rgDBMGetBcchOnDlsch(*cell,lcCfg->lcId) != NULLP)
1610 RLOG_ARG0(L_ERROR,DBG_CELLID,lcCfg->cellId,"BCCH on DLSCH already configured for cell");
1614 else if (lcCfg->dlInfo.dlTrchType == CM_LTE_TRCH_BCH)
1616 if (rgDBMGetBcchOnBch(*cell) != NULLP)
1618 RLOG_ARG0(L_ERROR,DBG_CELLID,lcCfg->cellId,"BCCH on BCH already configured for cell %d");
1624 RLOG_ARG1(L_ERROR,DBG_CELLID,lcCfg->cellId,"Invalid transport channel %d for cell",
1625 lcCfg->dlInfo.dlTrchType);
1629 else if (lcCfg->lcType == CM_LTE_LCH_PCCH)
1631 if (rgDBMGetPcch(*cell) != NULLP)
1633 RLOG_ARG0(L_ERROR,DBG_CELLID,lcCfg->cellId,"PCCH already configured for cell");
1637 else if (RG_DLCCCH_ISCFGD(*cell))
1639 RLOG_ARG0(L_ERROR,DBG_CELLID,lcCfg->cellId,"DL CCCH already configured for cell %d");
1645 /* Validate uplink info */
1646 if (lcCfg->dir & CRG_DIR_RX)
1649 if (lcCfg->lcType != CM_LTE_LCH_CCCH)
1651 RLOG_ARG1(L_ERROR,DBG_CELLID,lcCfg->cellId,"Invalid UL common lcType %d for cell ",
1655 if (RG_ULCCCH_ISCFGD(*cell))
1657 RLOG_ARG0(L_ERROR,DBG_CELLID,lcCfg->cellId,"UL CCCH already configured for cell ");
1663 /* Invalid direction */
1666 RLOG_ARG1(L_ERROR,DBG_CELLID,lcCfg->cellId,"Invalid Direction %d", lcCfg->dir);
1671 } /* rgCFGVldtCrgCmnLcCfg */
1673 /***********************************************************
1675 * Func : rgCFGCrgDedLcCfg
1678 * Desc : Handles dedicated logical channel configuration
1679 * recieved from RRC.
1689 **********************************************************/
1690 static S16 rgCFGCrgDedLcCfg
1698 //Inst inst = cell->macInst - RG_INST_START;
1699 errInfo->errCause = RGERR_CFG_CRG_DED_LC_CFG;
1701 /* Uplink/Bi-directional logical channel */
1702 if (lcCfg->dir & CRG_DIR_RX)
1705 rgDBMInsUlDedLcCb(ue, lcCfg->lcId, lcCfg->ulInfo.lcgId, lcCfg->qci);
1706 cell->qciArray[lcCfg->qci].qci = lcCfg->qci;
1707 if(lcCfg->lcType == CM_LTE_LCH_DTCH)
1709 rgAddToL2MeasPerQci(cell,lcCfg->qci);/*LTE_L2_MEAS_PHASE2*/
1712 rgDBMInsUlDedLcCb(ue, lcCfg->lcId, lcCfg->ulInfo.lcgId);
1716 /* Downlink/Bi-directional logical channel */
1717 if (lcCfg->dir & CRG_DIR_TX)
1719 rgDBMInsDlDedLcCb(ue, lcCfg->lcId);
1722 } /* rgCFGCrgDedLcCfg */
1725 /***********************************************************
1727 * Func : rgCFGCrgCmnLcCfg
1730 * Desc : Handles dedicated logical channel configuration
1731 * recieved from RRC.
1741 **********************************************************/
1742 static S16 rgCFGCrgCmnLcCfg
1750 errInfo->errCause = RGERR_CFG_CRG_CMN_LC_CFG;
1752 /* Handle configuration for CCCH/BCCH/PCCH */
1753 if (lcCfg->lcType == CM_LTE_LCH_CCCH)
1755 /* UL and DL CCCH configuration */
1756 if (lcCfg->dir & CRG_DIR_TX)
1758 cell->dlCcchId = lcCfg->lcId;
1759 cell->cellActvState |= RG_DL_CCCH_CFG_DONE;
1762 if (lcCfg->dir & CRG_DIR_RX)
1764 cell->ulCcchId = lcCfg->lcId;
1765 cell->cellActvState |= RG_UL_CCCH_CFG_DONE;
1770 if (lcCfg->lcType == CM_LTE_LCH_BCCH)
1772 /* BCCH on BCH and DLSCH configuration */
1773 if (lcCfg->dlInfo.dlTrchType == CM_LTE_TRCH_DL_SCH)
1775 rgDBMInsBcchOnDlsch(cell, lcCfg->lcId);
1777 if(cell->cellActvState & RG_BCCH_DLSCH_CFG1_DONE)
1779 cell->cellActvState |= RG_BCCH_DLSCH_CFG2_DONE;
1783 cell->cellActvState |= RG_BCCH_DLSCH_CFG1_DONE;
1788 rgDBMInsBcchOnBch(cell, lcCfg->lcId);
1789 cell->cellActvState |= RG_BCCH_BCH_CFG_DONE;
1792 else /* PCCH configuration */
1794 rgDBMInsPcch(cell, lcCfg->lcId);
1795 cell->cellActvState |= RG_PCCH_CFG_DONE;
1799 /* Add to active cell list if cell is active */
1800 if (cell->cellActvState == RG_CELL_ACTIVE)
1802 rgCb[inst].cell = cell;
1803 rgCb[inst].inactiveCell = NULLP;
1804 RLOG_ARG1(L_DEBUG, DBG_CELLID, cell->cellId, "Cell %d added to active list after common LC %d\
1805 config\n", lcCfg->lcId);
1809 } /* rgCFGCrgCmnLcCfg */
1811 /***********************************************************
1813 * Func : rgCFGFreeUeUlAlloc
1817 * - Processing Steps:
1818 * - Frees cell control block.
1826 **********************************************************/
1827 static Void rgCFGFreeUeUlAlloc(RgCellCb *cell)
1830 Inst inst = cell->macInst - RG_INST_START;
1832 for(sfIdx = 0; sfIdx < RG_NUM_UL_SUB_FRAMES; sfIdx++)
1834 if(cell->ulSf[sfIdx].ueUlAllocInfo != NULLP)
1836 /*ccpu00117052 - MOD- Passing double pointer for proper
1837 * NULLP assignment */
1838 rgFreeSBuf(inst,(Data **)&(cell->ulSf[sfIdx].ueUlAllocInfo),
1839 (cell->ulSf[sfIdx].numUe * sizeof(RgUeUlAlloc)));
1842 }/* rgCFGFreeUeUlAlloc */
1844 /***********************************************************
1846 * Func : rgCFGFreeCellCb
1850 * - Processing Steps:
1851 * - Frees cell control block.
1859 **********************************************************/
1860 Void rgCFGFreeCellCb(RgCellCb *cell)
1862 Inst inst = cell->macInst - RG_INST_START;
1865 RgLaaCellCbDeInit(cell);
1867 /* Free lists of the cell */
1869 rgCFGFreeSpsUeLst(cell);
1870 #endif /* LTEMAC_SPS */
1871 rgCFGFreeUeLst(cell);
1872 rgRAMFreeCell(cell);
1873 rgCFGFreeCmnLcLst(cell);
1875 rgCFGFreeUeUlAlloc(cell);
1877 /* ccpu00117052 - MOD - Passing double pointer for proper NULLP
1879 /* Update satistics */
1880 rgUpdtCellCnt(inst,RG_CFG_DEL);
1881 rgDHMFreeAllTbBufs(inst);
1883 rgFreeSBuf(inst,(Data **)&cell->flowCntrlInd, sizeof(RguFlowCntrlInd));
1885 /* De-allocate the Cell */
1886 rgFreeSBuf(inst,(Data **)&cell, sizeof(*cell));
1889 RGDBGINFO(inst,(rgPBuf(inst), "Cell freed\n"));
1891 /* Stack Crash Problem for TRACE5 Changes. Added return below */
1893 } /* rgCFGFreeCellCb */
1896 /***********************************************************
1898 * Func : rgCFGFreeInactvCellCb
1902 * - Processing Steps:
1903 * - Frees inactive cell control block.
1911 **********************************************************/
1912 Void rgCFGFreeInactvCellCb(RgCellCb *cell)
1914 Inst inst = cell->macInst - RG_INST_START;
1915 /* De-initialize the Ue list */
1916 rgDBMDeInitUeCbLst(cell);
1918 rgDBMDeInitSpsUeCbLst(cell);
1921 rgCFGFreeCmnLcLst(cell);
1923 rgFreeSBuf(inst, (Data **)&cell->flowCntrlInd, sizeof(RguFlowCntrlInd));
1924 /*ccpu00117052 - MOD- Passing double pointer for proper
1926 /* De-allocate the Cell */
1927 rgFreeSBuf(inst,(Data **)&cell, sizeof(*cell));
1929 /* Update satistics */
1930 rgUpdtCellCnt(inst,RG_CFG_DEL);
1933 /* Stack Crash Problem for TRACE5 Changes. Added return below */
1935 } /* rgCFGFreeInactvCellCb */
1938 /***********************************************************
1940 * Func : rgCFGFreeUeCb
1944 * - Processing Steps:
1945 * - Frees UE control block.
1953 **********************************************************/
1954 Void rgCFGFreeUeCb(RgCellCb *cell,RgUeCb *ue)
1956 Inst inst = cell->macInst - RG_INST_START;
1958 rgDHMFreeUe(inst,&ue->dl.hqEnt);
1960 /* ccpu00117052 - MOD - Passing double pointer for proper NULLP
1962 /* De-allocate the Ue */
1963 rgFreeSBuf(inst,(Data **)&ue, sizeof(*ue));
1965 /* Update Statistics */
1966 rgUpdtUeCnt(inst,RG_CFG_DEL);
1969 /* Stack Crash Problem for TRACE5 Changes. Added return below */
1971 } /* rgCFGFreeUeCb */
1973 /***********************************************************
1975 * Func : rgCFGFreeCmnLcLst
1979 * - Processing Steps:
1980 * - Frees common logical channels in cell control block.
1988 **********************************************************/
1989 static Void rgCFGFreeCmnLcLst(RgCellCb *cell)
1991 rgDBMFreeCmnLcLst(cell);
1994 /* Stack Crash Problem for TRACE5 Changes. Added return below */
1996 } /* rgCFGFreeCmnLcLst */
1999 /***********************************************************
2001 * Func : rgCFGFreeUeLst
2005 * - Processing Steps:
2006 * - Frees UE list in cell control block.
2014 **********************************************************/
2015 static Void rgCFGFreeUeLst(RgCellCb *cell)
2019 /* Free Ues in the list */
2020 while ((ue = rgDBMGetNextUeCb(cell, NULLP)) != NULLP)
2023 rgDelUeFrmAllSCell(cell,ue);
2025 rgDBMDelUeCb(cell, ue);
2026 rgCFGFreeUeCb(cell, ue);
2029 /* De-initialize the Ue list */
2030 rgDBMDeInitUeCbLst(cell);
2033 /* Stack Crash Problem for TRACE5 Changes. Added return below */
2035 } /* rgCFGFreeUeLst */
2038 /***********************************************************
2040 * Func : rgCFGFreeSpsUeLst
2044 * - Processing Steps:
2045 * - Frees Sps UE list in cell control block.
2053 **********************************************************/
2054 static Void rgCFGFreeSpsUeLst(RgCellCb *cell)
2058 /* Free Ues in the list */
2059 while ((ue = rgDBMGetNextSpsUeCb(cell, NULLP)))
2061 rgDBMDelSpsUeCb(cell, ue);
2064 /* De-initialize the Ue list */
2065 rgDBMDeInitSpsUeCbLst(cell);
2067 } /* rgCFGFreeSpsUeLst */
2069 #endif /* LTEMAC_SPS */
2072 * @brief Function for registering cell- scheduler instance mapping
2076 * Function : RgSchMacCellRegReq
2078 * This function shall be invoked whenever scheduler is done with the
2079 * cell configuration successfully.
2080 * This shall create a mapping of the cell, scheduler instance that
2081 * is serving the cell and the unique identifier of the cell on the
2082 * scheduler at MAC. This mapping shall be used for further
2083 * communication to the scheduler instance for this cell.
2086 * @param[in] Pst* pst,
2087 * @param[in] CmLteCellId cellId,
2088 * @param[in] RaRespReqInfo raRespReq
2092 S16 RgSchMacCellRegReq(Pst* pst,RgInfCellReg* regReq)
2095 RgCellCb *cell = NULLP;
2097 RG_IS_INST_VALID(pst->dstInst);
2098 inst = pst->dstInst - RG_INST_START;
2099 cell = rgCb[inst].cell;
2106 if((cell == NULLP) || (cell->cellId != regReq->cellId))
2110 if(regReq->maxDlHqProcPerUe > RG_MAX_DL_HARQ_NUM)
2115 cell->schInstMap.cellSapId = regReq->cellSapId;
2116 cell->schInstMap.schInst = pst->srcInst;
2117 cell->maxDlHqProcPerUe = regReq->maxDlHqProcPerUe;
2121 } /* end of RgSchMacCellRegReq */
2123 /*Added Ue for Onging L2 Meas*/
2125 /*LTE_L2_MEAS_PHASE2*/
2126 S16 rgAddToL2MeasPerQci(RgCellCb *cell,uint8_t qci)
2133 lnk = cell->l2mList.first;
2134 while(lnk != NULLP )
2136 measCb = (RgL2MeasCb *)lnk->node;
2137 if(measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
2139 for(idx = 0;idx< measCb->measReq.t.prbReq.numQci;idx++)
2141 if(measCb->measReq.t.prbReq.qci[idx] == qci)
2143 break; /*exit from for loop*/
2146 if(idx == measCb->measReq.t.prbReq.numQci)
2148 cell->qciArray[qci].mask = TRUE;
2149 measCb->measReq.t.prbReq.qci[measCb->measReq.t.prbReq.numQci++] = qci;
2163 /**********************************************************************
2166 **********************************************************************/