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 /********************************************************************20**
21 Name: NR RLC - Configuration Manager file
25 Desc: It contains the following configuraiton primtives
38 *********************************************************************21*/
40 /** @file rlc_cfg_dl.c
41 @brief RLC Downlink Configuration Module
45 /* header (.h) include files */
46 #include "common_def.h"
48 #include "lkw.h" /* LKW defines */
49 #include "ckw.h" /* CKW defines */
50 #include "kwu.h" /* KWU defines */
51 #include "rgu.h" /* RGU defines */
52 #include "rlc_err.h" /* RLC error options */
53 #include "rlc_env.h" /* RLC environment options */
56 /* extern (.x) include files */
57 #include "lkw.x" /* LKW */
58 #include "ckw.x" /* CKW */
59 #include "kwu.x" /* KWU */
60 #include "rgu.x" /* RGU */
62 #include "rlc_utils.h" /* RLC defines */
63 #include "rlc_dl_ul_inf.h"
65 #include "du_app_rlc_inf.h"
67 #define RLC_MODULE RLC_DBGMASK_CFG
68 /*Added for adding new Ue in onging L2 Meas*/
72 * @brief Handle modification of UE ID for L2 Meas data structs
75 * @param[in] ueId ue ID
82 static S16 rlcHdlMeasDlUeIdChg(RlcCb *gCb, uint8_t cellId,uint8_t oldUeId, uint8_t newUeId)
84 RlcL2MeasEvtCb *measEvtCb = NULLP;
85 RlcL2MeasCb *measCb = NULLP;
89 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
91 measEvtCb = &(gCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[cntr]);
92 measCb = &(measEvtCb->measCb);
95 if(measCb->measType & LKW_L2MEAS_DL_IP )
98 for(ueIdx = 0; ueIdx < measCb->val.ipThMeas.numUes; ueIdx++)
100 if((measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId) == oldUeId)
102 measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId = newUeId;
113 * @brief Handler to delete an UE's L2 Meas ctxt
116 * @param[in] ueId ue ID
123 static S16 rlcDelFrmDlL2Meas(RlcCb *gCb, uint8_t cellId,uint8_t ueId)
125 RlcL2MeasEvtCb *measEvtCb = NULLP;
126 RlcL2MeasCb *measCb = NULLP;
131 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
133 measEvtCb = &gCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[cntr];
134 measCb = &(measEvtCb->measCb);
137 if(measCb->measType & LKW_L2MEAS_DL_IP )
140 for(ueIdx = 0; ((ueIdx < measCb->val.ipThMeas.numUes) &&
141 (ueIdx < gCb->genCfg.maxUe)); ueIdx++)
143 if((measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId) == ueId)
145 measCb->val.ipThMeas.ueInfoLst[ueIdx].isValid = FALSE;
146 if (measCb->val.ipThMeas.numUes-1 == ueIdx)
148 measCb->val.ipThMeas.numUes--;
160 static S16 rlcAddToDlL2Meas(RlcCb *gCb, RlcDlRbCb *rlcRbCb,uint8_t cellId,uint8_t ueId)
162 RlcL2MeasEvtCb *measEvtCb = NULLP;
163 RlcL2MeasCb *measCb = NULLP;
169 #ifndef XEON_SPECIFIC_CHANGES
170 uint8_t freeIdx = gCb->genCfg.maxUe;
172 uint16_t freeIdx = LKW_MAX_UE;
176 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
178 measEvtCb = &gCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[cntr];
179 measCb = &(measEvtCb->measCb);
181 freeIdx = gCb->genCfg.maxUe;
183 if(measCb->measType &
184 (LKW_L2MEAS_ACT_UE | LKW_L2MEAS_UU_LOSS | LKW_L2MEAS_DL_DELAY))
186 for(cntr1 =0;((cntr1 < measCb->val.nonIpThMeas.numQci) &&
187 (cntr1 < LKW_MAX_QCI));cntr1++)
189 if(measCb->val.nonIpThMeas.qci[cntr1] != rlcRbCb->qci)
191 measCb->val.nonIpThMeas.qci[cntr1] = rlcRbCb->qci;
192 gCb->u.dlCb->rlcL2Cb.measOn[rlcRbCb->qci] |=measCb->measType;
198 if(((rlcRbCb->rbL2Cb.measOn & measCb->measType) == LKW_L2MEAS_NONE))
200 if (measCb->measType & LKW_L2MEAS_ACT_UE)
202 if((rlcRbCb->mode == RLC_MODE_UM) &&
203 (rlcRbCb->dir & RLC_DIR_DL ))
205 if (rlcRbCb->m.umDl.sduQ.count)
207 if (rlcRbCb->ueCb->numActRb[rlcRbCb->qci] == 0)
209 rlcRbCb->ueCb->numActRb[rlcRbCb->qci]++;
210 gCb->u.dlCb->rlcL2Cb.numActUe[rlcRbCb->qci]++;
214 else if (rlcRbCb->mode == RLC_MODE_AM)
216 if ((rlcRbCb->m.amDl.cntrlBo) ||
217 (rlcRbCb->m.amDl.retxBo) ||
218 (rlcRbCb->m.amDl.bo))
220 if (rlcRbCb->ueCb->numActRb[rlcRbCb->qci] == 0)
222 rlcRbCb->ueCb->numActRb[rlcRbCb->qci]++;
223 gCb->u.dlCb->rlcL2Cb.numActUe[rlcRbCb->qci]++;
229 if((measCb->measType & LKW_L2MEAS_DL_IP))
232 for(ueIdx = 0; ((ueIdx < measCb->val.ipThMeas.numUes) &&
233 (ueIdx < gCb->genCfg.maxUe)); ueIdx++)
235 if ((freeIdx == gCb->genCfg.maxUe) &&
236 (measCb->val.ipThMeas.ueInfoLst[ueIdx].isValid == FALSE))
241 if((measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId) == ueId)
247 if (ueIdx == measCb->val.ipThMeas.numUes)
249 if (gCb->genCfg.maxUe == measCb->val.ipThMeas.numUes)
253 if (gCb->genCfg.maxUe == freeIdx)
255 measCb->val.ipThMeas.numUes++;
261 measCb->val.ipThMeas.ueInfoLst[ueIdx].isValid = TRUE;
262 memset(&measCb->val.ipThMeas.ueInfoLst[ueIdx].measData[0],0x00,(sizeof(RlcL2Cntr) *LKW_MAX_QCI));
263 measCb->val.ipThMeas.ueInfoLst[ueIdx].numQci = 0;
265 measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId = ueId;
266 measCb->val.ipThMeas.ueInfoLst[ueIdx].cellId = cellId;
267 numQci = &(measCb->val.ipThMeas.ueInfoLst[ueIdx].numQci);
269 for (qciIdx =0; ((qciIdx < *numQci) &&
270 (qciIdx < LKW_MAX_QCI)) ; qciIdx++)
272 if (measCb->val.ipThMeas.ueInfoLst[ueIdx].qci[qciIdx] == rlcRbCb->qci)
278 /* Fix Klock Warning */
279 if ((qciIdx == *numQci) && (qciIdx < LKW_MAX_QCI))
281 measCb->val.ipThMeas.ueInfoLst[ueIdx].qci[qciIdx] = rlcRbCb->qci;
285 rlcUtlPlcMeasDatInL2Sts(&measCb->val.ipThMeas.ueInfoLst[ueIdx].measData[rlcRbCb->qci],
286 &rlcRbCb->rbL2Cb, measCb->measType);
288 else if (measCb->measType &
289 (LKW_L2MEAS_DL_DISC | LKW_L2MEAS_DL_DELAY | LKW_L2MEAS_UU_LOSS))
291 rlcUtlPlcMeasDatInL2Sts(&measCb->val.nonIpThMeas.measData[rlcRbCb->qci],
292 &rlcRbCb->rbL2Cb, measCb->measType);
293 measCb->val.nonIpThMeas.qci[rlcRbCb->qci] = rlcRbCb->qci;
294 measCb->val.nonIpThMeas.measData[rlcRbCb->qci].totDrbsPerQci++;
296 rlcRbCb->rbL2Cb.measOn |= measCb->measType;
299 }/*rlcAddToDlL2Meas*/
300 #endif /*LTE_L2_MEAS*/
305 * This primitive fills the RbCb
307 * @param [in] gCb - RLC Instance Control Block
308 * @param [out] rbCb - RB Control Block
309 * @param [out] ueCb - UE Control Block
310 * @param [in] entCfg - RLC Entity configuration
316 static S16 rlcCfgFillDlRbCb(RlcCb *gCb,RlcDlRbCb *rbCb,RlcDlUeCb *ueCb,RlcEntCfgInfo *entCfg)
319 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgFillRbCb(ueId(%d),cellId(%d) rbType(%d))",
324 /* Initialize according to entMode */
325 switch (entCfg->entMode)
329 rbCb->lch.lChId = entCfg->lCh[0].lChId;
330 rbCb->lch.lChType = entCfg->lCh[0].type;
331 rbCb->dir = entCfg->dir;
337 rbCb->lch.lChId = entCfg->lCh[0].lChId;
338 rbCb->lch.lChType = entCfg->lCh[0].type;
339 rbCb->dir = entCfg->dir;
341 /* Spec 38.322 Section 7.1
342 * All UM state variables can take values from 0 to 63 for 6 bit SN or
343 * from 0 to 4095 for 12 bit SN. All arithmetic operations on UM state
344 * variables are affected by the UM modulus
345 * (i.e. final value = [value from arithmetic operation] modulo 64
346 * for 6 bit SN and 4096 for 12 bit SN)
348 rbCb->m.umDl.snLen = entCfg->m.umInfo.dl.snLen;
349 if (entCfg->m.umInfo.dl.snLen == RLC_UM_CFG_6BIT_SN_LEN)
350 rbCb->m.umDl.modBitMask = 0x3f;
352 rbCb->m.umDl.modBitMask = 0xfff;
354 ueCb->lCh[rbCb->lch.lChId - 1].dlRbCb = rbCb;
360 /* Down Link Information
361 * indx = 0 as Down Link */
362 rbCb->lch.lChId = entCfg->lCh[0].lChId;
363 rbCb->lch.lChType = entCfg->lCh[0].type;
364 rbCb->dir = RLC_DIR_BOTH;
366 rbCb->m.amDl.pollPdu = entCfg->m.amInfo.dl.pollPdu;
367 rbCb->m.amDl.pollByte = entCfg->m.amInfo.dl.pollByte;
368 rbCb->m.amDl.maxRetx = entCfg->m.amInfo.dl.maxRetx;
369 rbCb->m.amDl.pollRetxTmrInt = entCfg->m.amInfo.dl.pollRetxTmr;
370 rbCb->m.amDl.snLen = entCfg->m.amInfo.dl.snLen;
372 if(RLC_AM_CFG_12BIT_SN_LEN == rbCb->m.amDl.snLen)
374 rbCb->m.amDl.snModMask = (1 << RLC_SN_LEN_12BITS) - 1; /* 5GNR */
378 rbCb->m.amDl.snModMask = (1 << RLC_SN_LEN_18BITS) - 1; /* 5GNR */
381 cmInitTimers(&(rbCb->m.amDl.pollRetxTmr), 1);
382 ueCb->lCh[rbCb->lch.lChId - 1].dlRbCb = rbCb;
387 rbCb->m.amDl.txBufLst,
388 (RLC_TX_BUF_BIN_SIZE * sizeof(CmLListCp)));
389 for(hashIndex = 0; hashIndex < RLC_TX_BUF_BIN_SIZE; hashIndex++)
391 cmLListInit(&(rbCb->m.amDl.txBufLst[hashIndex]));
398 DU_LOG("\nERROR --> RLC_DL : Invalid RB Mode ueId(%d),cellId(%d)",
404 rbCb->mode = entCfg->entMode;
405 rbCb->discTmrInt = entCfg->discardTmr;
412 * @brief This primitive Initializes the RB Cb
414 * @param [in] gCb - RLC Instance Control Block
415 * @param [out] rbCb - RB Control Block
416 * @param [in] ptr - Void pointer
417 * @param [in] entCfg - Entity Configuration
423 static S16 rlcCfgUpdateDlRb
428 RlcEntCfgInfo *entCfg
432 if (rbCb->mode != entCfg->entMode)
434 DU_LOG("\nERROR --> RLC_DL : RB Mode Mismatch : exp [%d] rcv [%d] UEID:%d CELLID:%d",
439 return (CKW_CFG_REAS_RB_MODE_MIS);
446 RlcDlCellCb *cellCb = (RlcDlCellCb *)ptr;
448 rbCb->dir = entCfg->dir;
449 rbCb->lch.lChId = entCfg->lCh[0].lChId;
450 rbCb->lch.lChType = entCfg->lCh[0].type;
452 cellCb->lCh[rbCb->lch.lChId - 1].dlRbCb = rbCb;
458 RlcDlUeCb *ueCb = (RlcDlUeCb *)ptr;
460 if (entCfg->lCh[0].type == CM_LTE_LCH_DCCH)
462 return (CKW_CFG_REAS_LCHTYPE_MIS);
464 ueCb->lCh[rbCb->lch.lChId - 1].dlRbCb = NULLP;
465 ueCb->lCh[entCfg->lCh[0].lChId - 1].dlRbCb = rbCb;
467 rbCb->lch.lChId = entCfg->lCh[0].lChId;
468 rbCb->lch.lChType = entCfg->lCh[0].type;
469 rbCb->dir = entCfg->dir;
475 RlcDlUeCb *ueCb = (RlcDlUeCb *)ptr;
477 ueCb->lCh[rbCb->lch.lChId - 1].dlRbCb = NULLP;
478 ueCb->lCh[entCfg->lCh[1].lChId - 1].dlRbCb = rbCb;
481 rbCb->lch.lChId = entCfg->lCh[1].lChId;
482 rbCb->lch.lChType = entCfg->lCh[1].type;
483 rbCb->m.amDl.pollRetxTmrInt = entCfg->m.amInfo.dl.pollRetxTmr;
484 rbCb->m.amDl.pollPdu = entCfg->m.amInfo.dl.pollPdu;
485 rbCb->m.amDl.pollByte = entCfg->m.amInfo.dl.pollByte;
486 rbCb->m.amDl.maxRetx = entCfg->m.amInfo.dl.maxRetx;
493 rbCb->discTmrInt = entCfg->discardTmr;
495 return (CKW_CFG_REAS_NONE);
501 * This primitive adds new RB in Ue/Cell Cb.
504 * This function does following steps -
505 * - If UE ID is 0 then
506 * - Check for CELL CB is present
507 * - If yes, Check for RB ID
508 * - If RB ID is present Status Indication with reason
509 * - Else, Create New RB CB in CELL CB
510 * - If no Create New CELL CB and RB CB
512 * - Check for UE CB is present
513 * - If yes Check for RB ID
514 * - If RB ID is present Status Indication with reason
515 * - Else, Create New RB CB in UE CB
516 * - If no Create New UE CB and RB CB
517 * - Fill entity confirmation
519 * @param [in] gCb - RLC Instance Control Block
520 * @param [in] ueId - UE Identifier
521 * @param [in] cellId - CELL Identifier
522 * @param [in] entCfg - Entity Configuration to be done.
523 * @param [out] entCfm - Entity Confirmation.
534 RlcEntCfgInfo *entCfg,
535 RlcEntCfgCfmInfo *entCfm
538 RlcDlUeCb *ueCb = NULLP; /* UE Control Block */
539 RlcDlCellCb *cellCb; /* Cell Control Block */
540 RlcDlRbCb *rlcRbCb; /* KW RB Control Block */
541 uint8_t reason; /* Rb Identifier */
543 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgAddRb(cellId(%d),UEID:%d cfgType(%d))",
550 /* Fill entCfm structure */
551 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
552 CKW_CFG_REAS_CELL_UNKWN);
553 DU_LOG("\nERROR --> RLC_DL : Add DLRb,CellId is 0 for UEID:%d",
557 if ((entCfg->rguSapId >= gCb->genCfg.maxRguSaps) || (entCfg->rguSapId < 0))
559 RLCDBGP_ERROR(gCb, "rlcCfgAddDlRb(ueId(%u), cellId(%u), Invalid rguSapId (%d)\n",
560 ueId, cellId, entCfg->rguSapId);
565 /* Process Adding new RB */
568 if(entCfg->rbId >= RLC_MAX_RB_PER_CELL)
570 /* Fill entCfm structure */
571 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
573 CKW_CFG_REAS_RB_UNKWN);
574 DU_LOG("\nERROR --> RLC_DL : Invalid RbId ,Max is [%d] CELLID:%d UEID:%d",
581 if (((entCfg->lCh[0].type == CM_LTE_LCH_BCCH) ||
582 (entCfg->lCh[0].type == CM_LTE_LCH_PCCH) ||
583 (entCfg->lCh[0].type == CM_LTE_LCH_CCCH)) &&
584 (entCfg->entMode == RLC_MODE_TM))
586 /* Cell CB present */
587 rlcDbmFetchDlCellCb(gCb, cellId, &cellCb);
590 /* Get rbCb from cellCb->rbCb List */
591 if (( cellCb->rbCb[entCfg->rbId] != NULLP))
593 /* Fill entCfm structure */
594 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
596 CKW_CFG_REAS_RB_PRSNT);
597 DU_LOG("\nERROR --> RLC_DL : RbId [%d] already exists UEID:%d",
603 else /* Cell CB UNKNOWN */
606 if ( ROK != rlcDbmCreateDlCellCb(gCb,cellId, &cellCb))
608 /* Fill entCfm structure */
609 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
611 CKW_CFG_REAS_CELL_CREAT_FAIL);
612 DU_LOG("\nERROR --> RLC_DL : cellCb Creation failed RBID:%d UEID:%d",
620 if(entCfg->lCh[0].lChId <= 0)
622 DU_LOG("\nERROR --> RLC_DL : Invalid LcId CELLID:%d UEID:%d RBID:%d",
626 /* Fill entCfm structure */
627 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
628 CKW_CFG_CFM_NOK, CKW_CFG_REAS_INVALID_LCHID);
633 RLC_ALLOC(gCb,rlcRbCb, sizeof (RlcDlRbCb));
636 DU_LOG("\nERROR --> RLC_DL : Memory allocation failed for rbId:%d CELLID:%d",
639 /* Fill entCfm structure */
640 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
641 CKW_CFG_CFM_NOK, CKW_CFG_REAS_RB_CREAT_FAIL);
644 rlcRbCb->rlcId.rbId = entCfg->rbId;
645 cellCb->rbCb[entCfg->rbId] = rlcRbCb;
646 RLC_LMM_RB_STS_INC(gCb);
647 cellCb->lCh[entCfg->lCh[0].lChId - 1].dlRbCb = rlcRbCb;
651 reason= (entCfg->entMode != RLC_MODE_TM)? CKW_CFG_REAS_RB_MODE_MIS:
652 CKW_CFG_REAS_LCHTYPE_MIS;
653 /* Fill entCfm structure */
654 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
655 CKW_CFG_CFM_NOK, reason);
661 if (!(RLC_VALIDATE_UE_RBID(entCfg->rbType, entCfg->rbId)))
663 /* Fill entCfm structure */
664 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
665 CKW_CFG_REAS_RB_UNKWN);
666 DU_LOG("\nERROR --> RLC_DL : Invalid RbId for RbType[%d] UEID:%d",
671 if ((((entCfg->lCh[0].type == CM_LTE_LCH_DCCH) &&
672 (entCfg->entMode != RLC_MODE_UM) &&
673 (CM_LTE_SRB == entCfg->rbType)) ||
674 ((entCfg->lCh[0].type == CM_LTE_LCH_DTCH) &&
675 (CM_LTE_DRB == entCfg->rbType))) &&
676 (entCfg->entMode != RLC_MODE_TM))
679 if ( rlcDbmFetchDlUeCb(gCb,ueId, cellId, &ueCb) == ROK)
681 /* Get rbCb from ueCb->rbCb list */
682 RLC_DBM_GET_RBCB_FROM_UECB(entCfg->rbId, entCfg->rbType, ueCb, rlcRbCb);
684 if(( rlcRbCb != NULLP))
686 /* Fill entCfm structure */
687 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
688 CKW_CFG_REAS_RB_PRSNT);
689 DU_LOG("\nERROR --> RLC_DL : CellId[%u]:rbId [%d] already exists",
695 else /* UE CB UNKNOWN */
698 if ( rlcDbmCreateDlUeCb(gCb,ueId, cellId, &ueCb) != ROK)
700 /* Fill entCfm structure */
701 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
702 CKW_CFG_REAS_UE_CREAT_FAIL);
703 DU_LOG("\nERROR --> RLC_DL : UeId [%u]:ueCb Creation Failed RBID:%d",
708 /* Start throughput calculation for this UE */
709 gCb->rlcThpt.thptPerUe[gCb->rlcThpt.numActvUe].ueIdx = ueId;
710 gCb->rlcThpt.thptPerUe[gCb->rlcThpt.numActvUe].dataVol = 0;
711 gCb->rlcThpt.numActvUe++;
713 if((rlcChkTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_THROUGHPUT_TMR)) == FALSE)
715 rlcStartTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_THROUGHPUT_TMR);
719 /* Validate LChId for UM and AM modes */
720 if ((entCfg->lCh[0].lChId <= 0) ||
721 ((entCfg->entMode == RLC_MODE_AM)&&
722 (entCfg->lCh[1].lChId <= 0)))
724 /* Fill entCfm structure */
725 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
726 CKW_CFG_CFM_NOK, CKW_CFG_REAS_INVALID_LCHID);
731 RLC_ALLOC(gCb,rlcRbCb, sizeof (RlcDlRbCb));
734 /* Fill entCfm structure */
735 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,CKW_CFG_CFM_NOK,
736 CKW_CFG_REAS_RB_CREAT_FAIL);
737 DU_LOG("\nERROR --> RLC_DL : Memory allocation failed RBID:%d CELLID:%d",
743 /* copy the RB Cb into UECb */
744 rlcRbCb->rlcId.rbId = entCfg->rbId;
745 if(entCfg->rbType == CM_LTE_SRB)
746 ueCb->srbCb[entCfg->rbId] = rlcRbCb;
748 ueCb->drbCb[entCfg->rbId] = rlcRbCb;
750 RLC_LMM_RB_STS_INC(gCb);
755 if (entCfg->entMode == RLC_MODE_TM)
757 reason = CKW_CFG_REAS_RB_MODE_MIS;
761 reason = CKW_CFG_REAS_LCHTYPE_MIS;
764 /* Fill entCfm structure */
765 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK, reason);
771 rlcRbCb->rlcId.cellId = cellId;
772 rlcRbCb->rlcId.ueId = ueId;
773 rlcRbCb->rlcId.rbType = entCfg->rbType;
774 rlcRbCb->inst = gCb->init.inst;
775 #ifdef TENB_MULT_CELL_SUPPRT
776 rlcRbCb->rguSapId = entCfg->rguSapId;
781 if (rlcCfgFillDlRbCb(gCb,rlcRbCb, ueCb, entCfg) != ROK)
783 /* Fill entCfm structure */
784 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
785 CKW_CFG_REAS_RB_CREAT_FAIL);
787 /* Delete RB CB created */
788 RLC_FREE(gCb,rlcRbCb, sizeof(RlcDlRbCb));
789 DU_LOG("\nERROR --> RLC_DL : Filling of RbCb failed UEID:%d CELLID:%d",
794 rlcRbCb->qci = entCfg->qci;
796 rlcRbCb->ueCb = ueCb;
797 if (entCfg->lCh[0].type == CM_LTE_LCH_DTCH)
800 rlcAddToDlL2Meas(gCb, rlcRbCb,cellId,ueId);
802 #endif /* LTE_L2_MEAS */
804 /* Fill entCfm structure */
805 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_OK, CKW_CFG_REAS_NONE);
813 * This primitive reconfigures the existing RB in Ue/Cell Cb.
816 * This primitive executes following steps in reconfiguration of existing
818 * - If UE ID is 0 then
819 * - Check for CELL CB is present
820 * - If yes, Check for RB ID
821 * - If RB ID is present Reconfigure the RB CB
822 * - Else, Status Indication with Reason
823 * - Else, Status Indication with Reason
825 * - Check for UE CB is present
826 * - If yes, Check for RB ID
827 * - If RB ID is prenset Reconfigure the CELL CB
828 * - Else, Status Indication with Reason
829 * - Else, Status Indication with Reason
830 * - Fill entity confirmation
832 * @param [in] gCb - RLC Instance Control Block
833 * @param [in] ueId - UE Identifier
834 * @param [in] cellId - CELL Identifier
835 * @param [in] entCfg - Entity Configuration to be done.
836 * @param [out] entCfm - Entity Confirmation
847 RlcEntCfgInfo *entCfg,
848 RlcEntCfgCfmInfo *entCfm
851 RlcDlRbCb *rbCb; /* RB Control Block */
852 RlcDlRbCb tRbCb; /* KW RB Control Block */
853 RlcDlCellCb *cellCb; /* Cell Control Block */
854 RlcDlUeCb *ueCb; /* Ue Control Block */
857 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgReCfgRb(cellId(%d), cfgType(%d)) RBID:%d",
858 cellId, entCfg->cfgType,entCfg->rbId);
861 /* Check for UeCb or CellCb */
864 if(entCfg->rbId >= RLC_MAX_RB_PER_CELL)
866 /* Fill entCfm structure */
867 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
868 CKW_CFG_REAS_RB_UNKWN);
869 DU_LOG("\nERROR --> RLC_DL : Invalid RbId , Max is [%d] UEID:%d CELLID:%d",
876 rlcDbmFetchDlCellCb(gCb,cellId, &cellCb);
879 /* Fill entCfm structure */
880 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
881 CKW_CFG_REAS_CELL_UNKWN);
882 DU_LOG("\nERROR --> RLC_DL : CellCb not found ueId:%d RBID:%d CELLID:%d",
890 RLC_DBM_GET_CELL_RBCB(entCfg->rbId, cellCb->rbCb, rbCb);
894 /* Fill entCfm structure */
895 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
896 CKW_CFG_REAS_RB_UNKWN);
897 DU_LOG("\nERROR --> RLC_DL : CELLID:%d RBID:%d not found",
903 /* Take backup of rbCb before updating.
904 * Because in failure case restore original rbCb
906 memcpy(&tRbCb, rbCb, sizeof(RlcDlRbCb));
909 ret = rlcCfgUpdateDlRb(gCb,rbCb, cellCb,entCfg);
912 /* Fill entCfm structure */
913 RLC_CFG_FILL_CFG_CFM(entCfm,
919 DU_LOG("\nERROR --> RLC_DL : CELLID:%u RBID:%d updation failed",
922 memcpy(rbCb, &tRbCb, sizeof(RlcDlRbCb));
929 if (!(RLC_VALIDATE_UE_RBID(entCfg->rbType, entCfg->rbId)))
931 /* Fill entCfm structure */
932 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
933 CKW_CFG_REAS_RB_UNKWN);
934 DU_LOG("\nERROR --> RLC_DL : CELLID:%d Invalid RBID:%d for RbType[%d]",
941 ret = rlcDbmFetchDlUeCb(gCb,ueId, cellId, &ueCb);
944 /* Fill entCfm structure */
945 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
946 CKW_CFG_CFM_NOK, CKW_CFG_REAS_UE_UNKWN);
947 DU_LOG("\nERROR --> RLC_DL : UEID:%d UeCb not found RBID:%d",
954 RLC_DBM_GET_RBCB_FROM_UECB(entCfg->rbId, entCfg->rbType, ueCb, rbCb);
958 /* Fill entCfm structure */
959 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
960 CKW_CFG_REAS_RB_UNKWN);
961 DU_LOG("\nERROR --> RLC_DL : CELLID:%d RBID:%d not found",
967 /* Take backup of rbCb before updating.
968 * Because in failure case restore original rbCb
970 memcpy(&tRbCb, rbCb, sizeof(RlcDlRbCb));
973 ret = rlcCfgUpdateDlRb(gCb,rbCb,ueCb, entCfg);
974 if (ret != CKW_CFG_REAS_NONE)
976 /* Fill entCfm structure */
977 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
979 DU_LOG("\nERROR --> RLC_DL : CELLID:%d RBID:%d updation failed",
982 memcpy(rbCb, &tRbCb, sizeof(RlcDlRbCb));
988 /* Fill entCfm structure */
989 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_OK, CKW_CFG_REAS_NONE);
996 * @brief This primitive deletes the existing RB in Ue/Cell Cb.
999 * - If UE ID is 0 then
1000 * - Check for CELL CB is present
1001 * - If yes, Check for RB ID
1002 * - If RB ID is prenset Delete the RB CB
1003 * - If there is no RB CB exist in CELL CB then Delete CELL CB.
1004 * - Else, Status Indication with Reason
1005 * - Else, Status Indication with Reason
1007 * - Check for UE CB is present
1008 * - If yes, Check for RB ID
1009 * - If RB ID is prenset Delete the RB CB
1010 * - If there is no RB CB exist in UE CB then Delete UE CB.
1011 * - Else, Status Indication with Reason
1012 * - Else, Status Indication with Reason
1013 * - Fill entity confirmation
1015 * @param [in] gCb - RLC Instance Control Block
1016 * @param [in] ueId - UE Identifier
1017 * @param [in] cellId - CELL Identifier
1018 * @param [in] entCfg - Entity Configuration to be done.
1019 * @param [out] entCfm - Entity Confirmation
1030 RlcEntCfgInfo *entCfg,
1031 RlcEntCfgCfmInfo *entCfm
1034 S16 ret; /* Return Value */
1035 RlcDlUeCb *ueCb; /* UE Control Block */
1036 RlcDlCellCb *cellCb; /* UE Control Block */
1037 RlcDlRbCb *rlcRbCb; /* KW RB Control Block */
1039 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgDelRb(RBID(%d), cellId(%d), cfgType(%d))",
1046 /* Get cellCb and delete rbCb from it */
1049 if(entCfg->rbId >= RLC_MAX_RB_PER_CELL)
1051 /* Fill entCfm structure */
1052 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1053 CKW_CFG_CFM_NOK, CKW_CFG_REAS_RB_UNKWN);
1054 DU_LOG("\nERROR --> RLC_DL : Invalid RbId, Max is [%d] UEID:%d CELLID:%d",
1055 RLC_MAX_RB_PER_CELL,
1061 rlcDbmFetchDlCellCb(gCb,cellId, &cellCb);
1064 /* Fill entCfm structure */
1065 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1066 CKW_CFG_CFM_NOK, CKW_CFG_REAS_RB_UNKWN);
1067 DU_LOG("\nERROR --> RLC_DL : CellCb not found UEID:%d RBID:%d",
1074 RLC_DBM_GET_CELL_RBCB(entCfg->rbId, cellCb->rbCb, rlcRbCb);
1076 if ( rlcRbCb == NULLP)
1078 /* Fill entCfm structure */
1079 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1080 CKW_CFG_CFM_NOK, CKW_CFG_REAS_RB_UNKWN);
1081 DU_LOG("\nERROR --> RLC_DL : CellId[%u]:RbId[%d] not found",
1087 /* Assign NULLP to rbCb in rbCbLst */
1088 cellCb->rbCb[entCfg->rbId] = NULLP;
1090 /* Assign NULLP to dlRbCb/ulRbCb.
1091 * Delete Hashlist allocated for it if any */
1092 cellCb->lCh[rlcRbCb->lch.lChId - 1].dlRbCb = NULLP;
1093 RLC_FREE(gCb,rlcRbCb, sizeof(RlcDlRbCb)); /*Vartika: Mem leak fix */
1095 /* Get ueCb and delete rbCb from it */
1098 if (!(RLC_VALIDATE_UE_RBID(entCfg->rbType, entCfg->rbId)))
1100 /* Fill entCfm structure */
1101 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1102 CKW_CFG_CFM_NOK, CKW_CFG_REAS_RB_UNKWN);
1103 DU_LOG("\nERROR --> RLC_DL : Invalid RbId for RbType[%d] UEID:%d CELLID:%d",
1111 ret = rlcDbmFetchDlUeCb(gCb,ueId, cellId, &ueCb);
1114 /* Fill entCfm structure */
1115 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1116 CKW_CFG_CFM_NOK, CKW_CFG_REAS_UE_UNKWN);
1117 DU_LOG("\nERROR --> RLC_DL : UeId [%d]: UeCb not found RBID:%d",
1124 RLC_DBM_GET_RBCB_FROM_UECB(entCfg->rbId, entCfg->rbType, ueCb, rlcRbCb);
1126 if ( rlcRbCb == NULLP)
1128 /* Fill entCfm structure */
1129 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
1130 CKW_CFG_REAS_RB_UNKWN);
1131 DU_LOG("\nERROR --> RLC_DL : CellId[%u]:RbId[%d] not found",
1137 ueCb->lCh[rlcRbCb->lch.lChId - 1].dlRbCb = NULLP;
1140 RLC_UPD_L2_DECR_NONIP_PER_QCI_RB_COUNT(gCb, rlcRbCb);
1142 /* Free the Buffers of RbCb */
1143 if( RLC_MODE_UM == rlcRbCb->mode)
1145 rlcUmmFreeDlRbCb(gCb,rlcRbCb);
1147 RLC_FREE(gCb,rlcRbCb, sizeof(RlcDlRbCb));
1149 else if( RLC_MODE_AM == rlcRbCb->mode)
1151 rlcAmmFreeDlRbCb(gCb,rlcRbCb);
1154 /* Assign NULLP to rbCb in rbCbLst */
1155 if ( entCfg->rbType == CM_LTE_SRB )
1157 ueCb->srbCb[entCfg->rbId] = NULLP;
1161 ueCb->drbCb[entCfg->rbId] = NULLP;
1165 RLC_LMM_RB_STS_DEC(gCb);
1167 /* Fill entCfm structure */
1168 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_OK,
1176 * @brief This primitive re-establish the existing RB in Ue/Cell Cb.
1179 * - If UE ID is 0 then
1180 * - Check for CELL CB is present
1181 * - If yes, Check for RB ID
1182 * - If RB ID is prenset initialize the parameters of the RB CB
1183 * - Else, Status Indication with Reason
1184 * - Else, Status Indication with Reason
1186 * - Check for UE CB is present
1187 * - If yes, Check for RB ID
1188 * - If RB ID is prenset initialize the parameters of the RB CB
1189 * - Else, Status Indication with Reason
1190 * - Else, Status Indication with Reason
1191 * - Fill entity confirmation
1193 * @param [in] gCb - RLC Instance Control Block
1194 * @param [in] ueId - UE Identifier
1195 * @param [in] cellId - CELL Identifier
1196 * @param [in] entCfg - Entity Configuration to be done.
1197 * @param [out] entCfm - Entity Confirmation
1209 RlcEntCfgInfo *entCfg,
1210 RlcEntCfgCfmInfo *entCfm
1213 RlcDlRbCb *rbCb; /* RB Control Block */
1214 CmLteRlcId rlcId; /* RLC Identifier */
1216 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgReEstDlRb(ueId(%d), cellId(%d), cfgType(%d))",
1223 rlcId.cellId = cellId;
1224 rlcId.rbId = entCfg->rbId;
1225 rlcId.rbType = entCfg->rbType;
1227 rlcDbmFetchDlRbCbByRbId(gCb,&rlcId, &rbCb);
1230 /* Fill entCfm structure */
1231 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, rlcId.rbType, CKW_CFG_CFM_NOK,
1232 CKW_CFG_REAS_RB_UNKWN);
1233 DU_LOG("\nERROR --> RLC_DL : CellId[%u]:RbId[%d] not found",
1239 rbCb->rlcId.ueId = ueId;
1245 rlcDlTmmReEstablish(gCb,rbCb);
1251 rlcDlUmmReEstablish(gCb,rlcId,sndReEstInd,rbCb);
1257 rlcAmmDlReEstablish(gCb, rlcId, rbCb);
1262 /* Fill entCfm structure */
1263 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1264 CKW_CFG_CFM_OK, CKW_CFG_REAS_NONE);
1271 * @brief This primitive deletes the RBs in Ue Cb.
1274 * - If UE ID is 0 then
1275 * - Status Indication with Reason
1277 * - Check for UE CB is present
1278 * - If yes, Delete all RB CB in UE CB and Delete UE CB also.
1279 * - Else, Status Indication with Reason
1280 * - Fill entity confirmation
1282 * @param [in] gCb - RLC Instance Control Block
1283 * @param [in] ueId - UE Identifier
1284 * @param [in] cellId - CELL Identifier
1285 * @param [in] entCfg - Entity Configuration to be done.
1286 * @param [out] entCfm - Entity Confirmation
1297 RlcEntCfgInfo *entCfg,
1298 RlcEntCfgCfmInfo *entCfm
1301 S16 ret; /* Return Value */
1302 RlcDlUeCb *ueCb; /* UE Control Block */
1304 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgDelUe(ueId(%d), cellId(%d), cfgType(%d))",
1311 /* Check for ueId is present or not */
1314 /* Fill entCfm structure */
1315 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1316 CKW_CFG_CFM_NOK, CKW_CFG_REAS_UE_UNKWN);
1317 DU_LOG("\nERROR --> RLC_DL : ueId(%d), cellId(%d)",
1324 ret = rlcDbmFetchDlUeCb(gCb,ueId, cellId, &ueCb);
1327 /* Fill entCfm structure */
1328 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1329 CKW_CFG_CFM_NOK, CKW_CFG_REAS_UE_UNKWN);
1330 DU_LOG("\nERROR --> RLC_DL : UEID:%d UeCb not found RBID:%d",
1337 rlcDelFrmDlL2Meas(gCb,cellId,ueId);
1338 rlcDbmDelAllDlL2MeasTbFrmUe(gCb,ueCb);
1341 rlcDbmDelDlUeCb(gCb,ueCb, FALSE);
1343 /* Fill entCfm structure */
1344 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1345 CKW_CFG_CFM_OK, CKW_CFG_REAS_NONE);
1352 * @brief This primitive deletes the RBs in Ue Cb.
1355 * - If CELL ID is 0 then
1356 * - Status Indication with Reason
1358 * - Check for CELL CB is present
1359 * - If yes, Delete all RB CB in CELL CB and Delete CELL CB also.
1360 * - Else, Status Indication with Reason
1361 * - Fill entity confirmation
1363 * @param [in] cellId - CELL Identifier
1364 * @param [in] entCfg - Entity Configuration to be done.
1365 * @param [out] entCfm - Entity Confirmation
1375 RlcEntCfgInfo *entCfg,
1376 RlcEntCfgCfmInfo *entCfm
1379 RlcDlCellCb *cellCb; /* UE Control Block */
1380 uint8_t rbId; /* RB Identifier */
1382 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgDelCell( cellId(%d), cfgType(%d)",
1387 rbId = entCfg->rbId;
1389 /* Check for ueId is present or not */
1392 /* Fill entCfm structure */
1393 RLC_CFG_FILL_CFG_CFM(entCfm, rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
1394 CKW_CFG_REAS_CELL_UNKWN);
1395 DU_LOG("\nERROR --> RLC_DL : cellId is 0 (%d) ",
1401 rlcDbmFetchDlCellCb(gCb,cellId, &cellCb);
1404 /* Fill entCfm structure */
1405 RLC_CFG_FILL_CFG_CFM(entCfm, rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
1406 CKW_CFG_REAS_CELL_UNKWN);
1407 DU_LOG("\nERROR --> RLC_DL : CellCb not found for RBID:%d",
1413 rlcDbmDelDlCellCb(gCb,cellCb);
1415 /* Fill entCfm structure */
1416 /* kw005.201 added support for L2 Measurement */
1417 RLC_CFG_FILL_CFG_CFM(entCfm, rbId, entCfg->rbType, CKW_CFG_CFM_OK,
1424 * @brief This primitive changes the ueId of Ue Cb.
1427 * - If oldUeId and newUeId are
1428 * - Confirm the Status with Reason
1429 * - If UeId not present
1430 * - Confirm the Status with Reason
1432 * - Copy rbCbs from old UeCb to new UeCb
1434 * - Fill entity confirmation
1436 * @param [in] ueInfo - Old UE Information
1437 * @param [in] newUeInfo - New UE Information
1438 * @param [out] status - Status
1444 S16 rlcCfgDlUeIdChng
1448 CkwUeInfo *newUeInfo,
1453 /*kw004.201 Adding of Missing Trace in RLC PDCP*/
1455 if ( (ueInfo->ueId == newUeInfo->ueId) &&
1456 (ueInfo->cellId == newUeInfo->cellId))
1458 status->reason = CKW_CFG_REAS_SAME_UEID;
1459 status->status = CKW_CFG_CFM_NOK;
1460 DU_LOG("\nERROR --> RLC_DL : Old UeId[%d] same as new UeId[%d]",
1466 if(ROK == rlcDbmFetchDlUeCb(gCb,newUeInfo->ueId, newUeInfo->cellId, &ueCb))
1468 DU_LOG("\nERROR --> RLC_DL : NewUeId[%d]:ueCb already exists",
1470 status->reason = CKW_CFG_REAS_UE_EXISTS;
1471 status->status = CKW_CFG_CFM_NOK;
1475 if(ROK != rlcDbmFetchDlUeCb(gCb,ueInfo->ueId, ueInfo->cellId, &ueCb))
1478 DU_LOG("\nERROR --> RLC_DL : UeId [%d]: UeCb not found",
1480 status->reason = CKW_CFG_REAS_UE_UNKWN;
1481 status->status = CKW_CFG_CFM_NOK;
1486 rlcHdlMeasDlUeIdChg(gCb, ueInfo->cellId, ueInfo->ueId, newUeInfo->ueId);
1488 if(ROK != cmHashListDelete(&(gCb->u.dlCb->ueLstCp), (PTR) ueCb))
1490 DU_LOG("\nERROR --> RLC_DL : UeId[%u] HashList Deletion Failed",
1492 status->reason = CKW_CFG_REAS_UE_CREAT_FAIL;
1493 status->status = CKW_CFG_CFM_NOK;
1497 /* update the hash key with new values */
1498 ueCb->ueId = newUeInfo->ueId;
1499 ueCb->cellId = newUeInfo->cellId;
1501 if(ROK != cmHashListInsert(&(gCb->u.dlCb->ueLstCp),
1502 (PTR)ueCb, (uint8_t *)&(ueCb->ueId),
1503 (uint16_t) sizeof(CmLteRnti)))
1506 DU_LOG("\nERROR --> RLC_DL : UeId[%u] HashList Insertion Failed",
1508 status->reason = CKW_CFG_REAS_UE_CREAT_FAIL;
1509 status->status = CKW_CFG_CFM_NOK;
1516 /********************************************************************30**
1519 **********************************************************************/