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",
712 /* Validate LChId for UM and AM modes */
713 if ((entCfg->lCh[0].lChId <= 0) ||
714 ((entCfg->entMode == RLC_MODE_AM)&&
715 (entCfg->lCh[1].lChId <= 0)))
717 /* Fill entCfm structure */
718 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
719 CKW_CFG_CFM_NOK, CKW_CFG_REAS_INVALID_LCHID);
724 RLC_ALLOC(gCb,rlcRbCb, sizeof (RlcDlRbCb));
727 /* Fill entCfm structure */
728 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,CKW_CFG_CFM_NOK,
729 CKW_CFG_REAS_RB_CREAT_FAIL);
730 DU_LOG("\nERROR --> RLC_DL : Memory allocation failed RBID:%d CELLID:%d",
736 /* copy the RB Cb into UECb */
737 rlcRbCb->rlcId.rbId = entCfg->rbId;
738 if(entCfg->rbType == CM_LTE_SRB)
739 ueCb->srbCb[entCfg->rbId] = rlcRbCb;
741 ueCb->drbCb[entCfg->rbId] = rlcRbCb;
743 RLC_LMM_RB_STS_INC(gCb);
748 if (entCfg->entMode == RLC_MODE_TM)
750 reason = CKW_CFG_REAS_RB_MODE_MIS;
754 reason = CKW_CFG_REAS_LCHTYPE_MIS;
757 /* Fill entCfm structure */
758 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK, reason);
764 rlcRbCb->rlcId.cellId = cellId;
765 rlcRbCb->rlcId.ueId = ueId;
766 rlcRbCb->rlcId.rbType = entCfg->rbType;
767 rlcRbCb->inst = gCb->init.inst;
768 #ifdef TENB_MULT_CELL_SUPPRT
769 rlcRbCb->rguSapId = entCfg->rguSapId;
774 if (rlcCfgFillDlRbCb(gCb,rlcRbCb, ueCb, entCfg) != ROK)
776 /* Fill entCfm structure */
777 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
778 CKW_CFG_REAS_RB_CREAT_FAIL);
780 /* Delete RB CB created */
781 RLC_FREE(gCb,rlcRbCb, sizeof(RlcDlRbCb));
782 DU_LOG("\nERROR --> RLC_DL : Filling of RbCb failed UEID:%d CELLID:%d",
787 rlcRbCb->qci = entCfg->qci;
789 rlcRbCb->ueCb = ueCb;
790 if (entCfg->lCh[0].type == CM_LTE_LCH_DTCH)
793 rlcAddToDlL2Meas(gCb, rlcRbCb,cellId,ueId);
795 #endif /* LTE_L2_MEAS */
797 /* Fill entCfm structure */
798 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_OK, CKW_CFG_REAS_NONE);
806 * This primitive reconfigures the existing RB in Ue/Cell Cb.
809 * This primitive executes following steps in reconfiguration of existing
811 * - If UE ID is 0 then
812 * - Check for CELL CB is present
813 * - If yes, Check for RB ID
814 * - If RB ID is present Reconfigure the RB CB
815 * - Else, Status Indication with Reason
816 * - Else, Status Indication with Reason
818 * - Check for UE CB is present
819 * - If yes, Check for RB ID
820 * - If RB ID is prenset Reconfigure the CELL CB
821 * - Else, Status Indication with Reason
822 * - Else, Status Indication with Reason
823 * - Fill entity confirmation
825 * @param [in] gCb - RLC Instance Control Block
826 * @param [in] ueId - UE Identifier
827 * @param [in] cellId - CELL Identifier
828 * @param [in] entCfg - Entity Configuration to be done.
829 * @param [out] entCfm - Entity Confirmation
840 RlcEntCfgInfo *entCfg,
841 RlcEntCfgCfmInfo *entCfm
844 RlcDlRbCb *rbCb; /* RB Control Block */
845 RlcDlRbCb tRbCb; /* KW RB Control Block */
846 RlcDlCellCb *cellCb; /* Cell Control Block */
847 RlcDlUeCb *ueCb; /* Ue Control Block */
850 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgReCfgRb(cellId(%d), cfgType(%d)) RBID:%d",
851 cellId, entCfg->cfgType,entCfg->rbId);
854 /* Check for UeCb or CellCb */
857 if(entCfg->rbId >= RLC_MAX_RB_PER_CELL)
859 /* Fill entCfm structure */
860 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
861 CKW_CFG_REAS_RB_UNKWN);
862 DU_LOG("\nERROR --> RLC_DL : Invalid RbId , Max is [%d] UEID:%d CELLID:%d",
869 rlcDbmFetchDlCellCb(gCb,cellId, &cellCb);
872 /* Fill entCfm structure */
873 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
874 CKW_CFG_REAS_CELL_UNKWN);
875 DU_LOG("\nERROR --> RLC_DL : CellCb not found ueId:%d RBID:%d CELLID:%d",
883 RLC_DBM_GET_CELL_RBCB(entCfg->rbId, cellCb->rbCb, rbCb);
887 /* Fill entCfm structure */
888 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
889 CKW_CFG_REAS_RB_UNKWN);
890 DU_LOG("\nERROR --> RLC_DL : CELLID:%d RBID:%d not found",
896 /* Take backup of rbCb before updating.
897 * Because in failure case restore original rbCb
899 memcpy(&tRbCb, rbCb, sizeof(RlcDlRbCb));
902 ret = rlcCfgUpdateDlRb(gCb,rbCb, cellCb,entCfg);
905 /* Fill entCfm structure */
906 RLC_CFG_FILL_CFG_CFM(entCfm,
912 DU_LOG("\nERROR --> RLC_DL : CELLID:%u RBID:%d updation failed",
915 memcpy(rbCb, &tRbCb, sizeof(RlcDlRbCb));
922 if (!(RLC_VALIDATE_UE_RBID(entCfg->rbType, entCfg->rbId)))
924 /* Fill entCfm structure */
925 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
926 CKW_CFG_REAS_RB_UNKWN);
927 DU_LOG("\nERROR --> RLC_DL : CELLID:%d Invalid RBID:%d for RbType[%d]",
934 ret = rlcDbmFetchDlUeCb(gCb,ueId, cellId, &ueCb);
937 /* Fill entCfm structure */
938 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
939 CKW_CFG_CFM_NOK, CKW_CFG_REAS_UE_UNKWN);
940 DU_LOG("\nERROR --> RLC_DL : UEID:%d UeCb not found RBID:%d",
947 RLC_DBM_GET_RBCB_FROM_UECB(entCfg->rbId, entCfg->rbType, ueCb, rbCb);
951 /* Fill entCfm structure */
952 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
953 CKW_CFG_REAS_RB_UNKWN);
954 DU_LOG("\nERROR --> RLC_DL : CELLID:%d RBID:%d not found",
960 /* Take backup of rbCb before updating.
961 * Because in failure case restore original rbCb
963 memcpy(&tRbCb, rbCb, sizeof(RlcDlRbCb));
966 ret = rlcCfgUpdateDlRb(gCb,rbCb,ueCb, entCfg);
967 if (ret != CKW_CFG_REAS_NONE)
969 /* Fill entCfm structure */
970 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
972 DU_LOG("\nERROR --> RLC_DL : CELLID:%d RBID:%d updation failed",
975 memcpy(rbCb, &tRbCb, sizeof(RlcDlRbCb));
981 /* Fill entCfm structure */
982 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_OK, CKW_CFG_REAS_NONE);
989 * @brief This primitive deletes the existing RB in Ue/Cell Cb.
992 * - If UE ID is 0 then
993 * - Check for CELL CB is present
994 * - If yes, Check for RB ID
995 * - If RB ID is prenset Delete the RB CB
996 * - If there is no RB CB exist in CELL CB then Delete CELL CB.
997 * - Else, Status Indication with Reason
998 * - Else, Status Indication with Reason
1000 * - Check for UE 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 UE CB then Delete UE CB.
1004 * - Else, Status Indication with Reason
1005 * - Else, Status Indication with Reason
1006 * - Fill entity confirmation
1008 * @param [in] gCb - RLC Instance Control Block
1009 * @param [in] ueId - UE Identifier
1010 * @param [in] cellId - CELL Identifier
1011 * @param [in] entCfg - Entity Configuration to be done.
1012 * @param [out] entCfm - Entity Confirmation
1023 RlcEntCfgInfo *entCfg,
1024 RlcEntCfgCfmInfo *entCfm
1027 S16 ret; /* Return Value */
1028 RlcDlUeCb *ueCb; /* UE Control Block */
1029 RlcDlCellCb *cellCb; /* UE Control Block */
1030 RlcDlRbCb *rlcRbCb; /* KW RB Control Block */
1032 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgDelRb(RBID(%d), cellId(%d), cfgType(%d))",
1039 /* Get cellCb and delete rbCb from it */
1042 if(entCfg->rbId >= RLC_MAX_RB_PER_CELL)
1044 /* Fill entCfm structure */
1045 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1046 CKW_CFG_CFM_NOK, CKW_CFG_REAS_RB_UNKWN);
1047 DU_LOG("\nERROR --> RLC_DL : Invalid RbId, Max is [%d] UEID:%d CELLID:%d",
1048 RLC_MAX_RB_PER_CELL,
1054 rlcDbmFetchDlCellCb(gCb,cellId, &cellCb);
1057 /* Fill entCfm structure */
1058 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1059 CKW_CFG_CFM_NOK, CKW_CFG_REAS_RB_UNKWN);
1060 DU_LOG("\nERROR --> RLC_DL : CellCb not found UEID:%d RBID:%d",
1067 RLC_DBM_GET_CELL_RBCB(entCfg->rbId, cellCb->rbCb, rlcRbCb);
1069 if ( rlcRbCb == NULLP)
1071 /* Fill entCfm structure */
1072 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1073 CKW_CFG_CFM_NOK, CKW_CFG_REAS_RB_UNKWN);
1074 DU_LOG("\nERROR --> RLC_DL : CellId[%u]:RbId[%d] not found",
1080 /* Assign NULLP to rbCb in rbCbLst */
1081 cellCb->rbCb[entCfg->rbId] = NULLP;
1083 /* Assign NULLP to dlRbCb/ulRbCb.
1084 * Delete Hashlist allocated for it if any */
1085 cellCb->lCh[rlcRbCb->lch.lChId - 1].dlRbCb = NULLP;
1086 RLC_FREE(gCb,rlcRbCb, sizeof(RlcDlRbCb)); /*Vartika: Mem leak fix */
1088 /* Get ueCb and delete rbCb from it */
1091 if (!(RLC_VALIDATE_UE_RBID(entCfg->rbType, entCfg->rbId)))
1093 /* Fill entCfm structure */
1094 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1095 CKW_CFG_CFM_NOK, CKW_CFG_REAS_RB_UNKWN);
1096 DU_LOG("\nERROR --> RLC_DL : Invalid RbId for RbType[%d] UEID:%d CELLID:%d",
1104 ret = rlcDbmFetchDlUeCb(gCb,ueId, cellId, &ueCb);
1107 /* Fill entCfm structure */
1108 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1109 CKW_CFG_CFM_NOK, CKW_CFG_REAS_UE_UNKWN);
1110 DU_LOG("\nERROR --> RLC_DL : UeId [%d]: UeCb not found RBID:%d",
1117 RLC_DBM_GET_RBCB_FROM_UECB(entCfg->rbId, entCfg->rbType, ueCb, rlcRbCb);
1119 if ( rlcRbCb == NULLP)
1121 /* Fill entCfm structure */
1122 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
1123 CKW_CFG_REAS_RB_UNKWN);
1124 DU_LOG("\nERROR --> RLC_DL : CellId[%u]:RbId[%d] not found",
1130 ueCb->lCh[rlcRbCb->lch.lChId - 1].dlRbCb = NULLP;
1133 RLC_UPD_L2_DECR_NONIP_PER_QCI_RB_COUNT(gCb, rlcRbCb);
1135 /* Free the Buffers of RbCb */
1136 if( RLC_MODE_UM == rlcRbCb->mode)
1138 rlcUmmFreeDlRbCb(gCb,rlcRbCb);
1140 RLC_FREE(gCb,rlcRbCb, sizeof(RlcDlRbCb));
1142 else if( RLC_MODE_AM == rlcRbCb->mode)
1144 rlcAmmFreeDlRbCb(gCb,rlcRbCb);
1147 /* Assign NULLP to rbCb in rbCbLst */
1148 if ( entCfg->rbType == CM_LTE_SRB )
1150 ueCb->srbCb[entCfg->rbId] = NULLP;
1154 ueCb->drbCb[entCfg->rbId] = NULLP;
1158 RLC_LMM_RB_STS_DEC(gCb);
1160 /* Fill entCfm structure */
1161 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType, CKW_CFG_CFM_OK,
1169 * @brief This primitive re-establish the existing RB in Ue/Cell Cb.
1172 * - If UE ID is 0 then
1173 * - Check for CELL CB is present
1174 * - If yes, Check for RB ID
1175 * - If RB ID is prenset initialize the parameters of the RB CB
1176 * - Else, Status Indication with Reason
1177 * - Else, Status Indication with Reason
1179 * - Check for UE CB is present
1180 * - If yes, Check for RB ID
1181 * - If RB ID is prenset initialize the parameters of the RB CB
1182 * - Else, Status Indication with Reason
1183 * - Else, Status Indication with Reason
1184 * - Fill entity confirmation
1186 * @param [in] gCb - RLC Instance Control Block
1187 * @param [in] ueId - UE Identifier
1188 * @param [in] cellId - CELL Identifier
1189 * @param [in] entCfg - Entity Configuration to be done.
1190 * @param [out] entCfm - Entity Confirmation
1202 RlcEntCfgInfo *entCfg,
1203 RlcEntCfgCfmInfo *entCfm
1206 RlcDlRbCb *rbCb; /* RB Control Block */
1207 CmLteRlcId rlcId; /* RLC Identifier */
1209 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgReEstDlRb(ueId(%d), cellId(%d), cfgType(%d))",
1216 rlcId.cellId = cellId;
1217 rlcId.rbId = entCfg->rbId;
1218 rlcId.rbType = entCfg->rbType;
1220 rlcDbmFetchDlRbCbByRbId(gCb,&rlcId, &rbCb);
1223 /* Fill entCfm structure */
1224 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, rlcId.rbType, CKW_CFG_CFM_NOK,
1225 CKW_CFG_REAS_RB_UNKWN);
1226 DU_LOG("\nERROR --> RLC_DL : CellId[%u]:RbId[%d] not found",
1232 rbCb->rlcId.ueId = ueId;
1238 rlcDlTmmReEstablish(gCb,rbCb);
1244 rlcDlUmmReEstablish(gCb,rlcId,sndReEstInd,rbCb);
1250 rlcAmmDlReEstablish(gCb, rlcId, rbCb);
1255 /* Fill entCfm structure */
1256 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1257 CKW_CFG_CFM_OK, CKW_CFG_REAS_NONE);
1264 * @brief This primitive deletes the RBs in Ue Cb.
1267 * - If UE ID is 0 then
1268 * - Status Indication with Reason
1270 * - Check for UE CB is present
1271 * - If yes, Delete all RB CB in UE CB and Delete UE CB also.
1272 * - Else, Status Indication with Reason
1273 * - Fill entity confirmation
1275 * @param [in] gCb - RLC Instance Control Block
1276 * @param [in] ueId - UE Identifier
1277 * @param [in] cellId - CELL Identifier
1278 * @param [in] entCfg - Entity Configuration to be done.
1279 * @param [out] entCfm - Entity Confirmation
1290 RlcEntCfgInfo *entCfg,
1291 RlcEntCfgCfmInfo *entCfm
1294 S16 ret; /* Return Value */
1295 RlcDlUeCb *ueCb; /* UE Control Block */
1297 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgDelUe(ueId(%d), cellId(%d), cfgType(%d))",
1304 /* Check for ueId is present or not */
1307 /* Fill entCfm structure */
1308 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1309 CKW_CFG_CFM_NOK, CKW_CFG_REAS_UE_UNKWN);
1310 DU_LOG("\nERROR --> RLC_DL : ueId(%d), cellId(%d)",
1317 ret = rlcDbmFetchDlUeCb(gCb,ueId, cellId, &ueCb);
1320 /* Fill entCfm structure */
1321 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1322 CKW_CFG_CFM_NOK, CKW_CFG_REAS_UE_UNKWN);
1323 DU_LOG("\nERROR --> RLC_DL : UEID:%d UeCb not found RBID:%d",
1330 rlcDelFrmDlL2Meas(gCb,cellId,ueId);
1331 rlcDbmDelAllDlL2MeasTbFrmUe(gCb,ueCb);
1334 rlcDbmDelDlUeCb(gCb,ueCb, FALSE);
1336 /* Fill entCfm structure */
1337 RLC_CFG_FILL_CFG_CFM(entCfm, entCfg->rbId, entCfg->rbType,
1338 CKW_CFG_CFM_OK, CKW_CFG_REAS_NONE);
1345 * @brief This primitive deletes the RBs in Ue Cb.
1348 * - If CELL ID is 0 then
1349 * - Status Indication with Reason
1351 * - Check for CELL CB is present
1352 * - If yes, Delete all RB CB in CELL CB and Delete CELL CB also.
1353 * - Else, Status Indication with Reason
1354 * - Fill entity confirmation
1356 * @param [in] cellId - CELL Identifier
1357 * @param [in] entCfg - Entity Configuration to be done.
1358 * @param [out] entCfm - Entity Confirmation
1368 RlcEntCfgInfo *entCfg,
1369 RlcEntCfgCfmInfo *entCfm
1372 RlcDlCellCb *cellCb; /* UE Control Block */
1373 uint8_t rbId; /* RB Identifier */
1375 DU_LOG("\nDEBUG --> RLC_DL : rlcCfgDelCell( cellId(%d), cfgType(%d)",
1380 rbId = entCfg->rbId;
1382 /* Check for ueId is present or not */
1385 /* Fill entCfm structure */
1386 RLC_CFG_FILL_CFG_CFM(entCfm, rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
1387 CKW_CFG_REAS_CELL_UNKWN);
1388 DU_LOG("\nERROR --> RLC_DL : cellId is 0 (%d) ",
1394 rlcDbmFetchDlCellCb(gCb,cellId, &cellCb);
1397 /* Fill entCfm structure */
1398 RLC_CFG_FILL_CFG_CFM(entCfm, rbId, entCfg->rbType, CKW_CFG_CFM_NOK,
1399 CKW_CFG_REAS_CELL_UNKWN);
1400 DU_LOG("\nERROR --> RLC_DL : CellCb not found for RBID:%d",
1406 rlcDbmDelDlCellCb(gCb,cellCb);
1408 /* Fill entCfm structure */
1409 /* kw005.201 added support for L2 Measurement */
1410 RLC_CFG_FILL_CFG_CFM(entCfm, rbId, entCfg->rbType, CKW_CFG_CFM_OK,
1417 * @brief This primitive changes the ueId of Ue Cb.
1420 * - If oldUeId and newUeId are
1421 * - Confirm the Status with Reason
1422 * - If UeId not present
1423 * - Confirm the Status with Reason
1425 * - Copy rbCbs from old UeCb to new UeCb
1427 * - Fill entity confirmation
1429 * @param [in] ueInfo - Old UE Information
1430 * @param [in] newUeInfo - New UE Information
1431 * @param [out] status - Status
1437 S16 rlcCfgDlUeIdChng
1441 CkwUeInfo *newUeInfo,
1446 /*kw004.201 Adding of Missing Trace in RLC PDCP*/
1448 if ( (ueInfo->ueId == newUeInfo->ueId) &&
1449 (ueInfo->cellId == newUeInfo->cellId))
1451 status->reason = CKW_CFG_REAS_SAME_UEID;
1452 status->status = CKW_CFG_CFM_NOK;
1453 DU_LOG("\nERROR --> RLC_DL : Old UeId[%d] same as new UeId[%d]",
1459 if(ROK == rlcDbmFetchDlUeCb(gCb,newUeInfo->ueId, newUeInfo->cellId, &ueCb))
1461 DU_LOG("\nERROR --> RLC_DL : NewUeId[%d]:ueCb already exists",
1463 status->reason = CKW_CFG_REAS_UE_EXISTS;
1464 status->status = CKW_CFG_CFM_NOK;
1468 if(ROK != rlcDbmFetchDlUeCb(gCb,ueInfo->ueId, ueInfo->cellId, &ueCb))
1471 DU_LOG("\nERROR --> RLC_DL : UeId [%d]: UeCb not found",
1473 status->reason = CKW_CFG_REAS_UE_UNKWN;
1474 status->status = CKW_CFG_CFM_NOK;
1479 rlcHdlMeasDlUeIdChg(gCb, ueInfo->cellId, ueInfo->ueId, newUeInfo->ueId);
1481 if(ROK != cmHashListDelete(&(gCb->u.dlCb->ueLstCp), (PTR) ueCb))
1483 DU_LOG("\nERROR --> RLC_DL : UeId[%u] HashList Deletion Failed",
1485 status->reason = CKW_CFG_REAS_UE_CREAT_FAIL;
1486 status->status = CKW_CFG_CFM_NOK;
1490 /* update the hash key with new values */
1491 ueCb->ueId = newUeInfo->ueId;
1492 ueCb->cellId = newUeInfo->cellId;
1494 if(ROK != cmHashListInsert(&(gCb->u.dlCb->ueLstCp),
1495 (PTR)ueCb, (uint8_t *)&(ueCb->ueId),
1496 (uint16_t) sizeof(CmLteRnti)))
1499 DU_LOG("\nERROR --> RLC_DL : UeId[%u] HashList Insertion Failed",
1501 status->reason = CKW_CFG_REAS_UE_CREAT_FAIL;
1502 status->status = CKW_CFG_CFM_NOK;
1509 /********************************************************************30**
1512 **********************************************************************/