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