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*/
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 "kw_err.h" /* RLC error options */
53 #include "kw_env.h" /* RLC environment options */
54 #include "kw.h" /* RLC defines */
58 /* extern (.x) include files */
59 #include "lkw.x" /* LKW */
60 #include "ckw.x" /* CKW */
61 #include "kwu.x" /* KWU */
62 #include "rgu.x" /* RGU */
67 #include "du_app_rlc_inf.h"
69 #define RLC_MODULE RLC_DBGMASK_CFG
70 /*Added for adding new Ue in onging L2 Meas*/
74 * @brief Handle modification of UE ID for L2 Meas data structs
77 * @param[in] ueId ue ID
84 static S16 rlcHdlMeasDlUeIdChg(RlcCb *gCb, uint8_t cellId,uint8_t oldUeId, uint8_t newUeId)
86 RlcL2MeasEvtCb *measEvtCb = NULLP;
87 RlcL2MeasCb *measCb = NULLP;
91 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
93 measEvtCb = &(gCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[cntr]);
94 measCb = &(measEvtCb->measCb);
97 if(measCb->measType & LKW_L2MEAS_DL_IP )
100 for(ueIdx = 0; ueIdx < measCb->val.ipThMeas.numUes; ueIdx++)
102 if((measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId) == oldUeId)
104 measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId = newUeId;
115 * @brief Handler to delete an UE's L2 Meas ctxt
118 * @param[in] ueId ue ID
125 static S16 rlcDelFrmDlL2Meas(RlcCb *gCb, uint8_t cellId,uint8_t ueId)
127 RlcL2MeasEvtCb *measEvtCb = NULLP;
128 RlcL2MeasCb *measCb = NULLP;
133 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
135 measEvtCb = &gCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[cntr];
136 measCb = &(measEvtCb->measCb);
139 if(measCb->measType & LKW_L2MEAS_DL_IP )
142 for(ueIdx = 0; ((ueIdx < measCb->val.ipThMeas.numUes) &&
143 (ueIdx < gCb->genCfg.maxUe)); ueIdx++)
145 if((measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId) == ueId)
147 measCb->val.ipThMeas.ueInfoLst[ueIdx].isValid = FALSE;
148 if (measCb->val.ipThMeas.numUes-1 == ueIdx)
150 measCb->val.ipThMeas.numUes--;
162 static S16 rlcAddToDlL2Meas(RlcCb *gCb, RlcDlRbCb *rlcRbCb,uint8_t cellId,uint8_t ueId)
164 RlcL2MeasEvtCb *measEvtCb = NULLP;
165 RlcL2MeasCb *measCb = NULLP;
171 #ifndef XEON_SPECIFIC_CHANGES
172 uint8_t freeIdx = gCb->genCfg.maxUe;
174 uint16_t freeIdx = LKW_MAX_UE;
178 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
180 measEvtCb = &gCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[cntr];
181 measCb = &(measEvtCb->measCb);
183 freeIdx = gCb->genCfg.maxUe;
185 if(measCb->measType &
186 (LKW_L2MEAS_ACT_UE | LKW_L2MEAS_UU_LOSS | LKW_L2MEAS_DL_DELAY))
188 for(cntr1 =0;((cntr1 < measCb->val.nonIpThMeas.numQci) &&
189 (cntr1 < LKW_MAX_QCI));cntr1++)
191 if(measCb->val.nonIpThMeas.qci[cntr1] != rlcRbCb->qci)
193 measCb->val.nonIpThMeas.qci[cntr1] = rlcRbCb->qci;
194 gCb->u.dlCb->rlcL2Cb.measOn[rlcRbCb->qci] |=measCb->measType;
200 if(((rlcRbCb->rbL2Cb.measOn & measCb->measType) == LKW_L2MEAS_NONE))
202 if (measCb->measType & LKW_L2MEAS_ACT_UE)
204 if((rlcRbCb->mode == RLC_MODE_UM) &&
205 (rlcRbCb->dir & RLC_DIR_DL ))
207 if (rlcRbCb->m.umDl.sduQ.count)
209 if (rlcRbCb->ueCb->numActRb[rlcRbCb->qci] == 0)
211 rlcRbCb->ueCb->numActRb[rlcRbCb->qci]++;
212 gCb->u.dlCb->rlcL2Cb.numActUe[rlcRbCb->qci]++;
216 else if (rlcRbCb->mode == RLC_MODE_AM)
218 if ((rlcRbCb->m.amDl.cntrlBo) ||
219 (rlcRbCb->m.amDl.retxBo) ||
220 (rlcRbCb->m.amDl.bo))
222 if (rlcRbCb->ueCb->numActRb[rlcRbCb->qci] == 0)
224 rlcRbCb->ueCb->numActRb[rlcRbCb->qci]++;
225 gCb->u.dlCb->rlcL2Cb.numActUe[rlcRbCb->qci]++;
231 if((measCb->measType & LKW_L2MEAS_DL_IP))
234 for(ueIdx = 0; ((ueIdx < measCb->val.ipThMeas.numUes) &&
235 (ueIdx < gCb->genCfg.maxUe)); ueIdx++)
237 if ((freeIdx == gCb->genCfg.maxUe) &&
238 (measCb->val.ipThMeas.ueInfoLst[ueIdx].isValid == FALSE))
243 if((measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId) == ueId)
249 if (ueIdx == measCb->val.ipThMeas.numUes)
251 if (gCb->genCfg.maxUe == measCb->val.ipThMeas.numUes)
255 if (gCb->genCfg.maxUe == freeIdx)
257 measCb->val.ipThMeas.numUes++;
263 measCb->val.ipThMeas.ueInfoLst[ueIdx].isValid = TRUE;
264 memset(&measCb->val.ipThMeas.ueInfoLst[ueIdx].measData[0],0x00,(sizeof(RlcL2Cntr) *LKW_MAX_QCI));
265 measCb->val.ipThMeas.ueInfoLst[ueIdx].numQci = 0;
267 measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId = ueId;
268 measCb->val.ipThMeas.ueInfoLst[ueIdx].cellId = cellId;
269 numQci = &(measCb->val.ipThMeas.ueInfoLst[ueIdx].numQci);
271 for (qciIdx =0; ((qciIdx < *numQci) &&
272 (qciIdx < LKW_MAX_QCI)) ; qciIdx++)
274 if (measCb->val.ipThMeas.ueInfoLst[ueIdx].qci[qciIdx] == rlcRbCb->qci)
280 /* Fix Klock Warning */
281 if ((qciIdx == *numQci) && (qciIdx < LKW_MAX_QCI))
283 measCb->val.ipThMeas.ueInfoLst[ueIdx].qci[qciIdx] = rlcRbCb->qci;
287 rlcUtlPlcMeasDatInL2Sts(&measCb->val.ipThMeas.ueInfoLst[ueIdx].measData[rlcRbCb->qci],
288 &rlcRbCb->rbL2Cb, measCb->measType);
290 else if (measCb->measType &
291 (LKW_L2MEAS_DL_DISC | LKW_L2MEAS_DL_DELAY | LKW_L2MEAS_UU_LOSS))
293 rlcUtlPlcMeasDatInL2Sts(&measCb->val.nonIpThMeas.measData[rlcRbCb->qci],
294 &rlcRbCb->rbL2Cb, measCb->measType);
295 measCb->val.nonIpThMeas.qci[rlcRbCb->qci] = rlcRbCb->qci;
296 measCb->val.nonIpThMeas.measData[rlcRbCb->qci].totDrbsPerQci++;
298 rlcRbCb->rbL2Cb.measOn |= measCb->measType;
301 }/*rlcAddToDlL2Meas*/
302 #endif /*LTE_L2_MEAS*/
307 * This primitive fills the RbCb
309 * @param [in] gCb - RLC Instance Control Block
310 * @param [out] rbCb - RB Control Block
311 * @param [out] ueCb - UE Control Block
312 * @param [in] entCfg - RLC Entity configuration
318 static S16 rlcCfgFillDlRbCb(RlcCb *gCb,RlcDlRbCb *rbCb,RlcDlUeCb *ueCb,RlcEntCfgInfo *entCfg)
321 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgFillRbCb(ueId(%d),cellId(%d) rbType(%d))",
326 /* Initialize according to entMode */
327 switch (entCfg->entMode)
331 rbCb->lch.lChId = entCfg->lCh[0].lChId;
332 rbCb->lch.lChType = entCfg->lCh[0].type;
333 rbCb->dir = entCfg->dir;
339 rbCb->lch.lChId = entCfg->lCh[0].lChId;
340 rbCb->lch.lChType = entCfg->lCh[0].type;
341 rbCb->dir = entCfg->dir;
343 /* Spec 38.322 Section 7.1
344 * All UM state variables can take values from 0 to 63 for 6 bit SN or
345 * from 0 to 4095 for 12 bit SN. All arithmetic operations on UM state
346 * variables are affected by the UM modulus
347 * (i.e. final value = [value from arithmetic operation] modulo 64
348 * for 6 bit SN and 4096 for 12 bit SN)
350 rbCb->m.umDl.snLen = entCfg->m.umInfo.dl.snLen;
351 if (entCfg->m.umInfo.dl.snLen == RLC_UM_CFG_6BIT_SN_LEN)
352 rbCb->m.umDl.modBitMask = 0x3f;
354 rbCb->m.umDl.modBitMask = 0xfff;
356 ueCb->lCh[rbCb->lch.lChId - 1].dlRbCb = rbCb;
362 /* Down Link Information
363 * indx = 0 as Down Link */
364 rbCb->lch.lChId = entCfg->lCh[0].lChId;
365 rbCb->lch.lChType = entCfg->lCh[0].type;
366 rbCb->dir = RLC_DIR_BOTH;
368 rbCb->m.amDl.pollPdu = entCfg->m.amInfo.dl.pollPdu;
369 rbCb->m.amDl.pollByte = entCfg->m.amInfo.dl.pollByte;
370 rbCb->m.amDl.maxRetx = entCfg->m.amInfo.dl.maxRetx;
371 rbCb->m.amDl.pollRetxTmrInt = entCfg->m.amInfo.dl.pollRetxTmr;
372 rbCb->m.amDl.snLen = entCfg->m.amInfo.dl.snLen;
374 if(RLC_AM_CFG_12BIT_SN_LEN == rbCb->m.amDl.snLen)
376 rbCb->m.amDl.snModMask = (1 << RLC_SN_LEN_12BITS) - 1; /* 5GNR */
380 rbCb->m.amDl.snModMask = (1 << RLC_SN_LEN_18BITS) - 1; /* 5GNR */
383 cmInitTimers(&(rbCb->m.amDl.pollRetxTmr), 1);
384 ueCb->lCh[rbCb->lch.lChId - 1].dlRbCb = rbCb;
389 rbCb->m.amDl.txBufLst,
390 (RLC_TX_BUF_BIN_SIZE * sizeof(CmLListCp)));
391 for(hashIndex = 0; hashIndex < RLC_TX_BUF_BIN_SIZE; hashIndex++)
393 cmLListInit(&(rbCb->m.amDl.txBufLst[hashIndex]));
400 DU_LOG("\nERROR --> RLC_DL : Invalid RB Mode ueId(%d),cellId(%d)",
406 rbCb->mode = entCfg->entMode;
407 rbCb->discTmrInt = entCfg->discardTmr;
414 * @brief This primitive Initializes the RB Cb
416 * @param [in] gCb - RLC Instance Control Block
417 * @param [out] rbCb - RB Control Block
418 * @param [in] ptr - Void pointer
419 * @param [in] entCfg - Entity Configuration
425 static S16 rlcCfgUpdateDlRb
430 RlcEntCfgInfo *entCfg
434 if (rbCb->mode != entCfg->entMode)
436 DU_LOG("\nERROR --> RLC_DL : RB Mode Mismatch : exp [%d] rcv [%d] UEID:%d CELLID:%d",
441 return (CKW_CFG_REAS_RB_MODE_MIS);
448 RlcDlCellCb *cellCb = (RlcDlCellCb *)ptr;
450 rbCb->dir = entCfg->dir;
451 rbCb->lch.lChId = entCfg->lCh[0].lChId;
452 rbCb->lch.lChType = entCfg->lCh[0].type;
454 cellCb->lCh[rbCb->lch.lChId - 1].dlRbCb = rbCb;
460 RlcDlUeCb *ueCb = (RlcDlUeCb *)ptr;
462 if (entCfg->lCh[0].type == CM_LTE_LCH_DCCH)
464 return (CKW_CFG_REAS_LCHTYPE_MIS);
466 ueCb->lCh[rbCb->lch.lChId - 1].dlRbCb = NULLP;
467 ueCb->lCh[entCfg->lCh[0].lChId - 1].dlRbCb = rbCb;
469 rbCb->lch.lChId = entCfg->lCh[0].lChId;
470 rbCb->lch.lChType = entCfg->lCh[0].type;
471 rbCb->dir = entCfg->dir;
477 RlcDlUeCb *ueCb = (RlcDlUeCb *)ptr;
479 ueCb->lCh[rbCb->lch.lChId - 1].dlRbCb = NULLP;
480 ueCb->lCh[entCfg->lCh[1].lChId - 1].dlRbCb = rbCb;
483 rbCb->lch.lChId = entCfg->lCh[1].lChId;
484 rbCb->lch.lChType = entCfg->lCh[1].type;
485 rbCb->m.amDl.pollRetxTmrInt = entCfg->m.amInfo.dl.pollRetxTmr;
486 rbCb->m.amDl.pollPdu = entCfg->m.amInfo.dl.pollPdu;
487 rbCb->m.amDl.pollByte = entCfg->m.amInfo.dl.pollByte;
488 rbCb->m.amDl.maxRetx = entCfg->m.amInfo.dl.maxRetx;
495 rbCb->discTmrInt = entCfg->discardTmr;
497 return (CKW_CFG_REAS_NONE);
503 * This primitive adds new RB in Ue/Cell Cb.
506 * This function does following steps -
507 * - If UE ID is 0 then
508 * - Check for CELL CB is present
509 * - If yes, Check for RB ID
510 * - If RB ID is present Status Indication with reason
511 * - Else, Create New RB CB in CELL CB
512 * - If no Create New CELL CB and RB CB
514 * - Check for UE CB is present
515 * - If yes Check for RB ID
516 * - If RB ID is present Status Indication with reason
517 * - Else, Create New RB CB in UE CB
518 * - If no Create New UE CB and RB CB
519 * - Fill entity confirmation
521 * @param [in] gCb - RLC Instance Control Block
522 * @param [in] ueId - UE Identifier
523 * @param [in] cellId - CELL Identifier
524 * @param [in] entCfg - Entity Configuration to be done.
525 * @param [out] entCfm - Entity Confirmation.
536 RlcEntCfgInfo *entCfg,
537 RlcEntCfgCfmInfo *entCfm
540 RlcDlUeCb *ueCb = NULLP; /* UE Control Block */
541 RlcDlCellCb *cellCb; /* Cell Control Block */
542 RlcDlRbCb *rlcRbCb; /* KW RB Control Block */
543 uint8_t reason; /* Rb Identifier */
545 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgAddRb(cellId(%d),UEID:%d cfgType(%d))",
552 /* Fill entCfm structure */
553 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
554 CKW_CFG_REAS_CELL_UNKWN);
555 DU_LOG("\nERROR --> RLC_DL : Add DLRb,CellId is 0 for UEID:%d",
559 if ((entCfg->rguSapId >= gCb->genCfg.maxRguSaps) || (entCfg->rguSapId < 0))
561 RLCDBGP_ERROR(gCb, "rlcCfgAddDlRb(ueId(%u), cellId(%u), Invalid rguSapId (%d)\n",
562 ueId, cellId, entCfg->rguSapId);
567 /* Process Adding new RB */
570 if(entCfg->rbId >= RLC_MAX_RB_PER_CELL)
572 /* Fill entCfm structure */
573 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
575 CKW_CFG_REAS_RB_UNKWN);
576 DU_LOG("\nERROR --> RLC_DL : Invalid RbId ,Max is [%d] CELLID:%d UEID:%d",
583 if (((entCfg->lCh[0].type == CM_LTE_LCH_BCCH) ||
584 (entCfg->lCh[0].type == CM_LTE_LCH_PCCH) ||
585 (entCfg->lCh[0].type == CM_LTE_LCH_CCCH)) &&
586 (entCfg->entMode == RLC_MODE_TM))
588 /* Cell CB present */
589 rlcDbmFetchDlCellCb(gCb, cellId, &cellCb);
592 /* Get rbCb from cellCb->rbCb List */
593 if (( cellCb->rbCb[entCfg->rbId] != NULLP))
595 /* Fill entCfm structure */
596 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
598 CKW_CFG_REAS_RB_PRSNT);
599 DU_LOG("\nERROR --> RLC_DL : RbId [%d] already exists UEID:%d",
605 else /* Cell CB UNKNOWN */
608 if ( ROK != rlcDbmCreateDlCellCb(gCb,cellId, &cellCb))
610 /* Fill entCfm structure */
611 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
613 CKW_CFG_REAS_CELL_CREAT_FAIL);
614 DU_LOG("\nERROR --> RLC_DL : cellCb Creation failed RBID:%d UEID:%d",
622 if(entCfg->lCh[0].lChId <= 0)
624 DU_LOG("\nERROR --> RLC_DL : Invalid LcId CELLID:%d UEID:%d RBID:%d",
628 /* Fill entCfm structure */
629 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
630 CKW_CFG_CFM_NOK, CKW_CFG_REAS_INVALID_LCHID);
635 RLC_ALLOC(gCb,rlcRbCb, sizeof (RlcDlRbCb));
638 DU_LOG("\nERROR --> RLC_DL : Memory allocation failed for rbId:%d CELLID:%d",
641 /* Fill entCfm structure */
642 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
643 CKW_CFG_CFM_NOK, CKW_CFG_REAS_RB_CREAT_FAIL);
646 rlcRbCb->rlcId.rbId = entCfg->rbId;
647 cellCb->rbCb[entCfg->rbId] = rlcRbCb;
648 RLC_LMM_RB_STS_INC(gCb);
649 cellCb->lCh[entCfg->lCh[0].lChId - 1].dlRbCb = rlcRbCb;
653 reason= (entCfg->entMode != RLC_MODE_TM)? CKW_CFG_REAS_RB_MODE_MIS:
654 CKW_CFG_REAS_LCHTYPE_MIS;
655 /* Fill entCfm structure */
656 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
657 CKW_CFG_CFM_NOK, reason);
663 if (!(RLC_VALIDATE_UE_RBID(entCfg->rbType, entCfg->rbId)))
665 /* Fill entCfm structure */
666 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
667 CKW_CFG_REAS_RB_UNKWN);
668 DU_LOG("\nERROR --> RLC_DL : Invalid RbId for RbType[%d] UEID:%d",
673 if ((((entCfg->lCh[0].type == CM_LTE_LCH_DCCH) &&
674 (entCfg->entMode != RLC_MODE_UM) &&
675 (CM_LTE_SRB == entCfg->rbType)) ||
676 ((entCfg->lCh[0].type == CM_LTE_LCH_DTCH) &&
677 (CM_LTE_DRB == entCfg->rbType))) &&
678 (entCfg->entMode != RLC_MODE_TM))
681 if ( rlcDbmFetchDlUeCb(gCb,ueId, cellId, &ueCb) == ROK)
683 /* Get rbCb from ueCb->rbCb list */
684 RLC_DBM_GET_RBCB_FROM_UECB(entCfg->rbId, entCfg->rbType, ueCb, rlcRbCb);
686 if(( rlcRbCb != NULLP))
688 /* Fill entCfm structure */
689 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
690 CKW_CFG_REAS_RB_PRSNT);
691 DU_LOG("\nERROR --> RLC_DL : CellId[%u]:rbId [%d] already exists",
697 else /* UE CB UNKNOWN */
700 if ( rlcDbmCreateDlUeCb(gCb,ueId, cellId, &ueCb) != ROK)
702 /* Fill entCfm structure */
703 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
704 CKW_CFG_REAS_UE_CREAT_FAIL);
705 DU_LOG("\nERROR --> RLC_DL : UeId [%u]:ueCb Creation Failed RBID:%d",
710 /* Start throughput calculation for this UE */
711 gCb->rlcThpt.thptPerUe[gCb->rlcThpt.numActvUe].ueIdx = ueId;
712 gCb->rlcThpt.thptPerUe[gCb->rlcThpt.numActvUe].dataVol = 0;
713 gCb->rlcThpt.numActvUe++;
715 if((rlcChkTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_THROUGHPUT_TMR)) == FALSE)
717 printf("\nHLAL Starting Throughput timer");
718 rlcStartTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_THROUGHPUT_TMR);
722 /* Validate LChId for UM and AM modes */
723 if ((entCfg->lCh[0].lChId <= 0) ||
724 ((entCfg->entMode == RLC_MODE_AM)&&
725 (entCfg->lCh[1].lChId <= 0)))
727 /* Fill entCfm structure */
728 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
729 CKW_CFG_CFM_NOK, CKW_CFG_REAS_INVALID_LCHID);
734 RLC_ALLOC(gCb,rlcRbCb, sizeof (RlcDlRbCb));
737 /* Fill entCfm structure */
738 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,CKW_CFG_CFM_NOK,
739 CKW_CFG_REAS_RB_CREAT_FAIL);
740 DU_LOG("\nERROR --> RLC_DL : Memory allocation failed RBID:%d CELLID:%d",
746 /* copy the RB Cb into UECb */
747 rlcRbCb->rlcId.rbId = entCfg->rbId;
748 if(entCfg->rbType == CM_LTE_SRB)
749 ueCb->srbCb[entCfg->rbId] = rlcRbCb;
751 ueCb->drbCb[entCfg->rbId] = rlcRbCb;
753 RLC_LMM_RB_STS_INC(gCb);
758 if (entCfg->entMode == RLC_MODE_TM)
760 reason = CKW_CFG_REAS_RB_MODE_MIS;
764 reason = CKW_CFG_REAS_LCHTYPE_MIS;
767 /* Fill entCfm structure */
768 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK, reason);
774 rlcRbCb->rlcId.cellId = cellId;
775 rlcRbCb->rlcId.ueId = ueId;
776 rlcRbCb->rlcId.rbType = entCfg->rbType;
777 rlcRbCb->inst = gCb->init.inst;
778 #ifdef TENB_MULT_CELL_SUPPRT
779 rlcRbCb->rguSapId = entCfg->rguSapId;
784 if (rlcCfgFillDlRbCb(gCb,rlcRbCb, ueCb, entCfg) != ROK)
786 /* Fill entCfm structure */
787 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
788 CKW_CFG_REAS_RB_CREAT_FAIL);
790 /* Delete RB CB created */
791 RLC_FREE(gCb,rlcRbCb, sizeof(RlcDlRbCb));
792 DU_LOG("\nERROR --> RLC_DL : Filling of RbCb failed UEID:%d CELLID:%d",
797 rlcRbCb->qci = entCfg->qci;
799 rlcRbCb->ueCb = ueCb;
800 if (entCfg->lCh[0].type == CM_LTE_LCH_DTCH)
803 rlcAddToDlL2Meas(gCb, rlcRbCb,cellId,ueId);
805 #endif /* LTE_L2_MEAS */
807 /* Fill entCfm structure */
808 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_OK, CKW_CFG_REAS_NONE);
816 * This primitive reconfigures the existing RB in Ue/Cell Cb.
819 * This primitive executes following steps in reconfiguration of existing
821 * - If UE ID is 0 then
822 * - Check for CELL CB is present
823 * - If yes, Check for RB ID
824 * - If RB ID is present Reconfigure the RB CB
825 * - Else, Status Indication with Reason
826 * - Else, Status Indication with Reason
828 * - Check for UE CB is present
829 * - If yes, Check for RB ID
830 * - If RB ID is prenset Reconfigure the CELL CB
831 * - Else, Status Indication with Reason
832 * - Else, Status Indication with Reason
833 * - Fill entity confirmation
835 * @param [in] gCb - RLC Instance Control Block
836 * @param [in] ueId - UE Identifier
837 * @param [in] cellId - CELL Identifier
838 * @param [in] entCfg - Entity Configuration to be done.
839 * @param [out] entCfm - Entity Confirmation
850 RlcEntCfgInfo *entCfg,
851 RlcEntCfgCfmInfo *entCfm
854 RlcDlRbCb *rbCb; /* RB Control Block */
855 RlcDlRbCb tRbCb; /* KW RB Control Block */
856 RlcDlCellCb *cellCb; /* Cell Control Block */
857 RlcDlUeCb *ueCb; /* Ue Control Block */
860 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgReCfgRb(cellId(%d), cfgType(%d)) RBID:%d",
861 cellId, entCfg->cfgType,entCfg->rbId);
864 /* Check for UeCb or CellCb */
867 if(entCfg->rbId >= RLC_MAX_RB_PER_CELL)
869 /* Fill entCfm structure */
870 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
871 CKW_CFG_REAS_RB_UNKWN);
872 DU_LOG("\nERROR --> RLC_DL : Invalid RbId , Max is [%d] UEID:%d CELLID:%d",
879 rlcDbmFetchDlCellCb(gCb,cellId, &cellCb);
882 /* Fill entCfm structure */
883 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
884 CKW_CFG_REAS_CELL_UNKWN);
885 DU_LOG("\nERROR --> RLC_DL : CellCb not found ueId:%d RBID:%d CELLID:%d",
893 RLC_DBM_GET_CELL_RBCB(entCfg->rbId, cellCb->rbCb, rbCb);
897 /* Fill entCfm structure */
898 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
899 CKW_CFG_REAS_RB_UNKWN);
900 DU_LOG("\nERROR --> RLC_DL : CELLID:%d RBID:%d not found",
906 /* Take backup of rbCb before updating.
907 * Because in failure case restore original rbCb
909 memcpy(&tRbCb, rbCb, sizeof(RlcDlRbCb));
912 ret = rlcCfgUpdateDlRb(gCb,rbCb, cellCb,entCfg);
915 /* Fill entCfm structure */
916 RLC_CFG_FILL_CFG_CFM(entCfm,
922 DU_LOG("\nERROR --> RLC_DL : CELLID:%u RBID:%d updation failed",
925 memcpy(rbCb, &tRbCb, sizeof(RlcDlRbCb));
932 if (!(RLC_VALIDATE_UE_RBID(entCfg->rbType, entCfg->rbId)))
934 /* Fill entCfm structure */
935 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
936 CKW_CFG_REAS_RB_UNKWN);
937 DU_LOG("\nERROR --> RLC_DL : CELLID:%d Invalid RBID:%d for RbType[%d]",
944 ret = rlcDbmFetchDlUeCb(gCb,ueId, cellId, &ueCb);
947 /* Fill entCfm structure */
948 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
949 CKW_CFG_CFM_NOK, CKW_CFG_REAS_UE_UNKWN);
950 DU_LOG("\nERROR --> RLC_DL : UEID:%d UeCb not found RBID:%d",
957 RLC_DBM_GET_RBCB_FROM_UECB(entCfg->rbId, entCfg->rbType, ueCb, rbCb);
961 /* Fill entCfm structure */
962 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
963 CKW_CFG_REAS_RB_UNKWN);
964 DU_LOG("\nERROR --> RLC_DL : CELLID:%d RBID:%d not found",
970 /* Take backup of rbCb before updating.
971 * Because in failure case restore original rbCb
973 memcpy(&tRbCb, rbCb, sizeof(RlcDlRbCb));
976 ret = rlcCfgUpdateDlRb(gCb,rbCb,ueCb, entCfg);
977 if (ret != CKW_CFG_REAS_NONE)
979 /* Fill entCfm structure */
980 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
982 DU_LOG("\nERROR --> RLC_DL : CELLID:%d RBID:%d updation failed",
985 memcpy(rbCb, &tRbCb, sizeof(RlcDlRbCb));
991 /* Fill entCfm structure */
992 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_OK, CKW_CFG_REAS_NONE);
999 * @brief This primitive deletes the existing RB in Ue/Cell Cb.
1002 * - If UE ID is 0 then
1003 * - Check for CELL CB is present
1004 * - If yes, Check for RB ID
1005 * - If RB ID is prenset Delete the RB CB
1006 * - If there is no RB CB exist in CELL CB then Delete CELL CB.
1007 * - Else, Status Indication with Reason
1008 * - Else, Status Indication with Reason
1010 * - Check for UE CB is present
1011 * - If yes, Check for RB ID
1012 * - If RB ID is prenset Delete the RB CB
1013 * - If there is no RB CB exist in UE CB then Delete UE CB.
1014 * - Else, Status Indication with Reason
1015 * - Else, Status Indication with Reason
1016 * - Fill entity confirmation
1018 * @param [in] gCb - RLC Instance Control Block
1019 * @param [in] ueId - UE Identifier
1020 * @param [in] cellId - CELL Identifier
1021 * @param [in] entCfg - Entity Configuration to be done.
1022 * @param [out] entCfm - Entity Confirmation
1033 RlcEntCfgInfo *entCfg,
1034 RlcEntCfgCfmInfo *entCfm
1037 S16 ret; /* Return Value */
1038 RlcDlUeCb *ueCb; /* UE Control Block */
1039 RlcDlCellCb *cellCb; /* UE Control Block */
1040 RlcDlRbCb *rlcRbCb; /* KW RB Control Block */
1042 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgDelRb(RBID(%d), cellId(%d), cfgType(%d))",
1049 /* Get cellCb and delete rbCb from it */
1052 if(entCfg->rbId >= RLC_MAX_RB_PER_CELL)
1054 /* Fill entCfm structure */
1055 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1056 CKW_CFG_CFM_NOK, CKW_CFG_REAS_RB_UNKWN);
1057 DU_LOG("\nERROR --> RLC_DL : Invalid RbId, Max is [%d] UEID:%d CELLID:%d",
1058 RLC_MAX_RB_PER_CELL,
1064 rlcDbmFetchDlCellCb(gCb,cellId, &cellCb);
1067 /* Fill entCfm structure */
1068 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1069 CKW_CFG_CFM_NOK, CKW_CFG_REAS_RB_UNKWN);
1070 DU_LOG("\nERROR --> RLC_DL : CellCb not found UEID:%d RBID:%d",
1077 RLC_DBM_GET_CELL_RBCB(entCfg->rbId, cellCb->rbCb, rlcRbCb);
1079 if ( rlcRbCb == NULLP)
1081 /* Fill entCfm structure */
1082 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1083 CKW_CFG_CFM_NOK, CKW_CFG_REAS_RB_UNKWN);
1084 DU_LOG("\nERROR --> RLC_DL : CellId[%u]:RbId[%d] not found",
1090 /* Assign NULLP to rbCb in rbCbLst */
1091 cellCb->rbCb[entCfg->rbId] = NULLP;
1093 /* Assign NULLP to dlRbCb/ulRbCb.
1094 * Delete Hashlist allocated for it if any */
1095 cellCb->lCh[rlcRbCb->lch.lChId - 1].dlRbCb = NULLP;
1096 RLC_FREE(gCb,rlcRbCb, sizeof(RlcDlRbCb)); /*Vartika: Mem leak fix */
1098 /* Get ueCb and delete rbCb from it */
1101 if (!(RLC_VALIDATE_UE_RBID(entCfg->rbType, entCfg->rbId)))
1103 /* Fill entCfm structure */
1104 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1105 CKW_CFG_CFM_NOK, CKW_CFG_REAS_RB_UNKWN);
1106 DU_LOG("\nERROR --> RLC_DL : Invalid RbId for RbType[%d] UEID:%d CELLID:%d",
1114 ret = rlcDbmFetchDlUeCb(gCb,ueId, cellId, &ueCb);
1117 /* Fill entCfm structure */
1118 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1119 CKW_CFG_CFM_NOK, CKW_CFG_REAS_UE_UNKWN);
1120 DU_LOG("\nERROR --> RLC_DL : UeId [%d]: UeCb not found RBID:%d",
1127 RLC_DBM_GET_RBCB_FROM_UECB(entCfg->rbId, entCfg->rbType, ueCb, rlcRbCb);
1129 if ( rlcRbCb == NULLP)
1131 /* Fill entCfm structure */
1132 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
1133 CKW_CFG_REAS_RB_UNKWN);
1134 DU_LOG("\nERROR --> RLC_DL : CellId[%u]:RbId[%d] not found",
1140 ueCb->lCh[rlcRbCb->lch.lChId - 1].dlRbCb = NULLP;
1143 RLC_UPD_L2_DECR_NONIP_PER_QCI_RB_COUNT(gCb, rlcRbCb);
1145 /* Free the Buffers of RbCb */
1146 if( RLC_MODE_UM == rlcRbCb->mode)
1148 rlcUmmFreeDlRbCb(gCb,rlcRbCb);
1150 RLC_FREE(gCb,rlcRbCb, sizeof(RlcDlRbCb));
1152 else if( RLC_MODE_AM == rlcRbCb->mode)
1154 rlcAmmFreeDlRbCb(gCb,rlcRbCb);
1157 /* Assign NULLP to rbCb in rbCbLst */
1158 if ( entCfg->rbType == CM_LTE_SRB )
1160 ueCb->srbCb[entCfg->rbId] = NULLP;
1164 ueCb->drbCb[entCfg->rbId] = NULLP;
1168 RLC_LMM_RB_STS_DEC(gCb);
1170 /* Fill entCfm structure */
1171 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_OK,
1179 * @brief This primitive re-establish the existing RB in Ue/Cell Cb.
1182 * - If UE ID is 0 then
1183 * - Check for CELL CB is present
1184 * - If yes, Check for RB ID
1185 * - If RB ID is prenset initialize the parameters of the RB CB
1186 * - Else, Status Indication with Reason
1187 * - Else, Status Indication with Reason
1189 * - Check for UE CB is present
1190 * - If yes, Check for RB ID
1191 * - If RB ID is prenset initialize the parameters of the RB CB
1192 * - Else, Status Indication with Reason
1193 * - Else, Status Indication with Reason
1194 * - Fill entity confirmation
1196 * @param [in] gCb - RLC Instance Control Block
1197 * @param [in] ueId - UE Identifier
1198 * @param [in] cellId - CELL Identifier
1199 * @param [in] entCfg - Entity Configuration to be done.
1200 * @param [out] entCfm - Entity Confirmation
1212 RlcEntCfgInfo *entCfg,
1213 RlcEntCfgCfmInfo *entCfm
1216 RlcDlRbCb *rbCb; /* RB Control Block */
1217 CmLteRlcId rlcId; /* RLC Identifier */
1219 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgReEstDlRb(ueId(%d), cellId(%d), cfgType(%d))",
1226 rlcId.cellId = cellId;
1227 rlcId.rbId = entCfg->rbId;
1228 rlcId.rbType = entCfg->rbType;
1230 rlcDbmFetchDlRbCbByRbId(gCb,&rlcId, &rbCb);
1233 /* Fill entCfm structure */
1234 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, rlcId.rbType, CKW_CFG_CFM_NOK,
1235 CKW_CFG_REAS_RB_UNKWN);
1236 DU_LOG("\nERROR --> RLC_DL : CellId[%u]:RbId[%d] not found",
1242 rbCb->rlcId.ueId = ueId;
1248 rlcDlTmmReEstablish(gCb,rbCb);
1254 rlcDlUmmReEstablish(gCb,rlcId,sndReEstInd,rbCb);
1260 rlcAmmDlReEstablish(gCb, rlcId, rbCb);
1265 /* Fill entCfm structure */
1266 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1267 CKW_CFG_CFM_OK, CKW_CFG_REAS_NONE);
1274 * @brief This primitive deletes the RBs in Ue Cb.
1277 * - If UE ID is 0 then
1278 * - Status Indication with Reason
1280 * - Check for UE CB is present
1281 * - If yes, Delete all RB CB in UE CB and Delete UE CB also.
1282 * - Else, Status Indication with Reason
1283 * - Fill entity confirmation
1285 * @param [in] gCb - RLC Instance Control Block
1286 * @param [in] ueId - UE Identifier
1287 * @param [in] cellId - CELL Identifier
1288 * @param [in] entCfg - Entity Configuration to be done.
1289 * @param [out] entCfm - Entity Confirmation
1300 RlcEntCfgInfo *entCfg,
1301 RlcEntCfgCfmInfo *entCfm
1304 S16 ret; /* Return Value */
1305 RlcDlUeCb *ueCb; /* UE Control Block */
1307 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgDelUe(ueId(%d), cellId(%d), cfgType(%d))",
1314 /* Check for ueId is present or not */
1317 /* Fill entCfm structure */
1318 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1319 CKW_CFG_CFM_NOK, CKW_CFG_REAS_UE_UNKWN);
1320 DU_LOG("\nERROR --> RLC_DL : ueId(%d), cellId(%d)",
1327 ret = rlcDbmFetchDlUeCb(gCb,ueId, cellId, &ueCb);
1330 /* Fill entCfm structure */
1331 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1332 CKW_CFG_CFM_NOK, CKW_CFG_REAS_UE_UNKWN);
1333 DU_LOG("\nERROR --> RLC_DL : UEID:%d UeCb not found RBID:%d",
1340 rlcDelFrmDlL2Meas(gCb,cellId,ueId);
1341 rlcDbmDelAllDlL2MeasTbFrmUe(gCb,ueCb);
1344 rlcDbmDelDlUeCb(gCb,ueCb, FALSE);
1346 /* Fill entCfm structure */
1347 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1348 CKW_CFG_CFM_OK, CKW_CFG_REAS_NONE);
1355 * @brief This primitive deletes the RBs in Ue Cb.
1358 * - If CELL ID is 0 then
1359 * - Status Indication with Reason
1361 * - Check for CELL CB is present
1362 * - If yes, Delete all RB CB in CELL CB and Delete CELL CB also.
1363 * - Else, Status Indication with Reason
1364 * - Fill entity confirmation
1366 * @param [in] cellId - CELL Identifier
1367 * @param [in] entCfg - Entity Configuration to be done.
1368 * @param [out] entCfm - Entity Confirmation
1378 RlcEntCfgInfo *entCfg,
1379 RlcEntCfgCfmInfo *entCfm
1382 RlcDlCellCb *cellCb; /* UE Control Block */
1383 uint8_t rbId; /* RB Identifier */
1385 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgDelCell( cellId(%d), cfgType(%d)",
1390 rbId = entCfg->rbId;
1392 /* Check for ueId is present or not */
1395 /* Fill entCfm structure */
1396 RLC_CFG_FILL_CFG_CFM(entCfm, rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
1397 CKW_CFG_REAS_CELL_UNKWN);
1398 DU_LOG("\nERROR --> RLC_DL : cellId is 0 (%d) ",
1404 rlcDbmFetchDlCellCb(gCb,cellId, &cellCb);
1407 /* Fill entCfm structure */
1408 RLC_CFG_FILL_CFG_CFM(entCfm, rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
1409 CKW_CFG_REAS_CELL_UNKWN);
1410 DU_LOG("\nERROR --> RLC_DL : CellCb not found for RBID:%d",
1416 rlcDbmDelDlCellCb(gCb,cellCb);
1418 /* Fill entCfm structure */
1419 /* kw005.201 added support for L2 Measurement */
1420 RLC_CFG_FILL_CFG_CFM(entCfm, rbId, entCfg->rbType, CKW_CFG_CFM_OK,
1427 * @brief This primitive changes the ueId of Ue Cb.
1430 * - If oldUeId and newUeId are
1431 * - Confirm the Status with Reason
1432 * - If UeId not present
1433 * - Confirm the Status with Reason
1435 * - Copy rbCbs from old UeCb to new UeCb
1437 * - Fill entity confirmation
1439 * @param [in] ueInfo - Old UE Information
1440 * @param [in] newUeInfo - New UE Information
1441 * @param [out] status - Status
1447 S16 rlcCfgDlUeIdChng
1451 CkwUeInfo *newUeInfo,
1456 /*kw004.201 Adding of Missing Trace in RLC PDCP*/
1458 if ( (ueInfo->ueId == newUeInfo->ueId) &&
1459 (ueInfo->cellId == newUeInfo->cellId))
1461 status->reason = CKW_CFG_REAS_SAME_UEID;
1462 status->status = CKW_CFG_CFM_NOK;
1463 DU_LOG("\nERROR --> RLC_DL : Old UeId[%d] same as new UeId[%d]",
1469 if(ROK == rlcDbmFetchDlUeCb(gCb,newUeInfo->ueId, newUeInfo->cellId, &ueCb))
1471 DU_LOG("\nERROR --> RLC_DL : NewUeId[%d]:ueCb already exists",
1473 status->reason = CKW_CFG_REAS_UE_EXISTS;
1474 status->status = CKW_CFG_CFM_NOK;
1478 if(ROK != rlcDbmFetchDlUeCb(gCb,ueInfo->ueId, ueInfo->cellId, &ueCb))
1481 DU_LOG("\nERROR --> RLC_DL : UeId [%d]: UeCb not found",
1483 status->reason = CKW_CFG_REAS_UE_UNKWN;
1484 status->status = CKW_CFG_CFM_NOK;
1489 rlcHdlMeasDlUeIdChg(gCb, ueInfo->cellId, ueInfo->ueId, newUeInfo->ueId);
1491 if(ROK != cmHashListDelete(&(gCb->u.dlCb->ueLstCp), (PTR) ueCb))
1493 DU_LOG("\nERROR --> RLC_DL : UeId[%u] HashList Deletion Failed",
1495 status->reason = CKW_CFG_REAS_UE_CREAT_FAIL;
1496 status->status = CKW_CFG_CFM_NOK;
1500 /* update the hash key with new values */
1501 ueCb->ueId = newUeInfo->ueId;
1502 ueCb->cellId = newUeInfo->cellId;
1504 if(ROK != cmHashListInsert(&(gCb->u.dlCb->ueLstCp),
1505 (PTR)ueCb, (uint8_t *)&(ueCb->ueId),
1506 (uint16_t) sizeof(CmLteRnti)))
1509 DU_LOG("\nERROR --> RLC_DL : UeId[%u] HashList Insertion Failed",
1511 status->reason = CKW_CFG_REAS_UE_CREAT_FAIL;
1512 status->status = CKW_CFG_CFM_NOK;
1519 /********************************************************************30**
1522 **********************************************************************/