U8, U16, U32 data type changes
[o-du/l2.git] / src / 5gnrrlc / kw_dbm_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:    RLC - Database module file
22     
23         Type:    C source file
24   
25         Desc:    Source code for Database Module functions such as, 
26
27         File:    kw_dbm_ul.c
28   
29 *********************************************************************21*/
30 static const char* RLOG_MODULE_NAME="DBM";
31 static int RLOG_MODULE_ID=2048;
32 static int RLOG_FILE_ID=194;
33
34 \f
35 /* header (.h) include files */
36 #include "common_def.h"
37 #include "lkw.h"           /* LKW defines */
38 #include "ckw.h"           /* CKW defines */
39 #include "kwu.h"           /* KWU defines */
40 #include "rgu.h"           /* RGU defines */
41 #include "kw_err.h"        /* Err defines */
42 #include "kw_env.h"        /* RLC environment options */
43
44 #include "kw.h"            /* RLC defines */
45 #include "kw_ul.h"
46
47 /* extern (.x) include files */
48 #include "lkw.x"           /* LKW */
49 #include "ckw.x"           /* CKW */
50 #include "kwu.x"           /* KWU */
51 #include "rgu.x"           /* RGU */
52
53 #include "kw.x"
54 #include "kw_ul.x"
55
56 /** 
57  * @file gp_dbm_ul.c
58  * @brief RLC Uplink database module
59 */
60
61 #define RLC_MODULE RLC_DBGMASK_DUT
62
63 \f
64 /**
65  * @brief Handler to initialize hash list
66  *       
67  * @details
68  *    This function initializes the UeCb, CellCb and transactions hash lists
69  *
70  * @param[in] gCb   RLC instance control block
71  * 
72  * @return  S16
73  *     -# ROK 
74  *     -# RFAILED 
75 */
76 #ifdef ANSI
77 S16 rlcDbmUlInit
78 (
79 RlcCb *gCb
80 )
81 #else
82 S16 rlcDbmUlInit(gCb)
83 RlcCb *gCb;
84 #endif
85 {
86    /* Initialize ueCb Hash List */
87    if(ROK != cmHashListInit(&(gCb->u.ulCb->ueLstCp), 
88                             (uint16_t) RLC_UE_LIST_BUCKET_SIZE,
89                             (uint16_t) 0, 
90                             (Bool) FALSE, 
91                             (uint16_t) CM_HASH_KEYTYPE_CONID,
92                             RLC_GET_MEM_REGION(gCb), 
93                             RLC_GET_MEM_POOL(gCb)))
94    {
95       RLOG0(L_ERROR, "UeLstCp Initialization Failed");
96       return RFAILED;
97    }
98
99    /* Initialize cellCb Hash List */
100    if(ROK != cmHashListInit(&(gCb->u.ulCb->cellLstCp), 
101                             (uint16_t) RLC_CELL_LIST_BUCKET_SIZE,
102                             (uint16_t) 0, 
103                             (Bool) FALSE, 
104                             (uint16_t) CM_HASH_KEYTYPE_CONID,
105                             RLC_GET_MEM_REGION(gCb), 
106                             RLC_GET_MEM_POOL(gCb)))
107    {
108       cmHashListDeinit(&gCb->u.ulCb->ueLstCp);
109       RLOG0(L_ERROR, "CellLstCp Initialization Failed");
110       return RFAILED;
111    }
112
113    if(ROK != cmHashListInit(&(gCb->u.ulCb->transIdLstCp), 
114                             (uint16_t) RLC_TRANS_ID_LST_BKT_SIZE,
115                             (uint16_t) 0, 
116                             (Bool) FALSE, 
117                             (uint16_t) CM_HASH_KEYTYPE_CONID,
118                             RLC_GET_MEM_REGION(gCb), 
119                             RLC_GET_MEM_POOL(gCb)))
120    {
121       cmHashListDeinit(&gCb->u.ulCb->ueLstCp);
122       cmHashListDeinit(&gCb->u.ulCb->cellLstCp);
123       RLOG0(L_ERROR, "transIdLstCp Initialization Failed");
124       return RFAILED;
125    }
126
127 /* kw005.201 added support for L2 Measurement */         
128 #ifdef LTE_L2_MEAS
129    /* Initialize qcI Hash List */
130 #endif /* LTE_L2_MEAS */
131
132    return (ROK);
133 } /* rlcDbmUlInit */
134
135 \f
136 /**
137  * @brief Handler to De initialize hash list
138  *       
139  * @param[in]    gCb      RLC Instance Control Block
140  *
141  * @return  Void
142 */
143 #ifdef ANSI
144 Void rlcDbmUlDeInit
145 (
146 RlcCb *gCb
147 )
148 #else
149 Void rlcDbmUlDeInit(gCb)
150 RlcCb *gCb;
151 #endif
152 {
153
154    /* De Initialize ueCb Hash List */
155    cmHashListDeinit(&(gCb->u.ulCb->ueLstCp));
156
157    /* De Initialize cellCb Hash List */
158    cmHashListDeinit(&(gCb->u.ulCb->cellLstCp));
159
160    /* De Initialize transaction Hash List */
161    cmHashListDeinit(&(gCb->u.ulCb->transIdLstCp));
162 /* kw005.201 added support for L2 Measurement */         
163 #ifdef LTE_L2_MEAS_RLC
164    /* De Initialize qciCb Hash List */
165    cmHashListDeinit(&(rlcCb.rlcL2Cb.qciHlCp));
166 #endif /* LTE_L2_MEAS */
167
168    return;
169 } /* kwDbmDeInit */
170
171
172 /**
173  * @brief Handler to fetch rbCb by the rlcId
174  *       
175  * @details
176  *    This function is invoked by CFG to fetch rbCb from the cellCb/ueCb in
177  *    the upper interface (CKW/KWU).
178  *
179  * @param[in]    gCb     RLC Instance Control Block
180  * @param[in]    rlcId   RLC Identifier 
181  * @param[out]   rbCb    RB Control Block
182  *
183  * @return  Void
184 */
185 #ifdef ANSI
186 Void rlcDbmFetchUlRbCbByRbId
187 (
188 RlcCb         *gCb,
189 CmLteRlcId   *rlcId,  
190 RlcUlRbCb     **rbCb  
191 )
192 #else
193 Void rlcDbmFetchUlRbCbByRbId(gCb, rlcId, rbCb)
194 RlcCb         *gCb;
195 CmLteRlcId   *rlcId;    
196 RlcUlRbCb     **rbCb;   
197 #endif
198 {
199    *rbCb= NULLP;
200
201    /* Check for UE CB or CELL CB */
202    if (rlcId->ueId == 0)
203    {
204       RlcUlCellCb *cellCb;
205
206       if(rlcId->rbId >= RLC_MAX_RB_PER_CELL)
207       {
208          RLOG_ARG3(L_ERROR,DBG_RBID,rlcId->rbId ,
209                "Invalid RbId, cellId:%d UEID:%d Max is [%d]",
210                rlcId->cellId, 
211                rlcId->ueId,
212                RLC_MAX_RB_PER_CELL);
213          return;
214       }
215
216       rlcDbmFetchUlCellCb(gCb,rlcId->cellId, &cellCb);
217       if(!cellCb)
218       {
219          RLOG_ARG2(L_ERROR,DBG_CELLID,rlcId->cellId,
220                "CellCb not found RBID:%d UEID:%d",
221                rlcId->rbId,
222                rlcId->ueId);
223          return;
224       }
225
226       *rbCb = cellCb->rbCb[rlcId->rbId];
227    }
228    else
229    {
230       RlcUlUeCb *ueCb;
231
232       if (!(RLC_VALIDATE_UE_RBID(rlcId->rbType, rlcId->rbId)))
233       {
234          RLOG_ARG3(L_ERROR,DBG_RBID, rlcId->rbId,
235                "Invalid RbId for RbType[%d] CELLID:%d UEID:%d", 
236                rlcId->rbType,
237                rlcId->cellId,
238                rlcId->ueId);
239          return;
240       }
241
242       if (rlcDbmFetchUlUeCb(gCb,rlcId->ueId, rlcId->cellId, &ueCb) != ROK)
243       {
244          RLOG_ARG2(L_ERROR,DBG_CELLID, rlcId->cellId,
245                "UeId [%d]: UeCb not found RBID:%d",
246                rlcId->ueId,
247                rlcId->rbId);
248          return;
249       }
250
251       RLC_DBM_GET_RBCB_FROM_UECB(rlcId->rbId, rlcId->rbType, ueCb, *rbCb);
252    }
253    return;
254 } /* rlcDbmFetchUlRbCbByRbId */
255
256 \f
257 /**
258  * @brief Handler to fetch rbCb from Local Channel Id 
259  *
260  * @details
261  *    This function is invoked by CFG to fetch rbCb from the cellCb/ueCb
262  *    from local Channel Id (CKW/KWU).
263  *
264  * @param[in]    gCb      -  RLC Instance Control Block
265  * @param[in]    cellId   -  CELL Identifier 
266  * @param[in]    ueId     -  UE Identifier 
267  * @param[in]    lcId     -  Logical Channel Identifier
268  * @param[out]   rbCb     -  RB Control Block
269  *
270  * @return  Void
271  *
272 */
273 void rlcDbmFetchUlRbCbFromLchId(RlcCb *gCb, CmLteRnti ueId, CmLteCellId cellId,\
274    CmLteLcId lcId, RlcUlRbCb **rbCb)
275 {
276    RlcUlUeCb *ueCb;
277
278    *rbCb = NULLP;
279    
280    /* Check for UE CB or CELL CB */
281    if (ueId == 0)
282    {
283       RlcUlCellCb *cellCb;
284       
285       rlcDbmFetchUlCellCb(gCb,cellId, &cellCb);
286       if(!cellCb)
287       {
288          DU_LOG("\nRLC : rlcDbmFetchUlRbCbFromLchId: CellCb[%d] not found UEID:%d",\
289             cellId, ueId);
290          return;
291       }
292
293       *rbCb = cellCb->lCh[lcId - 1].ulRbCb;
294       return;
295    }
296    
297    if (rlcDbmFetchUlUeCb(gCb,ueId, cellId, &ueCb) != ROK)
298    {
299       DU_LOG("\nRLC : rlcDbmFetchUlRbCbFromLchId: UeId [%d]: UeCb not found",ueId);
300       return;
301    }
302
303    *rbCb = ueCb->lCh[lcId - 1].ulRbCb;
304
305    return;
306 } /* kwDbmFetchRbCbFromLchId */
307
308 \f
309 /**
310  * @brief Handler to delete RbCb
311  *       
312  * @details 
313  *    This function is invoked by CFG to remove RbCb from Ue/Cell hashlist 
314  *
315  * @param[in] gCb       - RLC Instance Control Block
316  * @param[in] rbCbLst   - Rb Cb List
317  * @param[in] numRbCb   - Number of rbCbs
318  *
319  * @return  Void
320  *
321 */
322 #ifdef ANSI
323 Void rlcDbmDelAllUlRb
324 (
325 RlcCb       *gCb,
326 RlcUlRbCb   **rbCbLst,          
327 uint8_t         numRbCb            
328 )
329 #else
330 Void rlcDbmDelAllUlRb(gCb, rbCbLst, numRbCb)
331 RlcCb       *gCb;
332 RlcUlRbCb   **rbCbLst;        
333 uint8_t         numRbCb;         
334 #endif
335 {
336    uint32_t idx; /* Index */
337
338    for (idx = 0; idx < numRbCb; idx++)
339    {
340       if (rbCbLst[idx] != NULLP)
341       {
342          /* Free the Buffers of RbCb */
343          if( CM_LTE_MODE_UM == rbCbLst[idx]->mode ) 
344          {
345             rlcUmmFreeUlRbCb(gCb,rbCbLst[idx]);
346          }
347          else if(CM_LTE_MODE_AM == rbCbLst[idx]->mode) 
348          {
349             rlcAmmFreeUlRbCb(gCb,rbCbLst[idx]);
350          }
351      
352          RLC_FREE (gCb,rbCbLst[idx], sizeof (RlcUlRbCb));
353       }
354    }
355
356    return;
357 } /* kwDbmDelAllRb */
358
359 \f
360 /**
361  * @brief  Handler to create an UeCb
362  *
363  * @details  
364  *    This function is invoked by CFG to create UeCb and insert into the 
365  *    Ue hashlist of RlcCb.
366  *
367  * @param[in] gCb       RLC Instance Control Block
368  * @param[in] ueId      UE Identifier 
369  * @param[in] cellId    Cell Identifier 
370  * @param[in] ueCb      UE Control Block 
371  *
372  * @return  S16
373  *    -# ROK 
374  *    -# RFAILED 
375  *
376 */
377 #ifdef ANSI
378 S16 rlcDbmAddUlUeCb
379 (
380 RlcCb          *gCb,
381 CmLteRnti     ueId,       
382 CmLteCellId   cellId,    
383 RlcUlUeCb      *ueCb    
384 )
385 #else
386 S16 rlcDbmAddUlUeCb(gCb, ueId, cellId, ueCb)
387 RlcCb          *gCb;
388 CmLteRnti     ueId;    
389 CmLteCellId   cellId; 
390 RlcUlUeCb      *ueCb;
391 #endif
392 {
393
394    ueCb->ueId = ueId;
395    ueCb->cellId = cellId;
396
397    if(ROK != cmHashListInsert(&(gCb->u.ulCb->ueLstCp), 
398                               (PTR)ueCb, 
399                               (uint8_t *)&(ueCb->ueId),
400                               (uint16_t) sizeof(CmLteRnti)))
401    {
402       RLOG_ARG1(L_ERROR,DBG_CELLID,cellId,
403             "UeId[%u] HashList Insertion Failed",
404             ueId);
405       return RFAILED;
406    }
407    /* kw005.201 ccpu00117318, updating the statistics */
408    gCb->genSts.numUe++;
409
410
411    return ROK;
412
413
414 \f
415 /**
416  * @brief Handler to add a transaction 
417  *
418  * @details
419  *    This function adds a transaction. 
420  *
421  * @param[in] gCb     RLC Instance Control Block
422  * @param[in] cfg     Configuration information
423  *
424  * @return  S16
425  *    -# ROK 
426  *    -# RFAILED 
427  *
428 */
429 #ifdef ANSI
430 S16 rlcDbmAddUlTransaction 
431 (
432 RlcCb        *gCb,
433 RlcUlCfgTmpData   *cfg
434 )
435 #else
436 S16 rlcDbmAddUlTransaction(gCb, cfg)
437 RlcCb        *gCb;
438 RlcUlCfgTmpData   *cfg;
439 #endif
440 {
441 #ifndef ALIGN_64BIT
442    RLOG1(L_DEBUG, "(transId(%ld)", cfg->transId);
443 #else
444    RLOG1(L_DEBUG, "(transId(%d))", cfg->transId);
445 #endif
446
447    return (cmHashListInsert(&(gCb->u.ulCb->transIdLstCp), 
448                              (PTR)cfg, 
449                              (uint8_t *)&(cfg->transId), 
450                              (uint16_t) sizeof(cfg->transId)));
451
452
453 \f
454 /**
455  * @brief Handler to find a transaction 
456  *       
457  * @details
458  *    This function find transaction using transaction Id 
459  *
460  *
461  * @param[in] gCb       RLC Instance Control Block
462  * @param[in] transId   Transaction Id 
463  * @param[out] cfg      Configuration information attached to this transaction
464  *
465  * @return  S16
466  *    -# ROK 
467  *    -# RFAILED 
468  *
469 */
470 #ifdef ANSI
471 S16 rlcDbmFindUlTransaction
472 (
473 RlcCb             *gCb,
474 uint32_t              transId,
475 RlcUlCfgTmpData   **cfg
476 )
477 #else
478 S16 rlcDbmFindUlTransaction(gCb, cfg)
479 RlcCb             *gCb;
480 uint32_t              transId;
481 RlcUlCfgTmpData   **cfg;
482 #endif
483 {
484
485    if(ROK != cmHashListFind(&(gCb->u.ulCb->transIdLstCp),
486                             (uint8_t *) &transId, 
487                             sizeof (transId), 
488                             RLC_DEF_SEQ_NUM,(PTR *) cfg))
489    {
490       RLOG1(L_ERROR,"TransId [%ld] not found",transId);
491       return RFAILED;
492    }
493    return ROK;
494 }
495
496 \f
497 /**
498  *
499  * @brief Handler to delete a transaction 
500  *
501  * @details
502  *    This function deletes a transaction 
503  *
504  *
505  *  @param[in] gCb     RLC Instance Control Block
506  *  @param[in] cfg     Configuration information
507  *
508  *  @return  S16
509  *      -# ROK 
510  *      -# RFAILED 
511  *
512 */
513 #ifdef ANSI
514 S16 rlcDbmDelUlTransaction
515 (
516 RlcCb             *gCb,
517 RlcUlCfgTmpData   *cfg       
518 )
519 #else
520 S16 rlcDbmDelUlTransaction(gCb, cfg)
521 RlcCb             *gCb;
522 RlcUlCfgTmpData   *cfg;     
523 #endif
524 {
525
526    if(cmHashListDelete(&(gCb->u.ulCb->transIdLstCp),(PTR) (cfg)) != ROK) 
527    {
528       RLOG0(L_ERROR,"HashList Deletion failed");
529       return RFAILED;
530    }
531
532    return ROK;
533 }
534
535 \f
536 /**
537  * @brief Handler to delete all transaction 
538  *
539  * @details
540  *    This function deletes all transaction 
541  *
542  * @param[in] gCb     RLC Instance Control Block
543  *
544  * @return  S16
545  *    -# ROK 
546  *    -# RFAILED 
547  *
548 */
549 #ifdef ANSI
550 S16 rlcDbmDelAllUlTransactions
551 (
552 RlcCb *gCb
553 )
554 #else
555 S16 rlcDbmDelAllUlTransactions(gCb)
556 RlcCb *gCb;
557 #endif
558 {
559    RlcUlCfgTmpData *cfg = NULL;
560
561    /* Until no more ueCb is ueLstCp hash list get and delete ueCb */
562    while (ROK == cmHashListGetNext(&(gCb->u.ulCb->transIdLstCp), 
563                                    (PTR) cfg, 
564                                    (PTR *)&cfg))
565    {
566       if(rlcDbmDelUlTransaction(gCb, cfg) != ROK)
567       {
568          return RFAILED;
569       }
570       
571       cfg = NULLP;
572    }
573
574    return ROK;
575 }
576
577 \f
578 /**
579  * @brief Handler to Fetch an UeCb
580  *
581  * @details
582  *    This function is invoked by CFG to fetch UeCb from the Ue hashlist 
583  *    of RlcCb.
584  *
585  * @param[in]    gCb       RLC Instance Control Block 
586  * @param[in]    ueId      UE Identifier 
587  * @param[in]    cellId    Cell Identifier 
588  * @param[out]   ueCb      UE Control Block
589  *
590  * @return  S16
591  *    -# ROK 
592  *    -# RFAILED 
593 */
594 uint8_t rlcDbmFetchUlUeCb(RlcCb *gCb, CmLteRnti ueId, CmLteCellId  cellId, RlcUlUeCb **ueCb)
595 {
596    return (cmHashListFind(&(gCb->u.ulCb->ueLstCp), 
597                            (uint8_t *)&(ueId), sizeof(CmLteRnti),
598                            RLC_DEF_SEQ_NUM, 
599                            (PTR *) ueCb));
600 }
601
602 \f
603 /**
604  * @brief Handler to delete an UeCb
605  *
606  * @details
607  *    This function is invoked by CFG to delete UeCb from the Ue hashlist 
608  *    of RlcCb.
609  *
610  *
611  * @param[in] gCb      RLC Instance Control Block
612  * @param[in] ueCb     UE Control Block
613  * @param[in] abrtFlag Abort Flag
614  *
615  * @return Void
616  *
617 */
618 #ifdef ANSI
619 Void rlcDbmDelUlUeCb
620 (
621 RlcCb       *gCb,
622 RlcUlUeCb   *ueCb,       
623 Bool       abortFlag   
624 )
625 #else
626 Void rlcDbmDelUlUeCb(gCb,eCb, abortFlag)
627 RlcCb       *gCb;
628 RlcUlUeCb   *ueCb;      
629 Bool       abortFlag; 
630 #endif
631 {
632
633 #if  (!defined(KW_PDCP) || !(defined(PJ_SEC_ASYNC) || defined(PJ_CMP_ASYNC)))
634    UNUSED(abortFlag);
635 #endif /* (!defined(KW_PDCP) || ! (defined(PJ_SEC_ASYNC) || defined(PJ_CMP_ASYNC)))*/
636
637    /* Delete all logical channels */
638    RLC_MEM_ZERO(ueCb->lCh,sizeof(RlcUlLch) * RLC_MAX_LCH_PER_UE);
639
640    /* Delete all SRB RbCbs in UeCb */
641    rlcDbmDelAllUlRb(gCb,ueCb->srbCb, RLC_MAX_SRB_PER_UE);
642
643    /* Delete all DRB RbCbs in UeCb */
644    rlcDbmDelAllUlRb(gCb,ueCb->drbCb, RLC_MAX_DRB_PER_UE);
645
646    /* Delete ueCb entry from ueLstCp */
647    if(ROK != cmHashListDelete(&(gCb->u.ulCb->ueLstCp), (PTR) ueCb))
648    {
649       RLOG_ARG1(L_ERROR,DBG_UEID,ueCb->ueId,
650             "HashList Deletion Failed cellId(%d)",
651             ueCb->cellId);
652    }
653    /* kw005.201 ccpu00117318, updating the statistics */
654    gCb->genSts.numUe--;
655    /* Deallocate ueCb */
656    RLC_FREE(gCb,ueCb, sizeof(RlcUlUeCb));
657
658    return;
659 }
660 \f
661 /**
662  * @brief Handler to delete all UeCbs
663  *
664  * @details
665  *    This function is invoked by CFG to delete all UeCbs from the Ue 
666  *    hashlist of RlcCb.
667  *
668  * @param[in] gCb      RLC Instance Control Block
669  *
670  * @return  Void
671 */
672 #ifdef ANSI
673 Void rlcDbmDelAllUlUe
674 (
675 RlcCb *gCb
676 )
677 #else
678 Void rlcDbmDelAllUlUe(gCb)
679 RlcCb *gCb;
680 #endif
681 {
682    RlcUlUeCb *ueCb = NULLP;  /* UE Control Block */
683
684    /* Until no more ueCb is ueLstCp hash list get and delete ueCb */
685    while (ROK == cmHashListGetNext(&(gCb->u.ulCb->ueLstCp), 
686                                    (PTR) ueCb, 
687                                    (PTR *)&ueCb))
688    {
689       rlcDbmDelUlUeCb(gCb,ueCb, TRUE);
690
691       ueCb = NULLP;
692    }
693
694    return;
695 }
696
697
698 /**
699  * @brief Handler to create CellCb
700  *
701  * @details
702  *    This function is invoked by CFG to create CellCb and insert into
703  *    the Cell hashlist of RlcCb.
704  *
705  *  @param[in] gCb      RLC Instance Control Block
706  *  @param[in] cellId   Cell Identifier 
707  *  @param[in] cellCb   Cell Control Block 
708  *
709  *  @return  S16
710  *     -# ROK 
711  *     -# RFAILED 
712 */
713 #ifdef ANSI
714 S16 rlcDbmAddUlCellCb
715 (
716 RlcCb          *gCb,
717 CmLteCellId   cellId,    
718 RlcUlCellCb    *cellCb  
719 )
720 #else
721 S16 rlcDbmAddUlCellCb(gCb, cellId, cellCb)
722 RlcCb          *gCb;
723 CmLteCellId   cellId;    
724 RlcUlCellCb    *cellCb;  
725 #endif
726 {
727    RlcUlCellCb *tCellCb; 
728
729    tCellCb = cellCb;
730    tCellCb->cellId = cellId;
731
732    if(ROK != cmHashListInsert(&(gCb->u.ulCb->cellLstCp), 
733                               (PTR) tCellCb,
734                               (uint8_t *)&(tCellCb->cellId), 
735                               (uint16_t) sizeof(CmLteCellId)))
736    {
737       RLOG_ARG0(L_ERROR,DBG_CELLID,tCellCb->cellId,
738             "HashList Insertion Failed");
739       return RFAILED;
740    }
741
742    return ROK;
743
744
745 \f
746 /**
747  * @brief Handler to Fetch an CellCb
748  *       
749  * @details
750  *    This function is invoked by CFG to fetch UeCb from the Ue hashlist 
751  *    of RlcCb.
752  *
753  * @param[in]    gCb      RLC Instance Control Block
754  * @param[in]    cellId   Cell Identifier 
755  * @param[out]   cellCb   UE Control Block
756  *
757  * @return  S16
758  *    -# ROK 
759  *    -# RFAILED 
760  *
761 */
762 void rlcDbmFetchUlCellCb(RlcCb *gCb, CmLteCellId cellId, RlcUlCellCb **cellCb)
763 {
764    *cellCb = NULLP;
765    if(ROK != cmHashListFind(&(gCb->u.ulCb->cellLstCp), 
766                             (uint8_t *)&(cellId),sizeof(CmLteCellId), 
767                             RLC_DEF_SEQ_NUM, (PTR*) cellCb))
768    {
769       DU_LOG("\nRLC : rlcDbmFetchUlCellCb : CellCb[%d] not found", cellId);
770    }
771
772    return;
773 }
774
775 \f
776 /**
777  * @brief Handler to delete CellCb
778  *
779  * @details
780  *    This function is invoked by CFG to delete CellCb from the Cell hashlist 
781  *    of RlcCb.
782  *
783  *  @param[in] gCb      RLC Instance Control Block
784  *  @param[in] cellCb   Cell Control Block
785  *
786  *  @return  Void
787 */
788 #ifdef ANSI
789 Void rlcDbmDelUlCellCb
790 (
791 RlcCb         *gCb,
792 RlcUlCellCb   *cellCb     
793 )
794 #else
795 Void rlcDbmDelUlCellCb(gCb, cellCb)
796 RlcCb         *gCb;
797 RlcUlCellCb   *cellCb;     
798 #endif
799 {
800
801    /* Delete all rbCbs in cellCb */
802    rlcDbmDelAllUlRb(gCb,cellCb->rbCb, RLC_MAX_RB_PER_CELL);
803
804    /* Delete cellCb entry in hash list cellLstCp */
805    if(ROK != cmHashListDelete(&(gCb->u.ulCb->cellLstCp), (PTR) cellCb))
806    {
807       RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,
808             "HashList Deletion Failed");
809    }
810    /* Deallocate cellCb */
811    RLC_FREE(gCb, cellCb, sizeof(RlcUlCellCb));
812
813    return;
814 } /* kwDbmDelCellCb */
815
816 \f
817 /**
818  * @brief Handler to delete all UeCbs
819  *       
820  * @details
821  *    This function is invoked by CFG to delete all UeCbs from the Ue
822  *    hashlist of RlcCb.
823  * @param[in] gCb      RLC Instance Control Block
824  *
825  * @return  Void
826 */
827 #ifdef ANSI
828 Void rlcDbmDelAllUlCell
829 (
830 RlcCb *gCb
831 )
832 #else
833 Void rlcDbmDelAllUlCell(gCb)
834 RlcCb *gCb;
835 #endif
836 {
837    RlcUlCellCb *cellCb = NULLP; /* Cell Control Block */
838
839    /* Until no more cellCb is ueLstCp hash list get and delete cellCb */
840    while (ROK == cmHashListGetNext(&(gCb->u.ulCb->cellLstCp), 
841                                    (PTR) cellCb, 
842                                    (PTR *)&cellCb))
843    {
844       rlcDbmDelUlCellCb(gCb,cellCb);
845
846       cellCb = NULLP;
847    }
848
849    return;
850
851
852 \f
853 /**
854  * @brief Handler to delete all UeCbs and CellCbs
855  *       
856  * @details
857  *    This function is invoked by LMM to delete all UeCbs from the Ue
858  *    hashlist of RlcCb and cellCbs from the Cell hashlist of rlcCb.
859  * 
860  * @param[in] gCb      RLC Instance Control Block
861  *
862 */
863 #ifdef ANSI
864 Void rlcDbmUlShutdown
865 (
866 RlcCb *gCb
867 )
868 #else
869 Void rlcDbmUlShutdown(gCb)
870 RlcCb *gCb;
871 #endif
872 {
873
874    rlcDbmDelAllUlCell(gCb);
875
876    rlcDbmDelAllUlUe(gCb);
877
878    rlcDbmUlDeInit(gCb);
879
880    return;
881 }
882
883
884 /********************************************************************30**
885   
886          End of file
887 **********************************************************************/