SLice Mapping to RLC DB [ Jira Id - ODUHIGH-371 ]
[o-du/l2.git] / src / 5gnrrlc / rlc_cfg_ul.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 *******************************************************************************/
18
19 /********************************************************************20**
20
21         Name:    NR RLC - Configuration Manager file
22
23         Type:    C source file
24
25         Desc:    It contains the following configuraiton primtives
26                  for different actions
27                     -- rlcCfgValdtEntCfg
28                     -- rlcCfgFillRbCb
29                     -- rlcCfgRbInit
30
31         File:     rlc_cfg_ul.c
32
33 *********************************************************************21*/
34 /** @file rlc_cfg_ul.c
35 @brief RLC Uplink Configuration Module
36 **/
37
38 \f
39 /* header (.h) include files */
40 #include "common_def.h"
41 #include "lkw.h"           /* LKW defines */
42 #include "ckw.h"           /* CKW defines */
43 #include "kwu.h"           /* KWU defines */
44 #include "rgu.h"           /* RGU defines */
45 #include "rlc_err.h"        /* RLC error options */
46 #include "rlc_env.h"        /* RLC environment options */
47
48 /* extern (.x) include files */
49 #include "lkw.x"           /* LKW */
50 #include "ckw.x"           /* CKW */
51 #include "kwu.x"           /* KWU */
52 #include "rgu.x"           /* RGU */
53
54 #include "rlc_utils.h"            /* RLC defines */
55 #include "rlc_ul.h"
56 #ifdef TENB_STATS
57 #ifdef L2_L3_SPLIT
58 #include "l2_tenb_stats.x"    /* Total EnodeB Stats declarations */
59 #endif
60 #endif
61 S16 rlcValidateRbCfgParams (RlcCb *gCb, CmLteRnti ueId, CmLteCellId cellId,
62                                   RlcEntCfgInfo *cfgToValidate, CmStatus *status);
63 #define RLC_MODULE RLC_DBGMASK_CFG
64 #ifdef LTE_L2_MEAS
65 /**
66  *
67  * @brief Handle modification of UE ID for L2 Meas data structs
68  *       
69  *
70  *  @param[in] ueId     ue ID
71  *
72  *  @return  S16
73  *      -# ROK 
74  *      -# RFAILED 
75  *
76 */
77 static S16 rlcHdlMeasUlUeIdChg(RlcCb *gCb, uint8_t cellId,uint8_t oldUeId, uint8_t newUeId)
78 {
79    RlcL2MeasCb    *measCb    = NULLP;
80    uint16_t       cntr;
81    uint16_t       ueIdx = 0;     
82
83    for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
84    {
85       measCb = &(gCb->u.ulCb->rlcL2Cb.rlcL2EvtCb[cntr].measCb);
86
87       if( measCb->measType & LKW_L2MEAS_UL_IP)
88       {
89
90          for(ueIdx = 0; ueIdx < measCb->val.ipThMeas.numUes; ueIdx++)
91          {
92             if((measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId) == oldUeId)
93             {
94                measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId = newUeId;
95                break;
96             }
97          }
98       }
99    }
100    return ROK;
101 }
102
103 /**
104  *
105  * @brief Handler to delete an UE's L2 Meas ctxt
106  *       
107 *
108  *  @param[in] ueId     ue ID
109  *
110  *  @return  S16
111  *      -# ROK 
112  *      -# RFAILED 
113  *
114 */
115 static S16 rlcDelFrmUlL2Meas(RlcCb *gCb, uint8_t cellId,uint8_t ueId)
116 {
117    RlcL2MeasCb    *measCb    = NULLP;
118    uint16_t       cntr;
119    uint16_t       ueIdx = 0;     
120
121    for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
122    {
123       measCb = &(gCb->u.ulCb->rlcL2Cb.rlcL2EvtCb[cntr].measCb);
124
125
126       if( measCb->measType & LKW_L2MEAS_UL_IP)
127       {
128
129          for(ueIdx = 0; ueIdx < measCb->val.ipThMeas.numUes; ueIdx++)
130          {
131             if((measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId) == ueId)
132             {
133                measCb->val.ipThMeas.ueInfoLst[ueIdx].isValid = FALSE;
134                if (measCb->val.ipThMeas.numUes-1 == ueIdx)
135                {
136                   measCb->val.ipThMeas.numUes--;
137                }
138                break;
139             }
140          }
141
142
143
144       {
145          uint32_t myIdx =0;
146          S16                  ret;           /* Return value */
147             RlcUlUeCb             *ueCb = NULL;  
148
149             for (myIdx = 0; myIdx < measCb->val.ipThMeas.numUes; myIdx++)
150             {
151                ueCb = NULL;
152                ret = rlcDbmFetchUlUeCb(gCb, measCb->val.ipThMeas.ueInfoLst[myIdx].ueId, cellId, &ueCb);
153             }
154          }
155
156       }
157    }
158
159    return ROK;
160 }
161
162
163 static S16 rlcAddToUlL2Meas(RlcCb *gCb, RlcUlRbCb *rlcRbCb,uint8_t cellId,uint8_t ueId)
164 {
165    RlcL2MeasCb    *measCb    = NULLP;
166    uint16_t       cntr;
167    uint16_t       cntr1;
168    uint16_t       ueIdx = 0;
169    uint16_t       qciIdx = 0;
170    uint16_t       *numQci;
171    #ifndef XEON_SPECIFIC_CHANGES
172    uint8_t        freeIdx = gCb->genCfg.maxUe;
173    #else
174    uint16_t       freeIdx = LKW_MAX_UE;
175    #endif 
176
177    for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
178    {
179       measCb = &(gCb->u.ulCb->rlcL2Cb.rlcL2EvtCb[cntr].measCb);
180
181       freeIdx = gCb->genCfg.maxUe;
182
183       if(measCb->measType & LKW_L2MEAS_ACT_UE )
184       {
185          for(cntr1 =0;cntr1<measCb->val.nonIpThMeas.numQci;cntr1++)
186          {
187             if(measCb->val.nonIpThMeas.qci[cntr1] != rlcRbCb->qci)
188             {
189                measCb->val.nonIpThMeas.qci[cntr1]  = rlcRbCb->qci;
190                gCb->u.ulCb->rlcL2Cb.measOn[rlcRbCb->qci] |=measCb->measType;
191                break;
192             }
193          }
194       }
195
196       if(((rlcRbCb->rbL2Cb.measOn & measCb->measType) == LKW_L2MEAS_NONE))
197       {
198 #ifdef LTE_L2_MEAS_RLC
199          if (measCb->measType & LKW_L2MEAS_ACT_UE)
200          {
201             if((rlcRbCb->mode == RLC_MODE_UM) &&
202                   (rlcRbCb->dir & RLC_DIR_DL ))
203             {
204                if (rlcRbCb->m.um.umDl.sduQ.count)
205                {
206                   if (rlcRbCb->ueCb->numActRb[rlcRbCb->qci] == 0)
207                   {
208                      rlcRbCb->ueCb->numActRb[rlcRbCb->qci]++;
209                      gCb->u.ulCb->rlcL2Cb.numActUe[rlcRbCb->qci]++;
210                   }
211                }
212             }
213             else if (rlcRbCb->mode == RLC_MODE_AM)
214             {
215                if ((rlcRbCb->m.am.amDl.cntrlBo) ||
216                      (rlcRbCb->m.am.amDl.retxBo)  ||
217                      (rlcRbCb->m.am.amDl.bo))
218                {
219                   if (rlcRbCb->ueCb->numActRb[rlcRbCb->qci] == 0)
220                   {
221                      rlcRbCb->ueCb->numActRb[rlcRbCb->qci]++;
222                      gCb->u.ulCb->rlcL2Cb.numActUe[rlcRbCb->qci]++;
223                   }
224                }
225             }
226          }
227 #endif
228       }
229       if((measCb->measType & LKW_L2MEAS_UL_IP))
230       {
231
232          for(ueIdx = 0; ueIdx < measCb->val.ipThMeas.numUes; ueIdx++)
233          {
234             if ((freeIdx == gCb->genCfg.maxUe) && 
235                   (measCb->val.ipThMeas.ueInfoLst[ueIdx].isValid == FALSE))
236             {
237                freeIdx = ueIdx;
238                continue;
239             }
240             if((measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId) == ueId)
241             {
242                break;
243             }
244          }
245
246          if (ueIdx ==  measCb->val.ipThMeas.numUes)
247          {
248             if (gCb->genCfg.maxUe == measCb->val.ipThMeas.numUes)
249             {
250                return RFAILED;  
251             }
252             if (gCb->genCfg.maxUe == freeIdx)
253             {               
254                measCb->val.ipThMeas.numUes++;
255             }
256             else
257             {
258                ueIdx = freeIdx;
259             }
260             measCb->val.ipThMeas.ueInfoLst[ueIdx].isValid = TRUE;
261             memset(&measCb->val.ipThMeas.ueInfoLst[ueIdx].measData[0],0x00,(sizeof(RlcL2Cntr) *LKW_MAX_QCI));
262             measCb->val.ipThMeas.ueInfoLst[ueIdx].numQci = 0;
263          }
264          measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId = ueId;
265          measCb->val.ipThMeas.ueInfoLst[ueIdx].cellId = cellId;
266          numQci = &(measCb->val.ipThMeas.ueInfoLst[ueIdx].numQci);
267
268          for (qciIdx =0; qciIdx <  *numQci; qciIdx++)
269          {
270             if (measCb->val.ipThMeas.ueInfoLst[ueIdx].qci[qciIdx] == rlcRbCb->qci)
271             {
272                break;
273             }
274          }
275
276          if (qciIdx == *numQci)
277          {
278             measCb->val.ipThMeas.ueInfoLst[ueIdx].qci[qciIdx] = rlcRbCb->qci;
279             (*numQci)++;
280          }
281 \f
282          rlcUtlPlcMeasDatInL2Sts(&measCb->val.ipThMeas.ueInfoLst[ueIdx].measData[rlcRbCb->qci],
283                &rlcRbCb->rbL2Cb, measCb->measType);
284       }
285       rlcRbCb->rbL2Cb.measOn |= measCb->measType;      
286    }
287    return (ROK);
288 }/*rlcAddToDlL2Meas*/ 
289 #endif /*LTE_L2_MEAS*/
290 \f
291 /** 
292  * @brief
293  *     This primitive fills the RbCb 
294  *
295  * @param [in]    gCb      -  RLC Instance Control Block
296  * @param [out]   rbCb     -  RB Control Block
297  * @param [out]   ueCb     -  UE Control Block
298  * @param [in]    entCfg   -  RLC Entity configuration
299  *
300  * @return  S16
301  *    -#ROK
302  *    -#RFAILED
303  */
304 static S16 rlcCfgFillUlRbCb(RlcCb *gCb,RlcUlRbCb *rbCb,RlcUlUeCb *ueCb,RlcEntCfgInfo *entCfg)
305 {
306
307    DU_LOG("\nDEBUG  -->  RLC_UL : rlcCfgFillRbCb(cellId(%d), rbId(%d), rbType(%d))",
308                 rbCb->rlcId.cellId, 
309                 entCfg->rbId, 
310                 entCfg->rbType);
311
312    /* Initialize according to entMode */
313    switch (entCfg->entMode)
314    {
315       case RLC_MODE_TM:
316       {
317          rbCb->lch.lChId  = entCfg->lCh[0].lChId;
318          rbCb->lch.lChType = entCfg->lCh[0].type;
319          rbCb->dir = entCfg->dir;
320          break;
321       }
322       case RLC_MODE_UM:
323       {
324          rbCb->lch.lChId  = entCfg->lCh[0].lChId;
325          rbCb->lch.lChType = entCfg->lCh[0].type;
326          rbCb->dir = entCfg->dir;
327
328          rbCb->m.umUl.snLen = entCfg->m.umInfo.ul.snLen;
329
330          /* the bitmask for SN = 10 is 0x3ff and for SN = 5 is 0x1f */
331          rbCb->m.umUl.modBitMask = (rbCb->m.umUl.umWinSz << 1) - 1; 
332
333          rbCb->m.umUl.reAsmblTmrInt = 
334             entCfg->m.umInfo.ul.reAsmblTmr;
335          cmInitTimers(&(rbCb->m.umUl.reAsmblTmr), 1);
336          ueCb->lCh[rbCb->lch.lChId - 1].ulRbCb = rbCb;
337          break;
338       }
339       case RLC_MODE_AM:
340       {
341          /* Down Link Information 
342           * indx = 1 as Up Link   */
343          rbCb->lch.lChId  = entCfg->lCh[1].lChId;
344          rbCb->lch.lChType = entCfg->lCh[1].type;
345          rbCb->dir = RLC_DIR_BOTH;
346
347          rbCb->m.amUl.staProhTmrInt = entCfg->m.amInfo.ul.staProhTmr;
348          rbCb->m.amUl.reAsmblTmrInt = entCfg->m.amInfo.ul.reAsmblTmr;
349
350          rbCb->m.amUl.snLen = entCfg->m.amInfo.ul.snLen; /* 5GNR */
351          
352          if(RLC_AM_CFG_12BIT_SN_LEN == rbCb->m.amUl.snLen)
353          {
354             rbCb->m.amUl.snModMask = (1 << RLC_SN_LEN_12BITS) - 1; /* 5GNR */
355          }
356          else 
357          {
358             rbCb->m.amUl.snModMask = (1 << RLC_SN_LEN_18BITS) - 1; /* 5GNR */
359          }
360
361          cmInitTimers(&(rbCb->m.amUl.reAsmblTmr), 1);
362          cmInitTimers(&(rbCb->m.amUl.staProhTmr), 1);
363
364          rbCb->m.amUl.vrMr = rbCb->m.amUl.rxNext + (RLC_AM_GET_WIN_SZ(rbCb->m.amUl.snLen));
365
366          ueCb->lCh[rbCb->lch.lChId - 1].ulRbCb = rbCb;
367
368          break;
369       }
370       default:
371       {
372          DU_LOG("\nERROR  -->  RLC_UL : INVALID RB Mode cellId(%d), rbId(%d)",
373                 rbCb->rlcId.cellId, 
374                 entCfg->rbId); 
375          return RFAILED;
376       }
377    }
378    
379    if(entCfg->snssai)
380    {
381       if(!rbCb->snssai)
382       {
383          RLC_ALLOC(gCb, rbCb->snssai, sizeof(Snssai));
384          if(rbCb->snssai == NULLP)
385          {
386             DU_LOG("\nERROR  -->  RLC_UL : rlcCfgFillUlRbCb(): Failed to allocate memory for snssai ");
387             return RFAILED;
388          }
389       }
390       memcpy(rbCb->snssai, entCfg->snssai, sizeof(Snssai));
391    }
392    rbCb->mode = entCfg->entMode;
393    
394    return ROK;
395
396
397 \f
398 /** 
399  * @brief This primitive Initializes the RB Cb
400  *
401  * @param [in]    gCb      -  RLC Instance Control Block
402  * @param [out]   rbCb     -  RB Control Block
403  * @param [in]    ptr      -  Void pointer
404  * @param [in]    entCfg   -  Entity Configuration
405  *
406  * @return  S16
407  *    -#ROK
408  *    -#RFAILED
409  */
410 static S16 rlcCfgUpdateUlRb(RlcCb *gCb,RlcUlRbCb *rbCb,void *ptr,RlcEntCfgInfo *entCfg)
411 {
412    
413    switch (rbCb->mode)
414    {
415       case RLC_MODE_TM:
416       {
417          RlcUlCellCb *cellCb = (RlcUlCellCb *)ptr;
418          rbCb->dir = entCfg->dir;
419          rbCb->lch.lChId = entCfg->lCh[0].lChId;
420          rbCb->lch.lChType = entCfg->lCh[0].type;
421          cellCb->lCh[rbCb->lch.lChId - 1].ulRbCb = rbCb;
422          break;
423       }
424       case RLC_MODE_UM:
425       {
426          RlcUlUeCb *ueCb = (RlcUlUeCb *)ptr;
427          ueCb->lCh[rbCb->lch.lChId - 1].ulRbCb = NULLP;
428          rlcCfgFillUlRbCb(gCb,rbCb, ueCb, entCfg);
429          break;
430       }
431       case RLC_MODE_AM:
432       {
433          RlcUlUeCb *ueCb = (RlcUlUeCb *)ptr;
434
435          ueCb->lCh[rbCb->lch.lChId - 1].ulRbCb = NULLP;
436          ueCb->lCh[entCfg->lCh[1].lChId - 1].ulRbCb = rbCb;
437          /* Up Link */
438          rbCb->lch.lChId = entCfg->lCh[1].lChId;
439          rbCb->lch.lChType = entCfg->lCh[1].type;
440          rbCb->m.amUl.staProhTmrInt = entCfg->m.amInfo.ul.staProhTmr;
441          rbCb->m.amUl.reAsmblTmrInt = entCfg->m.amInfo.ul.reAsmblTmr;
442          break;
443       }
444    }
445    
446    if(entCfg->snssai)
447    {
448       if(!rbCb->snssai)
449       {
450          RLC_ALLOC(gCb, rbCb->snssai, sizeof(Snssai));
451          if(rbCb->snssai == NULLP)
452          {
453             DU_LOG("\nERROR  -->  RLC_UL : rlcCfgUpdateUlRb(): Failed to allocate memory for snssai ");
454             return RFAILED;
455          }
456       }
457       memcpy(rbCb->snssai,entCfg->snssai,sizeof(Snssai));
458    }
459    
460    return (CKW_CFG_REAS_NONE);
461
462
463 \f
464 /** 
465  * @brief 
466  *    This primitive validates uplink Add RB Configuration and reserve memory
467  *    for RB creation.
468  *  
469  * @param [in]  gCb      -  RLC Instance Control Block
470  * @param [in]  ueId     -  UE Identifier
471  * @param [in]  cellId   -  CELL Identifier
472  * @param [in]  cfgToValidate   -  Entity Configuration needs to be validated. 
473  * @param [out] status  -  status of configuration
474  *
475  * @return  S16
476  *    -# ROK
477  *    -# RFAILED
478  */
479 S16 rlcValidateRbCfgParams(RlcCb *gCb,CmLteRnti ueId,CmLteCellId cellId,RlcEntCfgInfo *cfgToValidate,CmStatus *status)
480 {
481    if (cellId == 0)
482    {
483       status->reason = CKW_CFG_REAS_CELL_UNKWN;
484       return  (RFAILED);
485    }
486    if ((cfgToValidate->rguSapId >= gCb->genCfg.maxRguSaps) || (cfgToValidate->rguSapId < 0))
487    {
488       RLCDBGP_ERROR(gCb, "rlcValidateRbCfgParams ueId (%u) cellId (%u) Invalid rguSapId (%d))\n",
489             ueId, cellId, cfgToValidate->rguSapId);
490       status->reason = CKW_CFG_REAS_INVALID_RGUSAP;
491       return RFAILED; 
492    }  
493   
494    if((CKW_CFG_ADD == cfgToValidate->cfgType) ||
495       (CKW_CFG_MODIFY == cfgToValidate->cfgType))
496    {
497       /* Validate LChId for UM and AM modes */
498       if ((cfgToValidate->lCh[0].lChId <= 0) ||
499            ((cfgToValidate->entMode == RLC_MODE_AM) &&
500              (cfgToValidate->lCh[1].lChId <= 0)))
501       {
502          status->reason = CKW_CFG_REAS_INVALID_LCHID;
503          return RFAILED; 
504       }  
505       if((cfgToValidate->entMode == RLC_MODE_UM) &&
506          (cfgToValidate->m.umInfo.ul.snLen != RLC_UM_CFG_6BIT_SN_LEN) &&
507          (cfgToValidate->m.umInfo.ul.snLen != RLC_UM_CFG_12BIT_SN_LEN))
508       {   
509          DU_LOG("\nERROR  -->  RLC_UL : UM Mode RB[%d],Invalid SN Len[%d]",
510                cfgToValidate->rbId,
511                cfgToValidate->m.umInfo.ul.snLen);
512          status->reason = CKW_CFG_REAS_INVALID_SNLEN;
513          return RFAILED; 
514       }
515       /* Process Adding new RB */
516       if (ueId == 0)
517       {
518          if(cfgToValidate->rbId >= RLC_MAX_RB_PER_CELL)
519          {
520             status->reason = CKW_CFG_REAS_RB_UNKWN;
521             return RFAILED;
522          }
523
524          if ((cfgToValidate->lCh[0].type != CM_LTE_LCH_CCCH) &&
525                (cfgToValidate->entMode != RLC_MODE_TM))
526          {
527             status->reason= (cfgToValidate->entMode != RLC_MODE_TM)? CKW_CFG_REAS_RB_MODE_MIS:
528                CKW_CFG_REAS_LCHTYPE_MIS;
529             return RFAILED;
530          }
531       }
532       else
533       {
534          if (!(RLC_VALIDATE_UE_RBID(cfgToValidate->rbType, cfgToValidate->rbId)))
535          {
536             status->reason = CKW_CFG_REAS_RB_UNKWN;
537             return RFAILED;
538          }
539
540          if(cfgToValidate->entMode == RLC_MODE_TM)
541          {
542             status->reason = CKW_CFG_REAS_LCHTYPE_MIS;
543             return RFAILED;
544          }
545          if (!(((cfgToValidate->lCh[0].type == CM_LTE_LCH_DCCH) && 
546                (cfgToValidate->entMode != RLC_MODE_UM))|| 
547                (cfgToValidate->lCh[0].type == CM_LTE_LCH_DTCH)) )
548          {
549             status->reason = CKW_CFG_REAS_RB_MODE_MIS;
550             return RFAILED;
551          }
552       }
553    }
554    else /* cfgType is CKW_CFG_DELETE */
555    {
556       if (ueId == 0)
557       {
558          if(cfgToValidate->rbId >= RLC_MAX_RB_PER_CELL)
559          {
560             status->reason = CKW_CFG_REAS_RB_UNKWN;
561             return RFAILED;
562          }
563
564       }
565       else
566       {
567          if (!(RLC_VALIDATE_UE_RBID(cfgToValidate->rbType, cfgToValidate->rbId)))
568          {
569             status->reason = CKW_CFG_REAS_RB_UNKWN;
570             return RFAILED;
571          }
572       }
573    }
574    return ROK;
575 }
576
577 \f
578 /** 
579  * @brief 
580  *    This primitive validates uplink Add RB Configuration and reserve memory
581  *    for RB creation.
582  *  
583  * @param [in]  gCb      -  RLC Instance Control Block
584  * @param [in]  cfgToValidate   -  Entity Configuration needs to be validated. 
585  * @param [out] cfgEntData    -  Configuration Temporary Data Entity
586  * @param [out] cfgTmpData    -  Configuration Temporary Data 
587  *
588  * @return  S16
589  *    -# ROK
590  *    -# RFAILED
591  */
592 S16 rlcCfgValidateUlRb
593 (
594 RlcCb             *gCb,
595 RlcEntCfgInfo    *cfgToValidate,
596 RlcUlEntTmpData   *cfgEntData,
597 RlcUlCfgTmpData   *cfgTmpData 
598 )
599 {
600
601    DU_LOG("\nDEBUG  -->  RLC_UL : cellId(%d), cfgType(%d)",
602                 cfgTmpData->cellId,
603                 cfgToValidate->cfgType);
604
605    if(ROK != rlcValidateRbCfgParams(gCb, 
606                                    cfgTmpData->ueId, 
607                                    cfgTmpData->cellId, 
608                                    cfgToValidate, 
609                                    &cfgEntData->entUlCfgCfm.status))
610    {
611       return RFAILED;
612    }
613    
614    cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_NONE;
615    switch(cfgToValidate->cfgType)
616    {
617       case CKW_CFG_ADD:
618       {
619          if (cfgTmpData->ueId == 0)
620          {
621             /* Cell Cb is added if it not present , it is not roll backed if the
622              * configuration fails */
623             rlcDbmFetchUlCellCb(gCb,cfgTmpData->cellId, &cfgTmpData->cellCb);
624             if(!cfgTmpData->cellCb)
625             {
626                /* cell cb does not exist we need to create a new one */
627                RLC_ALLOC(gCb,cfgTmpData->cellCb, sizeof(RlcUlCellCb));
628                if(!cfgTmpData->cellCb)
629                {
630                   DU_LOG("\nERROR  -->  RLC_UL : Memory allocation failure CELLID:%d",
631                         cfgTmpData->cellId);
632                   cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_CELL_CREAT_FAIL;
633                   return RFAILED;
634                }
635                rlcDbmAddUlCellCb(gCb, cfgTmpData->cellId, cfgTmpData->cellCb);
636             }
637             else
638             {
639                if (( cfgTmpData->cellCb->rbCb[cfgToValidate->rbId] != NULLP))
640                {
641                   cfgEntData->entUlCfgCfm.status.reason =  CKW_CFG_REAS_RB_PRSNT;
642                   return RFAILED;
643                }
644             }
645
646             RLC_ALLOC(gCb,cfgEntData->rbCb, sizeof (RlcUlRbCb));
647             if (!cfgEntData->rbCb)
648             {
649                cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_RB_CREAT_FAIL;
650                return RFAILED;
651             }
652          }
653          else
654          {
655             /* Ue Cb is added if it not present , it is not roll backed if the
656              * configuration fails */
657             rlcDbmFetchUlUeCb(gCb,cfgTmpData->ueId, cfgTmpData->cellId, &cfgTmpData->ueCb);
658             if(!cfgTmpData->ueCb)
659             {
660                RLC_ALLOC(gCb,cfgTmpData->ueCb, sizeof(RlcUlUeCb));
661                if(!cfgTmpData->ueCb)
662                {
663                   DU_LOG("\nERROR  -->  RLC_UL : Memory allocation failure CELLID:%d",
664                         cfgTmpData->cellId);
665                   cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_UE_CREAT_FAIL;
666                   return RFAILED;
667                }
668                rlcDbmAddUlUeCb(gCb, cfgTmpData->ueId, cfgTmpData->cellId, cfgTmpData->ueCb);
669                cfgTmpData->ueCb->ueDeleteInfo.ueDelTmr.tmrEvnt = TMR_NONE;
670             }
671             else
672             {
673                RLC_DBM_GET_RBCB_FROM_UECB(cfgToValidate->rbId, 
674                      cfgToValidate->rbType,
675                      cfgTmpData->ueCb,
676                      cfgEntData->rbCb);
677                if(cfgEntData->rbCb != NULLP)
678                {
679                   cfgEntData->entUlCfgCfm.status.reason =  CKW_CFG_REAS_RB_PRSNT;
680                   return RFAILED;
681                }
682             }
683             RLC_ALLOC(gCb,cfgEntData->rbCb, sizeof (RlcUlRbCb));
684             if (!cfgEntData->rbCb)
685             {
686                cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_RB_CREAT_FAIL;
687                return RFAILED;
688             }
689          }
690          /*Allocating the memory for receive buffer */
691          if(RLC_MODE_UM == cfgToValidate->entMode)
692          {
693             uint16_t hashIndex;
694         
695             /* Spec 38.322 Section 7.2 
696              * UM_Window_Size = 32 when a 6 bit SN is configured, 
697              * UM_Window_Size = 2048 when a 12 bit SN is configured.
698              */
699             cfgEntData->rbCb->m.umUl.umWinSz = RLC_POWER(2, 
700                   ((cfgToValidate->m.umInfo.ul.snLen *6)-1));
701             RLC_ALLOC(gCb, cfgEntData->rbCb->m.umUl.recBufLst,
702               (RLC_RCV_BUF_BIN_SIZE * sizeof(CmLListCp)));
703             for(hashIndex = 0; hashIndex < RLC_RCV_BUF_BIN_SIZE; hashIndex++ )
704             {
705                cmLListInit(&(cfgEntData->rbCb->m.umUl.recBufLst[hashIndex]));
706             }
707          }
708          else if(RLC_MODE_AM == cfgToValidate->entMode)
709          {
710 #ifndef LTE_TDD 
711              uint32_t hashIndex;
712               RLC_ALLOC(gCb,
713                     cfgEntData->rbCb->m.amUl.recBufLst,
714                     (RLC_RCV_BUF_BIN_SIZE * sizeof(CmLListCp )));
715               for(hashIndex = 0; hashIndex < RLC_RCV_BUF_BIN_SIZE; hashIndex++)
716               {
717                   cmLListInit(&(cfgEntData->rbCb->m.amUl.recBufLst[hashIndex]));
718               }
719 #endif
720          }
721          break;
722       }
723       case CKW_CFG_MODIFY: 
724       case CKW_CFG_DELETE:
725       {
726          if (cfgTmpData->ueId == 0)
727          {
728             /* Try to get the CellCb if it already exists */
729             rlcDbmFetchUlCellCb(gCb,cfgTmpData->cellId, &cfgTmpData->cellCb);
730             if(!cfgTmpData->cellCb)
731             {
732                DU_LOG("\nERROR  -->  RLC_UL : CellCb not found UEID:%d",
733                       cfgTmpData->ueId);
734                /*how can a modify request come for a cell which does not exist*/
735                cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_CELL_UNKWN;
736                return RFAILED;
737             }
738
739             cfgEntData->rbCb = cfgTmpData->cellCb->rbCb[cfgToValidate->rbId];
740             if (!cfgEntData->rbCb)
741             {
742                /* something is wrong the rbId for this cell does not exist */
743                cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_RB_UNKWN;
744                return RFAILED;
745             }
746             return ROK;
747          }
748          else
749          {
750             rlcDbmFetchUlUeCb(gCb,cfgTmpData->ueId, cfgTmpData->cellId, &cfgTmpData->ueCb);
751             if(!cfgTmpData->ueCb)
752             {   
753                DU_LOG("\nERROR  -->  RLC_UL : UeId [%d]: UeCb not found",
754                      cfgTmpData->ueId);
755                cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_UE_UNKWN;
756                return RFAILED;
757             }
758
759             /* Get rbCb */
760             RLC_DBM_GET_RBCB_FROM_UECB(cfgToValidate->rbId, 
761                                       cfgToValidate->rbType, 
762                                       cfgTmpData->ueCb, 
763                                       cfgEntData->rbCb);
764             if ( cfgEntData->rbCb == NULLP)
765             {
766                cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_RB_UNKWN;
767                return RFAILED;
768             }
769             return ROK;
770          }
771          break;
772       }
773    }
774
775    if(cfgToValidate->cfgType == CKW_CFG_MODIFY)
776    {
777       if(cfgToValidate->entMode != cfgEntData->rbCb->mode)
778       {
779          cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_RB_MODE_MIS;
780          return RFAILED;
781       }
782
783       if(cfgToValidate->m.umInfo.ul.snLen != cfgEntData->rbCb->m.umUl.snLen)
784       {
785          cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_SNLEN_MIS;
786          return RFAILED;
787       }
788    }
789    return ROK;
790 }
791
792 \f
793 /** 
794  * @brief 
795  *    This primitive roll back the RB Configuration
796  *  
797  * @param [in]  gCb      -  RLC Instance Control Block
798  * @param [in]  ueId     -  UE Identifier
799  * @param [in]  cfg   -     Configuration entity. 
800  * @param [out] cfgEntData    -  Configuration Temporary Data Entity
801  *
802  * @return  S16
803  *    -# ROK
804  *    -# RFAILED
805  */
806 S16 rlcCfgRollBackUlRb
807 (
808 RlcCb             *gCb,
809 CmLteRnti        ueId,
810 RlcEntCfgInfo    *cfg,
811 RlcUlEntTmpData   *cfgEntData
812 )
813 {
814
815    if(CKW_CFG_ADD == cfg->cfgType)
816    {
817       if(RLC_MODE_UM == cfg->entMode)
818       {
819          RLC_FREE(gCb, cfgEntData->rbCb->m.umUl.recBufLst, (RLC_RCV_BUF_BIN_SIZE * sizeof(CmLListCp)));
820       }
821       else if(RLC_MODE_AM == cfg->entMode)
822       {
823 #ifndef LTE_TDD 
824       RLC_FREE(gCb,cfgEntData->rbCb->m.amUl.recBufLst, (RLC_RCV_BUF_BIN_SIZE * sizeof(CmLListCp)));
825 #endif
826       }
827       RLC_FREE(gCb,cfgEntData->rbCb, sizeof(RlcUlRbCb));
828    }
829
830    return ROK;
831 }
832
833 \f
834 /** 
835  * @brief 
836  *    This primitive apply RB Configuration. 
837  *  
838  * @param [in] gCb      -  RLC Instance Control Block
839  * @param [in] cfgToAply  -   Configuration to be applied 
840  * @param [out] cfgEntData    -  Configuration Temporary Data Entity
841  * @param [out] cfgTmpData    -  Configuration Temporary Data 
842  *
843  * @return  S16
844  *    -# ROK
845  *    -# RFAILED
846  */
847 Void rlcCfgApplyUlRb
848 (
849 RlcCb             *gCb,
850 RlcEntCfgInfo    *cfgToAply,
851 RlcUlEntTmpData   *cfgEntData,
852 RlcUlCfgTmpData   *cfgTmpData
853 )
854 {
855   
856    switch(cfgToAply->cfgType)
857    {
858       case CKW_CFG_ADD:
859       {
860          /* copy the RB Cb into UeCb */
861          cfgEntData->rbCb->rlcId.rbId = cfgToAply->rbId;
862          if (cfgTmpData->ueId == 0)
863          {
864             cfgTmpData->cellCb->rbCb[cfgToAply->rbId] = cfgEntData->rbCb;
865             cfgTmpData->cellCb->lCh[cfgToAply->lCh[0].lChId -1].ulRbCb = cfgEntData->rbCb;
866          }
867          else
868          {
869             if(cfgToAply->rbType == CM_LTE_SRB)
870             {
871                cfgTmpData->ueCb->srbCb[cfgToAply->rbId] = cfgEntData->rbCb;
872             }
873             else
874             {
875                cfgTmpData->ueCb->drbCb[cfgToAply->rbId] = cfgEntData->rbCb;
876             }
877          }
878
879          RLC_LMM_RB_STS_INC(gCb);
880
881          cfgEntData->rbCb->rlcId.cellId = cfgTmpData->cellId;
882          cfgEntData->rbCb->rlcId.ueId   = cfgTmpData->ueId;
883          cfgEntData->rbCb->rlcId.rbType = cfgToAply->rbType;
884          cfgEntData->rbCb->inst         = gCb->init.inst;
885
886          /* Fill RB CB */
887          rlcCfgFillUlRbCb(gCb,
888                          cfgEntData->rbCb, 
889                          cfgTmpData->ueCb,
890                          cfgToAply);
891
892 #ifdef LTE_L2_MEAS
893          cfgEntData->rbCb->qci = cfgToAply->qci;
894          cfgEntData->rbCb->ueCb =  cfgTmpData->ueCb;
895          if (cfgToAply->lCh[1].type == CM_LTE_LCH_DTCH)
896          {
897             /* ccpu00129778 */
898             rlcAddToUlL2Meas(gCb, cfgEntData->rbCb,
899                   cfgTmpData->cellId,cfgTmpData->ueId); 
900          }
901 #endif /* LTE_L2_MEAS */
902          break;
903       }
904       case CKW_CFG_MODIFY:
905       {
906          if(cfgTmpData->ueId == 0)
907          {
908             rlcCfgUpdateUlRb(gCb,
909                             cfgEntData->rbCb, 
910                             (void *)cfgTmpData->cellCb, 
911                             cfgToAply);
912          }
913          else
914          {
915             rlcCfgUpdateUlRb(gCb,
916                             cfgEntData->rbCb, 
917                             (void*)cfgTmpData->ueCb, 
918                             cfgToAply);
919          }
920          break;
921       }
922       case CKW_CFG_DELETE:
923       {
924          if (cfgTmpData->ueId == 0)
925          {
926             cfgTmpData->cellCb->rbCb[cfgToAply->rbId] = NULLP;
927             cfgTmpData->cellCb->lCh[cfgEntData->rbCb->lch.lChId - 1].ulRbCb = 
928                                                                         NULLP;
929          }
930          else
931          {
932             cfgTmpData->ueCb->lCh[cfgEntData->rbCb->lch.lChId - 1].ulRbCb = 
933                                                                        NULLP;
934
935             /* Free the Buffers of RbCb */
936             if( RLC_MODE_UM == cfgEntData->rbCb->mode )
937             {
938                rlcUmmFreeUlRbCb(gCb, cfgEntData->rbCb);
939             }
940             else if(RLC_MODE_AM == cfgEntData->rbCb->mode)
941             {
942                rlcAmmFreeUlRbCb(gCb,cfgEntData->rbCb);
943             }
944
945             /* Assign NULLP to rbCb in rbCbLst */
946             if ( cfgToAply->rbType == CM_LTE_SRB )
947             {
948                cfgTmpData->ueCb->srbCb[cfgToAply->rbId] = NULLP;
949             }
950             else
951             {
952                cfgTmpData->ueCb->drbCb[cfgToAply->rbId] = NULLP;
953             }
954          }
955          /* Delete RbCb  */
956          RLC_FREE(gCb,cfgEntData->rbCb, sizeof(RlcUlRbCb));
957
958          RLC_LMM_RB_STS_DEC(gCb);
959          break;
960       }
961    }
962    return;
963 }
964
965 \f
966 /** 
967  * @brief 
968  *    This primitive validates uplink Delete UE request 
969  *    for RB creation.
970  *  
971  * @param [in]  gCb      -  RLC Instance Control Block
972  * @param [in]  cfgToValidate   -  Entity Configuration to be validated.
973  * @param [out] cfgEntData    -  Configuration Temporary Data Entity
974  * @param [out] cfgTmpData    -  Configuration Temporary Data 
975  *
976  * @return  S16
977  *    -# ROK
978  *    -# RFAILED
979  */
980 S16 rlcCfgValidateDelUlUe
981 (
982 RlcCb             *gCb,
983 RlcEntCfgInfo    *cfgToValidate,
984 RlcUlEntTmpData   *cfgEntData,
985 RlcUlCfgTmpData   *cfgTmpData
986 )
987 {
988
989     DU_LOG("\nDEBUG  -->  RLC_UL : cellId(%d), cfgType(%d)",
990               cfgTmpData->cellId,cfgToValidate->cfgType);
991    
992    /* Check for ueId is present or not */
993    if ( cfgTmpData->ueId == 0 )
994    {
995       cfgEntData->entUlCfgCfm.status.reason =  CKW_CFG_REAS_UE_UNKWN;
996       DU_LOG("\nERROR  -->  RLC_UL : UeId is 0 for CELLID;%d",
997             cfgTmpData->cellId);
998       return RFAILED;
999    }
1000
1001    /* Fetch Ue Cb */
1002    if(ROK != rlcDbmFetchUlUeCb(gCb,cfgTmpData->ueId, cfgTmpData->cellId, &cfgTmpData->ueCb))
1003    {
1004       DU_LOG("\nERROR  -->  RLC_UL : UeId [%d]: UeCb not found",
1005             cfgTmpData->ueId);
1006       cfgEntData->entUlCfgCfm.status.reason =  CKW_CFG_REAS_UE_UNKWN;
1007       return RFAILED;
1008    }
1009    return ROK;
1010 }
1011
1012 \f
1013 /** 
1014  * @brief 
1015  *    This primitive apply Uplink Delete Ue request 
1016  *  
1017  * @param [in] gCb      -  RLC Instance Control Block
1018  * @param [in] cfgTmpData    -  Configuration Temporary Data 
1019  *
1020  * @return  S16
1021  *    -# ROK
1022  */
1023 Void rlcCfgApplyDelUlUe
1024 (
1025 RlcCb             *gCb,
1026 RlcUlCfgTmpData   *cfgTmpData
1027 )
1028 {
1029    
1030 #ifdef LTE_L2_MEAS
1031    rlcDelFrmUlL2Meas(gCb,cfgTmpData->cellId,cfgTmpData->ueId);
1032 #endif
1033    rlcDbmDelUlUeCb(gCb,cfgTmpData->ueCb, FALSE);
1034    return;
1035 }
1036   
1037 \f
1038 /** 
1039  * @brief 
1040  *    This primitive validates uplink Delete UE request 
1041  *    for RB creation.
1042  *  
1043  * @param [in] gCb      -  RLC Instance Control Block
1044  * @param [in] ueId     -  UE Identifier
1045  * @param [in] cfgToValidate   -  Entity Configuration to be done.
1046  * @param [in] cfgEntData    -  Configuration Temporary Data Entity
1047  * @param [in] cfgTmpData    -  Configuration Temporary Data 
1048  *
1049  * @return  S16
1050  *    -# ROK
1051  *    -# RFAILED
1052  */
1053 S16 rlcCfgValidateDelUlCell
1054 (
1055 RlcCb             *gCb,
1056 CmLteCellId      cellId,
1057 RlcEntCfgInfo    *cfgToValidate,
1058 RlcUlEntTmpData   *cfgEntData,
1059 RlcUlCfgTmpData   *cfgTmpData
1060 )
1061 {
1062
1063    DU_LOG("\nDEBUG  -->  RLC_UL : cfgType(%d)",
1064               cfgToValidate->cfgType);
1065    
1066    cfgTmpData->cellCb = NULLP;
1067
1068    /* Check for cellId is present or not */
1069    if ( cellId == 0 )
1070    {
1071       cfgEntData->entUlCfgCfm.status.reason =  CKW_CFG_REAS_CELL_UNKWN;
1072       DU_LOG("\nERROR  -->  RLC_UL : CellId is 0");
1073       return RFAILED;
1074    }
1075
1076    /* Fetch Cell Cb */
1077    rlcDbmFetchUlCellCb(gCb,cellId, &cfgTmpData->cellCb);
1078    if (!cfgTmpData->cellCb)
1079    {
1080       cfgEntData->entUlCfgCfm.status.reason =  CKW_CFG_REAS_CELL_UNKWN;
1081       DU_LOG("\nERROR  -->  RLC_UL : CellCb not found");
1082       return RFAILED;
1083    }
1084    return ROK;
1085 }
1086
1087 \f
1088 /** 
1089  * @brief 
1090  *    This primitive apply Uplink Delete Ue request 
1091  *  
1092  * @param [in] gCb      -  RLC Instance Control Block
1093  * @param [in] cfgEntData  - Temporary Data maintained for a transaction 
1094  *
1095  * @return  S16
1096  *    -# ROK
1097  */
1098 Void rlcCfgApplyDelUlCell(RlcCb *gCb,RlcUlCfgTmpData *cfgInfo)
1099 {
1100    
1101    rlcDbmDelUlCellCb(gCb,cfgInfo->cellCb);
1102    return;
1103 }
1104 \f
1105 /** 
1106  * @brief 
1107  *    This primitive validates reestablishment of RB.
1108  *  
1109  * @param [in]   gCb      -  RLC Instance Control Block
1110  * @param [in]   ueId     -  UE Identifier
1111  * @param [in]   cellId   -  CELL Identifier
1112  * @param [in]   cfgToValidate   -  Entity Configuration to be done.
1113  * @param [out] cfgEntData    -  Configuration Temporary Data Entity
1114  *
1115  * @return  S16
1116  *    -# ROK
1117  *    -# RFAILED
1118  */
1119 S16 rlcCfgValidateReEstRb
1120 (
1121 RlcCb             *gCb,
1122 CmLteRnti        ueId,
1123 CmLteCellId      cellId,
1124 RlcEntCfgInfo    *cfgToValidate,
1125 RlcUlEntTmpData   *cfgEntData
1126 )
1127 {
1128    CmLteRlcId   rlcId;   /* RLC Identifier */
1129
1130     DU_LOG("\nDEBUG  -->  RLC_UL : cellId(%d) RBID:%d",
1131          cellId,
1132          cfgToValidate->rbId); 
1133
1134    /* Get rlcId */
1135    rlcId.ueId = ueId;
1136    rlcId.cellId = cellId;
1137    rlcId.rbId = cfgToValidate->rbId;
1138    rlcId.rbType = cfgToValidate->rbType;
1139
1140    rlcDbmFetchUlRbCbByRbId(gCb,&rlcId, &cfgEntData->rbCb);
1141    if (cfgEntData->rbCb == NULLP)
1142    {
1143       DU_LOG("\nERROR  -->  RLC_UL : CellId [%u]: rbId [%d] not found",
1144              cellId,
1145              cfgToValidate->rbId);
1146       cfgEntData->entUlCfgCfm.status.reason =  CKW_CFG_REAS_RB_UNKWN;
1147       return RFAILED;
1148    }
1149
1150    return ROK;
1151 }
1152
1153
1154 \f
1155 /** 
1156  * @brief 
1157  *    This primitive apply reestablishment of RB.
1158  *  
1159  * @param [in] gCb        -  RLC Instance Control Block
1160  * @param [in] ueId       -  UE Identifier
1161  * @param [in] cellId     -  CELL Identifier
1162  * @param [in] sndReEstInd  -  ReEstablish Indication Flag 
1163  * @param [in] cfgEntData -  Configuration Temporary Data Entity 
1164  *
1165  * @return  S16
1166  *    -# ROK
1167  */
1168 Void rlcCfgApplyReEstUlRb
1169 (
1170 RlcCb           *gCb,
1171 CmLteRnti       ueId,
1172 CmLteCellId     cellId,
1173 Bool            sndReEstInd,
1174 RlcUlEntTmpData *cfgEntData
1175 )
1176 {
1177    CmLteRlcId   rlcId;   /* RLC Identifier */
1178    
1179    rlcId.ueId = ueId;
1180    rlcId.cellId = cellId;
1181    rlcId.rbId = cfgEntData->entUlCfgCfm.rbId;
1182    rlcId.rbType = cfgEntData->entUlCfgCfm.rbType;
1183    cfgEntData->rbCb->rlcId.ueId = ueId;
1184    switch (cfgEntData->rbCb->mode)
1185    {
1186       case RLC_MODE_TM:
1187          {
1188             rlcTmmUlReEstablish(gCb,cfgEntData->rbCb);
1189             break;
1190          }
1191
1192       case RLC_MODE_UM:
1193          {
1194             rlcUmmUlReEstablish(gCb,&rlcId,cfgEntData->rbCb);
1195             break;
1196          }
1197
1198       case RLC_MODE_AM:
1199          {
1200             rlcAmmUlReEstablish(gCb,rlcId,sndReEstInd,cfgEntData->rbCb);
1201             break;
1202          }
1203    }
1204    return;
1205 }
1206 \f
1207 /** 
1208  * @brief 
1209  *    This primitive validates reestablishment of RB.
1210  *  
1211  * @param [in] gCb        -  RLC Instance Control Block
1212  * @param [in] ueInfo     -  UE Identifier
1213  * @param [in] newUeInfo  -  CELL Identifier
1214  * @param [in] cfgTmpData -  Configuration Temporary Data 
1215  *
1216  * @return  S16
1217  *    -# ROK
1218  *    -# RFAILED
1219  */
1220 S16 rlcCfgValidateUeIdChng
1221 (
1222 RlcCb            *gCb,
1223 CkwUeInfo        *ueInfo,
1224 CkwUeInfo        *newUeInfo,
1225 RlcUlCfgTmpData  *cfgTmpData
1226 )
1227 {
1228    RlcUlUeCb   *ueCb;
1229
1230 #define CFM_STATUS  cfgTmpData->cfgEntData[0].entUlCfgCfm.status
1231    if ( (ueInfo->ueId == newUeInfo->ueId) && 
1232         (ueInfo->cellId == newUeInfo->cellId))
1233    {
1234       CFM_STATUS.reason = CKW_CFG_REAS_SAME_UEID;
1235       CFM_STATUS.status = CKW_CFG_CFM_NOK; 
1236       return RFAILED;
1237    } 
1238    
1239    if(ROK == rlcDbmFetchUlUeCb(gCb,newUeInfo->ueId, newUeInfo->cellId, &ueCb))
1240    {
1241       DU_LOG("\nERROR  -->  RLC_UL : NewUeId[%d]:ueCb already exists",
1242              newUeInfo->ueId);
1243       CFM_STATUS.reason = CKW_CFG_REAS_UE_EXISTS;
1244       CFM_STATUS.status = CKW_CFG_CFM_NOK;
1245       return RFAILED;
1246    }
1247   
1248    if(ROK != rlcDbmFetchUlUeCb(gCb,ueInfo->ueId, ueInfo->cellId, 
1249                               &cfgTmpData->ueCb))
1250    {
1251       DU_LOG("\nERROR  -->  RLC_UL : UeId [%d]: UeCb not found",
1252             ueInfo->ueId);
1253       CFM_STATUS.reason = CKW_CFG_REAS_UE_UNKWN;
1254       CFM_STATUS.status = CKW_CFG_CFM_NOK;
1255       return RFAILED;
1256    }
1257 #undef CFM_STATUS
1258    return ROK;
1259 }
1260
1261
1262 \f
1263 /** 
1264  * @brief 
1265  *    This primitive apply reestablishment of RB.
1266  *  
1267  * @param [in] gCb        -  RLC Instance Control Block
1268  * @param [in] ueInfo     -  UE Identifier
1269  * @param [in] newUeInfo  -  CELL Identifier
1270  * @param [in] cfgTmpData -  Configuration Temporary Data 
1271  *
1272  * @return  S16
1273  *    -# ROK
1274  */
1275 Void rlcCfgApplyUlUeIdChng
1276 (
1277 RlcCb            *gCb,
1278 CkwUeInfo        *ueInfo,
1279 CkwUeInfo        *newUeInfo,
1280 RlcUlCfgTmpData  *cfgTmpData
1281 )
1282 {
1283    
1284 #ifdef LTE_L2_MEAS
1285    rlcHdlMeasUlUeIdChg(gCb, ueInfo->cellId, ueInfo->ueId, newUeInfo->ueId);
1286 #endif   
1287    cmHashListDelete(&(gCb->u.ulCb->ueLstCp), (PTR) cfgTmpData->ueCb);
1288    /* update the hash key with new values */ 
1289    cfgTmpData->ueCb->ueId = newUeInfo->ueId;
1290    cfgTmpData->ueCb->cellId =newUeInfo->cellId;
1291    if(ROK != cmHashListInsert(&(gCb->u.ulCb->ueLstCp),
1292                               (PTR)cfgTmpData->ueCb, 
1293                               (uint8_t *)&(cfgTmpData->ueCb->ueId),
1294                               (uint16_t) sizeof(CmLteRnti)))
1295
1296    {
1297        DU_LOG("\nERROR  -->  RLC_UL : UeId[%u] HashList Insertion Failed",
1298             newUeInfo->ueId);
1299    }
1300
1301    return;
1302 }
1303 /********************************************************************30**
1304
1305          End of file
1306 **********************************************************************/