<JIRA ID: ODUHIGH-390 : Ul throughput per SNSSAI (KPI)>
[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       /*Create the entry of this SNSSAI if not exist in Snssai Tput list*/
393       if(rlcHandleSnssaiTputlist(gCb, rbCb->snssai, CREATE, DIR_UL) == NULLP)
394       {
395          DU_LOG("\nERROR  --> RLC_UL : rlcCfgFillUlRbCb(): SNSSAI insertion in Tput list failed");
396       }
397    }
398    rbCb->mode = entCfg->entMode;
399    
400    return ROK;
401
402
403 \f
404 /** 
405  * @brief This primitive Initializes the RB Cb
406  *
407  * @param [in]    gCb      -  RLC Instance Control Block
408  * @param [out]   rbCb     -  RB Control Block
409  * @param [in]    ptr      -  Void pointer
410  * @param [in]    entCfg   -  Entity Configuration
411  *
412  * @return  S16
413  *    -#ROK
414  *    -#RFAILED
415  */
416 static S16 rlcCfgUpdateUlRb(RlcCb *gCb,RlcUlRbCb *rbCb,void *ptr,RlcEntCfgInfo *entCfg)
417 {
418    
419    switch (rbCb->mode)
420    {
421       case RLC_MODE_TM:
422       {
423          RlcUlCellCb *cellCb = (RlcUlCellCb *)ptr;
424          rbCb->dir = entCfg->dir;
425          rbCb->lch.lChId = entCfg->lCh[0].lChId;
426          rbCb->lch.lChType = entCfg->lCh[0].type;
427          cellCb->lCh[rbCb->lch.lChId - 1].ulRbCb = rbCb;
428          break;
429       }
430       case RLC_MODE_UM:
431       {
432          RlcUlUeCb *ueCb = (RlcUlUeCb *)ptr;
433          ueCb->lCh[rbCb->lch.lChId - 1].ulRbCb = NULLP;
434          rlcCfgFillUlRbCb(gCb,rbCb, ueCb, entCfg);
435          break;
436       }
437       case RLC_MODE_AM:
438       {
439          RlcUlUeCb *ueCb = (RlcUlUeCb *)ptr;
440
441          ueCb->lCh[rbCb->lch.lChId - 1].ulRbCb = NULLP;
442          ueCb->lCh[entCfg->lCh[1].lChId - 1].ulRbCb = rbCb;
443          /* Up Link */
444          rbCb->lch.lChId = entCfg->lCh[1].lChId;
445          rbCb->lch.lChType = entCfg->lCh[1].type;
446          rbCb->m.amUl.staProhTmrInt = entCfg->m.amInfo.ul.staProhTmr;
447          rbCb->m.amUl.reAsmblTmrInt = entCfg->m.amInfo.ul.reAsmblTmr;
448          break;
449       }
450    }
451    
452    if(entCfg->snssai)
453    {
454       if(!rbCb->snssai)
455       {
456          RLC_ALLOC(gCb, rbCb->snssai, sizeof(Snssai));
457          if(rbCb->snssai == NULLP)
458          {
459             DU_LOG("\nERROR  -->  RLC_UL : rlcCfgUpdateUlRb(): Failed to allocate memory for snssai ");
460             return RFAILED;
461          }
462       }
463       memcpy(rbCb->snssai,entCfg->snssai,sizeof(Snssai));
464    }
465    
466    return (CKW_CFG_REAS_NONE);
467
468
469 \f
470 /** 
471  * @brief 
472  *    This primitive validates uplink Add RB Configuration and reserve memory
473  *    for RB creation.
474  *  
475  * @param [in]  gCb      -  RLC Instance Control Block
476  * @param [in]  ueId     -  UE Identifier
477  * @param [in]  cellId   -  CELL Identifier
478  * @param [in]  cfgToValidate   -  Entity Configuration needs to be validated. 
479  * @param [out] status  -  status of configuration
480  *
481  * @return  S16
482  *    -# ROK
483  *    -# RFAILED
484  */
485 S16 rlcValidateRbCfgParams(RlcCb *gCb,CmLteRnti ueId,CmLteCellId cellId,RlcEntCfgInfo *cfgToValidate,CmStatus *status)
486 {
487    if (cellId == 0)
488    {
489       status->reason = CKW_CFG_REAS_CELL_UNKWN;
490       return  (RFAILED);
491    }
492    if ((cfgToValidate->rguSapId >= gCb->genCfg.maxRguSaps) || (cfgToValidate->rguSapId < 0))
493    {
494       RLCDBGP_ERROR(gCb, "rlcValidateRbCfgParams ueId (%u) cellId (%u) Invalid rguSapId (%d))\n",
495             ueId, cellId, cfgToValidate->rguSapId);
496       status->reason = CKW_CFG_REAS_INVALID_RGUSAP;
497       return RFAILED; 
498    }  
499   
500    if((CKW_CFG_ADD == cfgToValidate->cfgType) ||
501       (CKW_CFG_MODIFY == cfgToValidate->cfgType))
502    {
503       /* Validate LChId for UM and AM modes */
504       if ((cfgToValidate->lCh[0].lChId <= 0) ||
505            ((cfgToValidate->entMode == RLC_MODE_AM) &&
506              (cfgToValidate->lCh[1].lChId <= 0)))
507       {
508          status->reason = CKW_CFG_REAS_INVALID_LCHID;
509          return RFAILED; 
510       }  
511       if((cfgToValidate->entMode == RLC_MODE_UM) &&
512          (cfgToValidate->m.umInfo.ul.snLen != RLC_UM_CFG_6BIT_SN_LEN) &&
513          (cfgToValidate->m.umInfo.ul.snLen != RLC_UM_CFG_12BIT_SN_LEN))
514       {   
515          DU_LOG("\nERROR  -->  RLC_UL : UM Mode RB[%d],Invalid SN Len[%d]",
516                cfgToValidate->rbId,
517                cfgToValidate->m.umInfo.ul.snLen);
518          status->reason = CKW_CFG_REAS_INVALID_SNLEN;
519          return RFAILED; 
520       }
521       /* Process Adding new RB */
522       if (ueId == 0)
523       {
524          if(cfgToValidate->rbId >= RLC_MAX_RB_PER_CELL)
525          {
526             status->reason = CKW_CFG_REAS_RB_UNKWN;
527             return RFAILED;
528          }
529
530          if ((cfgToValidate->lCh[0].type != CM_LTE_LCH_CCCH) &&
531                (cfgToValidate->entMode != RLC_MODE_TM))
532          {
533             status->reason= (cfgToValidate->entMode != RLC_MODE_TM)? CKW_CFG_REAS_RB_MODE_MIS:
534                CKW_CFG_REAS_LCHTYPE_MIS;
535             return RFAILED;
536          }
537       }
538       else
539       {
540          if (!(RLC_VALIDATE_UE_RBID(cfgToValidate->rbType, cfgToValidate->rbId)))
541          {
542             status->reason = CKW_CFG_REAS_RB_UNKWN;
543             return RFAILED;
544          }
545
546          if(cfgToValidate->entMode == RLC_MODE_TM)
547          {
548             status->reason = CKW_CFG_REAS_LCHTYPE_MIS;
549             return RFAILED;
550          }
551          if (!(((cfgToValidate->lCh[0].type == CM_LTE_LCH_DCCH) && 
552                (cfgToValidate->entMode != RLC_MODE_UM))|| 
553                (cfgToValidate->lCh[0].type == CM_LTE_LCH_DTCH)) )
554          {
555             status->reason = CKW_CFG_REAS_RB_MODE_MIS;
556             return RFAILED;
557          }
558       }
559    }
560    else /* cfgType is CKW_CFG_DELETE */
561    {
562       if (ueId == 0)
563       {
564          if(cfgToValidate->rbId >= RLC_MAX_RB_PER_CELL)
565          {
566             status->reason = CKW_CFG_REAS_RB_UNKWN;
567             return RFAILED;
568          }
569
570       }
571       else
572       {
573          if (!(RLC_VALIDATE_UE_RBID(cfgToValidate->rbType, cfgToValidate->rbId)))
574          {
575             status->reason = CKW_CFG_REAS_RB_UNKWN;
576             return RFAILED;
577          }
578       }
579    }
580    return ROK;
581 }
582
583 \f
584 /** 
585  * @brief 
586  *    This primitive validates uplink Add RB Configuration and reserve memory
587  *    for RB creation.
588  *  
589  * @param [in]  gCb      -  RLC Instance Control Block
590  * @param [in]  cfgToValidate   -  Entity Configuration needs to be validated. 
591  * @param [out] cfgEntData    -  Configuration Temporary Data Entity
592  * @param [out] cfgTmpData    -  Configuration Temporary Data 
593  *
594  * @return  S16
595  *    -# ROK
596  *    -# RFAILED
597  */
598 S16 rlcCfgValidateUlRb
599 (
600 RlcCb             *gCb,
601 RlcEntCfgInfo    *cfgToValidate,
602 RlcUlEntTmpData   *cfgEntData,
603 RlcUlCfgTmpData   *cfgTmpData 
604 )
605 {
606
607    DU_LOG("\nDEBUG  -->  RLC_UL : cellId(%d), cfgType(%d)",
608                 cfgTmpData->cellId,
609                 cfgToValidate->cfgType);
610
611    if(ROK != rlcValidateRbCfgParams(gCb, 
612                                    cfgTmpData->ueId, 
613                                    cfgTmpData->cellId, 
614                                    cfgToValidate, 
615                                    &cfgEntData->entUlCfgCfm.status))
616    {
617       return RFAILED;
618    }
619    
620    cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_NONE;
621    switch(cfgToValidate->cfgType)
622    {
623       case CKW_CFG_ADD:
624       {
625          if (cfgTmpData->ueId == 0)
626          {
627             /* Cell Cb is added if it not present , it is not roll backed if the
628              * configuration fails */
629             rlcDbmFetchUlCellCb(gCb,cfgTmpData->cellId, &cfgTmpData->cellCb);
630             if(!cfgTmpData->cellCb)
631             {
632                /* cell cb does not exist we need to create a new one */
633                RLC_ALLOC(gCb,cfgTmpData->cellCb, sizeof(RlcUlCellCb));
634                if(!cfgTmpData->cellCb)
635                {
636                   DU_LOG("\nERROR  -->  RLC_UL : Memory allocation failure CELLID:%d",
637                         cfgTmpData->cellId);
638                   cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_CELL_CREAT_FAIL;
639                   return RFAILED;
640                }
641                rlcDbmAddUlCellCb(gCb, cfgTmpData->cellId, cfgTmpData->cellCb);
642             }
643             else
644             {
645                if (( cfgTmpData->cellCb->rbCb[cfgToValidate->rbId] != NULLP))
646                {
647                   cfgEntData->entUlCfgCfm.status.reason =  CKW_CFG_REAS_RB_PRSNT;
648                   return RFAILED;
649                }
650             }
651
652             RLC_ALLOC(gCb,cfgEntData->rbCb, sizeof (RlcUlRbCb));
653             if (!cfgEntData->rbCb)
654             {
655                cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_RB_CREAT_FAIL;
656                return RFAILED;
657             }
658          }
659          else
660          {
661             /* Ue Cb is added if it not present , it is not roll backed if the
662              * configuration fails */
663             rlcDbmFetchUlUeCb(gCb,cfgTmpData->ueId, cfgTmpData->cellId, &cfgTmpData->ueCb);
664             if(!cfgTmpData->ueCb)
665             {
666                RLC_ALLOC(gCb,cfgTmpData->ueCb, sizeof(RlcUlUeCb));
667                if(!cfgTmpData->ueCb)
668                {
669                   DU_LOG("\nERROR  -->  RLC_UL : Memory allocation failure CELLID:%d",
670                         cfgTmpData->cellId);
671                   cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_UE_CREAT_FAIL;
672                   return RFAILED;
673                }
674                rlcDbmAddUlUeCb(gCb, cfgTmpData->ueId, cfgTmpData->cellId, cfgTmpData->ueCb);
675                cfgTmpData->ueCb->ueDeleteInfo.ueDelTmr.tmrEvnt = TMR_NONE;
676             }
677             else
678             {
679                RLC_DBM_GET_RBCB_FROM_UECB(cfgToValidate->rbId, 
680                      cfgToValidate->rbType,
681                      cfgTmpData->ueCb,
682                      cfgEntData->rbCb);
683                if(cfgEntData->rbCb != NULLP)
684                {
685                   cfgEntData->entUlCfgCfm.status.reason =  CKW_CFG_REAS_RB_PRSNT;
686                   return RFAILED;
687                }
688             }
689             RLC_ALLOC(gCb,cfgEntData->rbCb, sizeof (RlcUlRbCb));
690             if (!cfgEntData->rbCb)
691             {
692                cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_RB_CREAT_FAIL;
693                return RFAILED;
694             }
695          }
696          /*Allocating the memory for receive buffer */
697          if(RLC_MODE_UM == cfgToValidate->entMode)
698          {
699             uint16_t hashIndex;
700         
701             /* Spec 38.322 Section 7.2 
702              * UM_Window_Size = 32 when a 6 bit SN is configured, 
703              * UM_Window_Size = 2048 when a 12 bit SN is configured.
704              */
705             cfgEntData->rbCb->m.umUl.umWinSz = RLC_POWER(2, 
706                   ((cfgToValidate->m.umInfo.ul.snLen *6)-1));
707             RLC_ALLOC(gCb, cfgEntData->rbCb->m.umUl.recBufLst,
708               (RLC_RCV_BUF_BIN_SIZE * sizeof(CmLListCp)));
709             for(hashIndex = 0; hashIndex < RLC_RCV_BUF_BIN_SIZE; hashIndex++ )
710             {
711                cmLListInit(&(cfgEntData->rbCb->m.umUl.recBufLst[hashIndex]));
712             }
713          }
714          else if(RLC_MODE_AM == cfgToValidate->entMode)
715          {
716 #ifndef LTE_TDD 
717              uint32_t hashIndex;
718               RLC_ALLOC(gCb,
719                     cfgEntData->rbCb->m.amUl.recBufLst,
720                     (RLC_RCV_BUF_BIN_SIZE * sizeof(CmLListCp )));
721               for(hashIndex = 0; hashIndex < RLC_RCV_BUF_BIN_SIZE; hashIndex++)
722               {
723                   cmLListInit(&(cfgEntData->rbCb->m.amUl.recBufLst[hashIndex]));
724               }
725 #endif
726          }
727          break;
728       }
729       case CKW_CFG_MODIFY: 
730       case CKW_CFG_DELETE:
731       {
732          if (cfgTmpData->ueId == 0)
733          {
734             /* Try to get the CellCb if it already exists */
735             rlcDbmFetchUlCellCb(gCb,cfgTmpData->cellId, &cfgTmpData->cellCb);
736             if(!cfgTmpData->cellCb)
737             {
738                DU_LOG("\nERROR  -->  RLC_UL : CellCb not found UEID:%d",
739                       cfgTmpData->ueId);
740                /*how can a modify request come for a cell which does not exist*/
741                cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_CELL_UNKWN;
742                return RFAILED;
743             }
744
745             cfgEntData->rbCb = cfgTmpData->cellCb->rbCb[cfgToValidate->rbId];
746             if (!cfgEntData->rbCb)
747             {
748                /* something is wrong the rbId for this cell does not exist */
749                cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_RB_UNKWN;
750                return RFAILED;
751             }
752             return ROK;
753          }
754          else
755          {
756             rlcDbmFetchUlUeCb(gCb,cfgTmpData->ueId, cfgTmpData->cellId, &cfgTmpData->ueCb);
757             if(!cfgTmpData->ueCb)
758             {   
759                DU_LOG("\nERROR  -->  RLC_UL : UeId [%d]: UeCb not found",
760                      cfgTmpData->ueId);
761                cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_UE_UNKWN;
762                return RFAILED;
763             }
764
765             /* Get rbCb */
766             RLC_DBM_GET_RBCB_FROM_UECB(cfgToValidate->rbId, 
767                                       cfgToValidate->rbType, 
768                                       cfgTmpData->ueCb, 
769                                       cfgEntData->rbCb);
770             if ( cfgEntData->rbCb == NULLP)
771             {
772                cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_RB_UNKWN;
773                return RFAILED;
774             }
775             return ROK;
776          }
777          break;
778       }
779    }
780
781    if(cfgToValidate->cfgType == CKW_CFG_MODIFY)
782    {
783       if(cfgToValidate->entMode != cfgEntData->rbCb->mode)
784       {
785          cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_RB_MODE_MIS;
786          return RFAILED;
787       }
788
789       if(cfgToValidate->m.umInfo.ul.snLen != cfgEntData->rbCb->m.umUl.snLen)
790       {
791          cfgEntData->entUlCfgCfm.status.reason = CKW_CFG_REAS_SNLEN_MIS;
792          return RFAILED;
793       }
794    }
795    return ROK;
796 }
797
798 \f
799 /** 
800  * @brief 
801  *    This primitive roll back the RB Configuration
802  *  
803  * @param [in]  gCb      -  RLC Instance Control Block
804  * @param [in]  ueId     -  UE Identifier
805  * @param [in]  cfg   -     Configuration entity. 
806  * @param [out] cfgEntData    -  Configuration Temporary Data Entity
807  *
808  * @return  S16
809  *    -# ROK
810  *    -# RFAILED
811  */
812 S16 rlcCfgRollBackUlRb
813 (
814 RlcCb             *gCb,
815 CmLteRnti        ueId,
816 RlcEntCfgInfo    *cfg,
817 RlcUlEntTmpData   *cfgEntData
818 )
819 {
820
821    if(CKW_CFG_ADD == cfg->cfgType)
822    {
823       if(RLC_MODE_UM == cfg->entMode)
824       {
825          RLC_FREE(gCb, cfgEntData->rbCb->m.umUl.recBufLst, (RLC_RCV_BUF_BIN_SIZE * sizeof(CmLListCp)));
826       }
827       else if(RLC_MODE_AM == cfg->entMode)
828       {
829 #ifndef LTE_TDD 
830       RLC_FREE(gCb,cfgEntData->rbCb->m.amUl.recBufLst, (RLC_RCV_BUF_BIN_SIZE * sizeof(CmLListCp)));
831 #endif
832       }
833       RLC_FREE(gCb,cfgEntData->rbCb, sizeof(RlcUlRbCb));
834    }
835
836    return ROK;
837 }
838
839 \f
840 /** 
841  * @brief 
842  *    This primitive apply RB Configuration. 
843  *  
844  * @param [in] gCb      -  RLC Instance Control Block
845  * @param [in] cfgToAply  -   Configuration to be applied 
846  * @param [out] cfgEntData    -  Configuration Temporary Data Entity
847  * @param [out] cfgTmpData    -  Configuration Temporary Data 
848  *
849  * @return  S16
850  *    -# ROK
851  *    -# RFAILED
852  */
853 Void rlcCfgApplyUlRb
854 (
855 RlcCb             *gCb,
856 RlcEntCfgInfo    *cfgToAply,
857 RlcUlEntTmpData   *cfgEntData,
858 RlcUlCfgTmpData   *cfgTmpData
859 )
860 {
861   
862    switch(cfgToAply->cfgType)
863    {
864       case CKW_CFG_ADD:
865       {
866          /* copy the RB Cb into UeCb */
867          cfgEntData->rbCb->rlcId.rbId = cfgToAply->rbId;
868          if (cfgTmpData->ueId == 0)
869          {
870             cfgTmpData->cellCb->rbCb[cfgToAply->rbId] = cfgEntData->rbCb;
871             cfgTmpData->cellCb->lCh[cfgToAply->lCh[0].lChId -1].ulRbCb = cfgEntData->rbCb;
872          }
873          else
874          {
875             if(cfgToAply->rbType == CM_LTE_SRB)
876             {
877                cfgTmpData->ueCb->srbCb[cfgToAply->rbId] = cfgEntData->rbCb;
878             }
879             else
880             {
881                cfgTmpData->ueCb->drbCb[cfgToAply->rbId] = cfgEntData->rbCb;
882             }
883          }
884
885          RLC_LMM_RB_STS_INC(gCb);
886
887          cfgEntData->rbCb->rlcId.cellId = cfgTmpData->cellId;
888          cfgEntData->rbCb->rlcId.ueId   = cfgTmpData->ueId;
889          cfgEntData->rbCb->rlcId.rbType = cfgToAply->rbType;
890          cfgEntData->rbCb->inst         = gCb->init.inst;
891
892          /* Fill RB CB */
893          rlcCfgFillUlRbCb(gCb,
894                          cfgEntData->rbCb, 
895                          cfgTmpData->ueCb,
896                          cfgToAply);
897
898 #ifdef LTE_L2_MEAS
899          cfgEntData->rbCb->qci = cfgToAply->qci;
900          cfgEntData->rbCb->ueCb =  cfgTmpData->ueCb;
901          if (cfgToAply->lCh[1].type == CM_LTE_LCH_DTCH)
902          {
903             /* ccpu00129778 */
904             rlcAddToUlL2Meas(gCb, cfgEntData->rbCb,
905                   cfgTmpData->cellId,cfgTmpData->ueId); 
906          }
907 #endif /* LTE_L2_MEAS */
908          break;
909       }
910       case CKW_CFG_MODIFY:
911       {
912          if(cfgTmpData->ueId == 0)
913          {
914             rlcCfgUpdateUlRb(gCb,
915                             cfgEntData->rbCb, 
916                             (void *)cfgTmpData->cellCb, 
917                             cfgToAply);
918          }
919          else
920          {
921             rlcCfgUpdateUlRb(gCb,
922                             cfgEntData->rbCb, 
923                             (void*)cfgTmpData->ueCb, 
924                             cfgToAply);
925          }
926          break;
927       }
928       case CKW_CFG_DELETE:
929       {
930          if (cfgTmpData->ueId == 0)
931          {
932             cfgTmpData->cellCb->rbCb[cfgToAply->rbId] = NULLP;
933             cfgTmpData->cellCb->lCh[cfgEntData->rbCb->lch.lChId - 1].ulRbCb = 
934                                                                         NULLP;
935          }
936          else
937          {
938             cfgTmpData->ueCb->lCh[cfgEntData->rbCb->lch.lChId - 1].ulRbCb = 
939                                                                        NULLP;
940
941             /* Free the Buffers of RbCb */
942             if( RLC_MODE_UM == cfgEntData->rbCb->mode )
943             {
944                rlcUmmFreeUlRbCb(gCb, cfgEntData->rbCb);
945             }
946             else if(RLC_MODE_AM == cfgEntData->rbCb->mode)
947             {
948                rlcAmmFreeUlRbCb(gCb,cfgEntData->rbCb);
949             }
950
951             /* Assign NULLP to rbCb in rbCbLst */
952             if ( cfgToAply->rbType == CM_LTE_SRB )
953             {
954                cfgTmpData->ueCb->srbCb[cfgToAply->rbId] = NULLP;
955             }
956             else
957             {
958                cfgTmpData->ueCb->drbCb[cfgToAply->rbId] = NULLP;
959             }
960          }
961          /* Delete RbCb  */
962          RLC_FREE(gCb,cfgEntData->rbCb, sizeof(RlcUlRbCb));
963
964          RLC_LMM_RB_STS_DEC(gCb);
965          break;
966       }
967    }
968    return;
969 }
970
971 \f
972 /** 
973  * @brief 
974  *    This primitive validates uplink Delete UE request 
975  *    for RB creation.
976  *  
977  * @param [in]  gCb      -  RLC Instance Control Block
978  * @param [in]  cfgToValidate   -  Entity Configuration to be validated.
979  * @param [out] cfgEntData    -  Configuration Temporary Data Entity
980  * @param [out] cfgTmpData    -  Configuration Temporary Data 
981  *
982  * @return  S16
983  *    -# ROK
984  *    -# RFAILED
985  */
986 S16 rlcCfgValidateDelUlUe
987 (
988 RlcCb             *gCb,
989 RlcEntCfgInfo    *cfgToValidate,
990 RlcUlEntTmpData   *cfgEntData,
991 RlcUlCfgTmpData   *cfgTmpData
992 )
993 {
994
995     DU_LOG("\nDEBUG  -->  RLC_UL : cellId(%d), cfgType(%d)",
996               cfgTmpData->cellId,cfgToValidate->cfgType);
997    
998    /* Check for ueId is present or not */
999    if ( cfgTmpData->ueId == 0 )
1000    {
1001       cfgEntData->entUlCfgCfm.status.reason =  CKW_CFG_REAS_UE_UNKWN;
1002       DU_LOG("\nERROR  -->  RLC_UL : UeId is 0 for CELLID;%d",
1003             cfgTmpData->cellId);
1004       return RFAILED;
1005    }
1006
1007    /* Fetch Ue Cb */
1008    if(ROK != rlcDbmFetchUlUeCb(gCb,cfgTmpData->ueId, cfgTmpData->cellId, &cfgTmpData->ueCb))
1009    {
1010       DU_LOG("\nERROR  -->  RLC_UL : UeId [%d]: UeCb not found",
1011             cfgTmpData->ueId);
1012       cfgEntData->entUlCfgCfm.status.reason =  CKW_CFG_REAS_UE_UNKWN;
1013       return RFAILED;
1014    }
1015    return ROK;
1016 }
1017
1018 \f
1019 /** 
1020  * @brief 
1021  *    This primitive apply Uplink Delete Ue request 
1022  *  
1023  * @param [in] gCb      -  RLC Instance Control Block
1024  * @param [in] cfgTmpData    -  Configuration Temporary Data 
1025  *
1026  * @return  S16
1027  *    -# ROK
1028  */
1029 Void rlcCfgApplyDelUlUe
1030 (
1031 RlcCb             *gCb,
1032 RlcUlCfgTmpData   *cfgTmpData
1033 )
1034 {
1035    
1036 #ifdef LTE_L2_MEAS
1037    rlcDelFrmUlL2Meas(gCb,cfgTmpData->cellId,cfgTmpData->ueId);
1038 #endif
1039    rlcDbmDelUlUeCb(gCb,cfgTmpData->ueCb, FALSE);
1040    return;
1041 }
1042   
1043 \f
1044 /** 
1045  * @brief 
1046  *    This primitive validates uplink Delete UE request 
1047  *    for RB creation.
1048  *  
1049  * @param [in] gCb      -  RLC Instance Control Block
1050  * @param [in] ueId     -  UE Identifier
1051  * @param [in] cfgToValidate   -  Entity Configuration to be done.
1052  * @param [in] cfgEntData    -  Configuration Temporary Data Entity
1053  * @param [in] cfgTmpData    -  Configuration Temporary Data 
1054  *
1055  * @return  S16
1056  *    -# ROK
1057  *    -# RFAILED
1058  */
1059 S16 rlcCfgValidateDelUlCell
1060 (
1061 RlcCb             *gCb,
1062 CmLteCellId      cellId,
1063 RlcEntCfgInfo    *cfgToValidate,
1064 RlcUlEntTmpData   *cfgEntData,
1065 RlcUlCfgTmpData   *cfgTmpData
1066 )
1067 {
1068
1069    DU_LOG("\nDEBUG  -->  RLC_UL : cfgType(%d)",
1070               cfgToValidate->cfgType);
1071    
1072    cfgTmpData->cellCb = NULLP;
1073
1074    /* Check for cellId is present or not */
1075    if ( cellId == 0 )
1076    {
1077       cfgEntData->entUlCfgCfm.status.reason =  CKW_CFG_REAS_CELL_UNKWN;
1078       DU_LOG("\nERROR  -->  RLC_UL : CellId is 0");
1079       return RFAILED;
1080    }
1081
1082    /* Fetch Cell Cb */
1083    rlcDbmFetchUlCellCb(gCb,cellId, &cfgTmpData->cellCb);
1084    if (!cfgTmpData->cellCb)
1085    {
1086       cfgEntData->entUlCfgCfm.status.reason =  CKW_CFG_REAS_CELL_UNKWN;
1087       DU_LOG("\nERROR  -->  RLC_UL : CellCb not found");
1088       return RFAILED;
1089    }
1090    return ROK;
1091 }
1092
1093 \f
1094 /** 
1095  * @brief 
1096  *    This primitive apply Uplink Delete Ue request 
1097  *  
1098  * @param [in] gCb      -  RLC Instance Control Block
1099  * @param [in] cfgEntData  - Temporary Data maintained for a transaction 
1100  *
1101  * @return  S16
1102  *    -# ROK
1103  */
1104 Void rlcCfgApplyDelUlCell(RlcCb *gCb,RlcUlCfgTmpData *cfgInfo)
1105 {
1106    
1107    rlcDbmDelUlCellCb(gCb,cfgInfo->cellCb);
1108    return;
1109 }
1110 \f
1111 /** 
1112  * @brief 
1113  *    This primitive validates reestablishment of RB.
1114  *  
1115  * @param [in]   gCb      -  RLC Instance Control Block
1116  * @param [in]   ueId     -  UE Identifier
1117  * @param [in]   cellId   -  CELL Identifier
1118  * @param [in]   cfgToValidate   -  Entity Configuration to be done.
1119  * @param [out] cfgEntData    -  Configuration Temporary Data Entity
1120  *
1121  * @return  S16
1122  *    -# ROK
1123  *    -# RFAILED
1124  */
1125 S16 rlcCfgValidateReEstRb
1126 (
1127 RlcCb             *gCb,
1128 CmLteRnti        ueId,
1129 CmLteCellId      cellId,
1130 RlcEntCfgInfo    *cfgToValidate,
1131 RlcUlEntTmpData   *cfgEntData
1132 )
1133 {
1134    CmLteRlcId   rlcId;   /* RLC Identifier */
1135
1136     DU_LOG("\nDEBUG  -->  RLC_UL : cellId(%d) RBID:%d",
1137          cellId,
1138          cfgToValidate->rbId); 
1139
1140    /* Get rlcId */
1141    rlcId.ueId = ueId;
1142    rlcId.cellId = cellId;
1143    rlcId.rbId = cfgToValidate->rbId;
1144    rlcId.rbType = cfgToValidate->rbType;
1145
1146    rlcDbmFetchUlRbCbByRbId(gCb,&rlcId, &cfgEntData->rbCb);
1147    if (cfgEntData->rbCb == NULLP)
1148    {
1149       DU_LOG("\nERROR  -->  RLC_UL : CellId [%u]: rbId [%d] not found",
1150              cellId,
1151              cfgToValidate->rbId);
1152       cfgEntData->entUlCfgCfm.status.reason =  CKW_CFG_REAS_RB_UNKWN;
1153       return RFAILED;
1154    }
1155
1156    return ROK;
1157 }
1158
1159
1160 \f
1161 /** 
1162  * @brief 
1163  *    This primitive apply reestablishment of RB.
1164  *  
1165  * @param [in] gCb        -  RLC Instance Control Block
1166  * @param [in] ueId       -  UE Identifier
1167  * @param [in] cellId     -  CELL Identifier
1168  * @param [in] sndReEstInd  -  ReEstablish Indication Flag 
1169  * @param [in] cfgEntData -  Configuration Temporary Data Entity 
1170  *
1171  * @return  S16
1172  *    -# ROK
1173  */
1174 Void rlcCfgApplyReEstUlRb
1175 (
1176 RlcCb           *gCb,
1177 CmLteRnti       ueId,
1178 CmLteCellId     cellId,
1179 Bool            sndReEstInd,
1180 RlcUlEntTmpData *cfgEntData
1181 )
1182 {
1183    CmLteRlcId   rlcId;   /* RLC Identifier */
1184    
1185    rlcId.ueId = ueId;
1186    rlcId.cellId = cellId;
1187    rlcId.rbId = cfgEntData->entUlCfgCfm.rbId;
1188    rlcId.rbType = cfgEntData->entUlCfgCfm.rbType;
1189    cfgEntData->rbCb->rlcId.ueId = ueId;
1190    switch (cfgEntData->rbCb->mode)
1191    {
1192       case RLC_MODE_TM:
1193          {
1194             rlcTmmUlReEstablish(gCb,cfgEntData->rbCb);
1195             break;
1196          }
1197
1198       case RLC_MODE_UM:
1199          {
1200             rlcUmmUlReEstablish(gCb,&rlcId,cfgEntData->rbCb);
1201             break;
1202          }
1203
1204       case RLC_MODE_AM:
1205          {
1206             rlcAmmUlReEstablish(gCb,rlcId,sndReEstInd,cfgEntData->rbCb);
1207             break;
1208          }
1209    }
1210    return;
1211 }
1212 \f
1213 /** 
1214  * @brief 
1215  *    This primitive validates reestablishment of RB.
1216  *  
1217  * @param [in] gCb        -  RLC Instance Control Block
1218  * @param [in] ueInfo     -  UE Identifier
1219  * @param [in] newUeInfo  -  CELL Identifier
1220  * @param [in] cfgTmpData -  Configuration Temporary Data 
1221  *
1222  * @return  S16
1223  *    -# ROK
1224  *    -# RFAILED
1225  */
1226 S16 rlcCfgValidateUeIdChng
1227 (
1228 RlcCb            *gCb,
1229 CkwUeInfo        *ueInfo,
1230 CkwUeInfo        *newUeInfo,
1231 RlcUlCfgTmpData  *cfgTmpData
1232 )
1233 {
1234    RlcUlUeCb   *ueCb;
1235
1236 #define CFM_STATUS  cfgTmpData->cfgEntData[0].entUlCfgCfm.status
1237    if ( (ueInfo->ueId == newUeInfo->ueId) && 
1238         (ueInfo->cellId == newUeInfo->cellId))
1239    {
1240       CFM_STATUS.reason = CKW_CFG_REAS_SAME_UEID;
1241       CFM_STATUS.status = CKW_CFG_CFM_NOK; 
1242       return RFAILED;
1243    } 
1244    
1245    if(ROK == rlcDbmFetchUlUeCb(gCb,newUeInfo->ueId, newUeInfo->cellId, &ueCb))
1246    {
1247       DU_LOG("\nERROR  -->  RLC_UL : NewUeId[%d]:ueCb already exists",
1248              newUeInfo->ueId);
1249       CFM_STATUS.reason = CKW_CFG_REAS_UE_EXISTS;
1250       CFM_STATUS.status = CKW_CFG_CFM_NOK;
1251       return RFAILED;
1252    }
1253   
1254    if(ROK != rlcDbmFetchUlUeCb(gCb,ueInfo->ueId, ueInfo->cellId, 
1255                               &cfgTmpData->ueCb))
1256    {
1257       DU_LOG("\nERROR  -->  RLC_UL : UeId [%d]: UeCb not found",
1258             ueInfo->ueId);
1259       CFM_STATUS.reason = CKW_CFG_REAS_UE_UNKWN;
1260       CFM_STATUS.status = CKW_CFG_CFM_NOK;
1261       return RFAILED;
1262    }
1263 #undef CFM_STATUS
1264    return ROK;
1265 }
1266
1267
1268 \f
1269 /** 
1270  * @brief 
1271  *    This primitive apply reestablishment of RB.
1272  *  
1273  * @param [in] gCb        -  RLC Instance Control Block
1274  * @param [in] ueInfo     -  UE Identifier
1275  * @param [in] newUeInfo  -  CELL Identifier
1276  * @param [in] cfgTmpData -  Configuration Temporary Data 
1277  *
1278  * @return  S16
1279  *    -# ROK
1280  */
1281 Void rlcCfgApplyUlUeIdChng
1282 (
1283 RlcCb            *gCb,
1284 CkwUeInfo        *ueInfo,
1285 CkwUeInfo        *newUeInfo,
1286 RlcUlCfgTmpData  *cfgTmpData
1287 )
1288 {
1289    
1290 #ifdef LTE_L2_MEAS
1291    rlcHdlMeasUlUeIdChg(gCb, ueInfo->cellId, ueInfo->ueId, newUeInfo->ueId);
1292 #endif   
1293    cmHashListDelete(&(gCb->u.ulCb->ueLstCp), (PTR) cfgTmpData->ueCb);
1294    /* update the hash key with new values */ 
1295    cfgTmpData->ueCb->ueId = newUeInfo->ueId;
1296    cfgTmpData->ueCb->cellId =newUeInfo->cellId;
1297    if(ROK != cmHashListInsert(&(gCb->u.ulCb->ueLstCp),
1298                               (PTR)cfgTmpData->ueCb, 
1299                               (uint8_t *)&(cfgTmpData->ueCb->ueId),
1300                               (uint16_t) sizeof(CmLteRnti)))
1301
1302    {
1303        DU_LOG("\nERROR  -->  RLC_UL : UeId[%u] HashList Insertion Failed",
1304             newUeInfo->ueId);
1305    }
1306
1307    return;
1308 }
1309 /********************************************************************30**
1310
1311          End of file
1312 **********************************************************************/