1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /********************************************************************20**
21 Name: PDCP - Database module file
25 Desc: Source code for Database Module functions such as,
40 *********************************************************************21*/
42 static const char* RLOG_MODULE_NAME="PDCP";
43 static int RLOG_MODULE_ID=1024;
44 static int RLOG_FILE_ID=215;
46 /* header (.h) include files */
47 #include "envopt.h" /* environment options */
48 #include "envdep.h" /* environment dependent */
49 #include "envind.h" /* environment independent */
51 #include "gen.h" /* general */
52 #include "ssi.h" /* system services interface */
53 #include "cm5.h" /* Timer Functions */
54 #include "cm_lte.h" /* common LTE header file */
55 #include "cm_hash.h" /* common hash module file */
56 #include "cm_llist.h" /* common list header file */
57 #include "cpj.h" /* RRC layer */
58 #include "pju.h" /* PDCP service user */
59 #include "lpj.h" /* RRC layer */
60 #include "pj_env.h" /* RLC environment options */
61 #include "pj.h" /* RLC layer */
65 /* extern (.x) include files */
66 #include "gen.x" /* general */
67 #include "ssi.x" /* system services interface */
68 #include "cm_lib.x" /* common library */
69 #include "cm5.x" /* Timer Functions */
70 #include "cm_hash.x" /* common hash module */
71 #include "cm_lte.x" /* common LTE file */
72 #include "cm_llist.x" /* common list header file */
73 #include "cpj.x" /* RRC layer */
74 #include "pju.x" /* PDCP service user */
75 #include "lpj.x" /* LM Interface */
76 #include "pj.x" /* RLC layer */
81 U32 pjTotDlPckCntPerCell;
87 /* forward references */
89 /* public variable declarations */
90 PUBLIC S16 pjCiphStateChek ARGS ((PjCb *gCb, PjTxEnt *txEnt));
91 /* This structure holds all the global structs we need. */
93 /* private variable declarations */
95 /* private function declarations */
98 @brief PDCP DBM Module
100 /*****************************************************************************
101 * HANDLER FOR THE TRANSMISSION BUFFER
102 ****************************************************************************/
106 * @brief Handler to initialize Buffer
109 * This function is invoked by config to initialize the Buffer
112 * @param[in] buf Rx/Tx Buffer Control Point
113 * @param[in] numBins number of Bins
121 PUBLIC S16 pjDbmDlBufInit
124 PjBuf *buf, /* !< Rx/Tx Buffer */
125 U8 numBins /* !< number of Bins */
128 PUBLIC S16 pjDbmDlBufInit(gCb, buf, numBins)
130 PjBuf *buf; /* !< Rx/Tx Buffer */
131 U8 numBins; /* !< number of Bins */
134 U8 hashIndex; /* HashIndex of array */
138 RLOG1(L_DEBUG, "pjDbmBufInit(buf, numBins(%d)", numBins);
140 /* Initialize CmLListCps*/
141 PJ_ALLOC(gCb, buf->datQ, (sizeof(CmLListCp) * numBins));
142 #if (ERRCLASS & ERRCLS_DEBUG)
143 if (buf->datQ == NULLP)
145 RLOG0(L_FATAL, "Memory Allocation failed.");
148 #endif /* (ERRCLASS & ERRCLS_DEBUG) */
150 for(hashIndex = 0; hashIndex < numBins; hashIndex++)
152 cmLListInit(&buf->datQ[hashIndex]);
155 /* Initialistations of buf */
157 buf->numBins = numBins;
159 cmLListInit(&buf->datCfmQ);
160 cmLListInit(&buf->sduSubmitQ);
161 cmLListInit(&buf->reEstPktQ);
169 * @brief Handler to insert into a TX Buffer
172 * This function is invoked to insert into
173 * the transmission buffer hash List
175 * @param[in] buf Tx Buffer
176 * @param[in] txEnt Transmission Entry
184 PUBLIC S16 pjDbmInsTxEnt
187 PjBuf *buf, /* !< Tx Buffer */
188 PjTxEnt *txEnt /* !< Tx Entry */
191 PUBLIC S16 pjDbmInsTxEnt(gCb, buf, txEnt)
193 PjBuf *buf; /* !< Tx Buffer */
194 PjTxEnt *txEnt; /* !< Tx Entry */
197 U8 hashKey; /* Computed HashKey */
201 // pjTotDlPckCntPerCell++;
203 PJDBGP(gCb,(PJ_DBGMASK_UTL | PJ_DBGMASK_DETAIL), (gCb->init.prntBuf,\
204 "pjDbmInsTxEnt(buf, txEnt(%ld)\n", txEnt->count));
206 PJDBGP(gCb,(PJ_DBGMASK_UTL | PJ_DBGMASK_DETAIL), (gCb->init.prntBuf,\
207 "pjDbmInsTxEnt(buf, txEnt(%d)\n", txEnt->count));
209 /* Get the hash index */
210 hashKey = (U8)PJ_HASH_FN(buf, txEnt->count); /*KW_FIX*/
212 txEnt->lstEnt.node = (PTR)txEnt;
213 cmLListAdd2Tail(&buf->datQ[hashKey], &txEnt->lstEnt);
216 txEnt->sduSubmitEnt.node = (PTR)txEnt;
217 cmLListAdd2Tail(&buf->sduSubmitQ, &txEnt->sduSubmitEnt);
220 } /* pjDbmTxBufIns */
225 * @brief Handler to fetch from a TX Buffer
228 * This function is invoked to fetch from
229 * the transmission buffer hash List
231 * @param[in] buf Tx Buffer
232 * @param[in] count Count of the PjTxEnt to retrieve
240 PUBLIC PjTxEnt* pjDbmGetTxEnt
243 PjBuf *buf, /* !< Tx Buffer */
244 U32 count /* !< Count of the PjTxEnt to retrieve */
247 PUBLIC PjTxEnt* pjDbmGetTxEnt(gCb, buf, count)
249 PjBuf *buf; /* !<Tx Buffer */
250 U32 count; /* !<Count of the PjTxEnt to retrieve */
253 U8 hashKey; /* Computed Hash Key */
254 CmLListCp *datQ; /* Pointer to the ListCp */
255 PjTxEnt *tmpEnt; /* Loop Var - Pointer to PjTxEnt */
259 PJDBGP(gCb,(PJ_DBGMASK_UTL | PJ_DBGMASK_DETAIL), (gCb->init.prntBuf,\
260 "pjDbmGetTxEnt(buf, txEnt(%ld)\n", count));
262 PJDBGP(gCb,(PJ_DBGMASK_UTL | PJ_DBGMASK_DETAIL), (gCb->init.prntBuf,\
263 "pjDbmGetTxEnt(buf, txEnt(%d)\n", count));
265 /* Call the hash function */
266 hashKey = (U8)PJ_HASH_FN(buf, count); /*KW_FIX*/
268 datQ = &buf->datQ[hashKey];
271 while(cmLListCrnt(datQ))
273 tmpEnt = (PjTxEnt *) cmLListNode(cmLListCrnt(datQ));
274 if(tmpEnt->count == count)
281 } /* pjDbmGetTxEnt */
286 * @brief Handler to fetch from a TX Buffer
289 * This function is fetch the node based on the SN.
290 * This function will be called only for the case of a
291 * PDCP STATUS REPORT being received by the DRB AM.
293 * @param[in] buf Tx Buffer
294 * @param[in] sn SN to get the Ent
302 PUBLIC PjTxEnt* pjDbmGetTxEntSn
305 PjBuf *buf, /* !< Tx Buffer */
306 U16 sn /* !< SN of the PjTxEnt to retrieve */
309 PUBLIC PjTxEnt* pjDbmGetTxEntSn(gCb, buf, sn)
311 PjBuf *buf; /* !< Tx Buffer */
312 U16 sn; /* !< SN of the PjTxEnt to retrieve */
315 U8 hashKey; /* Computed hash index */
316 CmLListCp *datQ; /* Pointer to the ListCP */
317 PjTxEnt *tmpEnt; /* Loop Var - pointer to PjTxEnt */
319 TRC3(pjDbmGetTxEntSn)
321 RLOG1(L_DEBUG, "pjDbmGetTxEnt(buf, sn(%d)", sn);
323 /* Call the hash function */
324 hashKey = (U8)PJ_HASH_FN(buf, sn); /*KW_FIX*/
326 datQ = &buf->datQ[hashKey];
328 /* Loop through to find the entry that matches */
330 while(cmLListCrnt(datQ))
332 tmpEnt = (PjTxEnt *) cmLListNode(cmLListCrnt(datQ));
341 } /* pjDbmGetTxEntSn */
344 #if (defined (LTE_PAL_ENB) || defined (TENB_ACC))
346 * @brief This fn is called to chek the state of the PDCP pkts in DL before Ciphering operation
347 * and appropriate action is taken accordingly
350 * Function : pjCiphStateChek
357 * -# Failure : RFAILED
360 PUBLIC S16 pjCiphStateChek
366 PUBLIC S16 pjCiphStateChek(gCb, txEnt)
371 TRC3(pjCiphStateChek);
372 PJ_FREE_BUF(txEnt->sdu);
373 PJ_FREE_BUF(txEnt->pdu);
374 #ifdef FLAT_BUFFER_OPT
375 if(txEnt->fb.startAddr)
377 PJ_FREE_FLAT_BUF(gCb, (&(txEnt->fb)));
381 PJ_FREE(gCb, txEnt, sizeof(PjTxEnt));
389 * @brief Handler to delete from a TX Buffer
392 * This function is invoked by to insert into
393 * the transaction buffer hash List
395 * @param[in] buf Tx Buffer
396 * @param[in] count count to get the Ent
404 PUBLIC S16 pjDbmDelTxEnt
407 PjBuf *buf, /* !< Tx Buffer */
408 U32 count /* !< Count of the PjTxEnt to delete */
411 PUBLIC S16 pjDbmDelTxEnt(gCb, buf, count)
413 PjBuf *buf; /* !< Tx Buffer */
414 U32 count; /* !< Count of the PjTxEnt to delete */
417 U8 hashKey; /* Computed Hash Key */
418 CmLListCp *datQ; /* Pointer to the ListCP */
419 PjTxEnt *delEnt; /* Loop Var - pointer to PjTxEnt */
423 PJDBGP(gCb,(PJ_DBGMASK_UTL | PJ_DBGMASK_DETAIL), (gCb->init.prntBuf,\
424 "pjDbmDelTxEnt(buf, count(%ld)\n", count));
426 PJDBGP(gCb,(PJ_DBGMASK_UTL | PJ_DBGMASK_DETAIL), (gCb->init.prntBuf,\
427 "pjDbmDelTxEnt(buf, count(%d)\n", count));
430 /* search for the entry */
431 delEnt = pjDbmGetTxEnt(gCb, buf, count);
437 /* Compute the hash index */
438 hashKey = (U8)PJ_HASH_FN(buf, delEnt->count); /*KW_FIX*/
439 datQ = &buf->datQ[hashKey];
441 /* delete the entry */
442 cmLListDelFrm(datQ, &delEnt->lstEnt);
444 if (delEnt->sduSubmitEnt.node != NULLP)
446 delEnt->sduSubmitEnt.node = NULLP;
447 cmLListDelFrm(&buf->sduSubmitQ,&delEnt->sduSubmitEnt);
449 if(delEnt->datCfmEnt.node != NULLP)
451 delEnt->datCfmEnt.node = NULLP;
452 cmLListDelFrm(&buf->datCfmQ, &delEnt->datCfmEnt);
453 pjTotDlPckCntPerCell--;
456 if(delEnt->reEstPktEnt.node != NULLP)
458 delEnt->reEstPktEnt.node = NULLP;
459 cmLListDelFrm(&buf->reEstPktQ, &delEnt->reEstPktEnt);
461 /* NULLing off to prevent double dealloc */
462 if(delEnt->pdu == delEnt->sdu)
467 pjCiphStateChek(gCb, delEnt);
471 } /* pjDbmDelTxEnt */
476 * @brief Handler to Delete all the elements in the hashlist
480 * This function is invoked to Delete all the elements in the
489 PUBLIC S16 pjDbmTxDelAll
492 PjBuf *buf /* !< Tx Buffer */
495 PUBLIC S16 pjDbmTxDelAll(gCb,buf)
497 PjBuf *buf; /* !< Tx Buffer */
500 U8 i; /* index counter */
501 CmLListCp *datQ; /* CmLListcp Ptr */
502 CmLList *lstEnt; /* CmLList Ptr - Loop var */
503 PjTxEnt *txEnt; /* Tx Entry Ptr - Loop var */
507 RLOG0(L_DEBUG, "pjDbmTxDelAll(buf)");
509 /* cleanup the entries */
510 for(i = 0; i< buf->numBins; i++)
512 datQ = &buf->datQ[i];
513 while(cmLListFirst(datQ))
515 lstEnt = cmLListDelFrm(datQ, cmLListCrnt(datQ));
518 txEnt = (PjTxEnt *)cmLListNode(lstEnt);
519 if(txEnt->datCfmEnt.node != NULLP)
521 txEnt->datCfmEnt.node = NULLP;
522 cmLListDelFrm(&buf->datCfmQ, &txEnt->datCfmEnt);
523 pjTotDlPckCntPerCell--;
526 if (txEnt->sduSubmitEnt.node != NULLP)
528 txEnt->sduSubmitEnt.node = NULLP;
529 cmLListDelFrm(&buf->sduSubmitQ,&txEnt->sduSubmitEnt);
532 if(txEnt->reEstPktEnt.node != NULLP)
534 txEnt->reEstPktEnt.node = NULLP;
535 cmLListDelFrm(&buf->reEstPktQ, &txEnt->reEstPktEnt);
538 if ( txEnt->sdu == txEnt->pdu )
543 pjCiphStateChek(gCb, txEnt);
550 } /* pjDbmTxDelAll */
554 * @brief Handler to De initialize hash list
558 * This function is invoked by LMM to De initialize the
567 PUBLIC S16 pjDbmTxDeInit
570 PjBuf *buf /* !< Tx Buffer */
573 PUBLIC S16 pjDbmTxDeInit(gCb,buf)
575 PjBuf *buf; /* !< Tx Buffer */
581 RLOG0(L_DEBUG, "pjDbmTxDeInit(buf)");
583 /* cleanup the entries */
584 pjDbmTxDelAll(gCb,buf);
586 /* Cleanup the listCps */
587 PJ_FREE(gCb, buf->datQ, (sizeof(CmLListCp) * buf->numBins));
588 buf->numBins = NULLP;
597 * @brief Handler to initialize hash list
601 * This function is invoked by LMM to initialize the UeCb and CellCb
610 PUBLIC S16 pjDbmDlInit
615 PUBLIC S16 pjDbmDlInit(gCb)
619 S16 ret; /* Return Value */
624 RLOG0(L_DEBUG, "pjDbmInit()");
627 /* Initialize ueCb Hash List */
628 ret = cmHashListInit(&(gCb->u.dlCb->ueLstCp), (U16) PJ_UE_LIST_BUCKET_SIZE,
629 (U16) 0, (Bool) FALSE, (U16) CM_HASH_KEYTYPE_DEF,
630 gCb->init.region, gCb->init.pool);
634 RLOG0(L_DEBUG, "pjDbmInit: cmHashListInit Failed for gCb.ueLstCp.");
645 * @brief Handler to De initialize hash list
649 * This function is invoked by LMM to De initialize the UeCb and CellCb
658 PUBLIC S16 pjDbmDlDeInit
663 PUBLIC S16 pjDbmDlDeInit(gCb)
667 S16 ret; /* Return Value */
672 RLOG0(L_DEBUG, "pjDbmDeInit()");
675 /* Initialize ueCb Hash List */
676 ret = cmHashListDeinit(&(gCb->u.dlCb->ueLstCp));
680 RLOG0(L_ERROR, "pjDbmDeInit: cmHashListDeinit Failed for gCb.ueLstCp.");
690 * @brief Handler to fetch rbCb in the Upper Interface
694 * This function is invoked by CFG to fetch rbCb from the cellCb/ueCb in
695 * the upper interface (CPJ/PJU).
697 * @param[in] rlcId RLC Identifier
698 * @param[out] rbCb RB Control Block
706 PUBLIC S16 pjDbmFetchDlRbCb
709 CmLteRlcId rlcId, /* RLC Identifier */
710 PjDlRbCb **rbCb /* RB Cb */
713 PUBLIC S16 pjDbmFetchDlRbCb(gCb, rlcId, rbCb)
715 CmLteRlcId rlcId; /* RLC Identifier */
716 PjDlRbCb **rbCb; /* RB Cb */
719 PjDlUeCb *ueCb; /* UE Control Block */
720 PjDlRbCb *tRbCb; /* Local RB CB */
721 S16 ret; /* Return Value */
723 TRC3(pjDbmFetchDlRbCb)
726 RLOG3(L_DEBUG, "pjDbmFetchRbCbForLi(rlcId(ueId(%d), cellId(%d), rbId(%d)), rbCb)",
727 rlcId.ueId, rlcId.cellId, rlcId.rbId);
733 /* Validate the RBID in case of TM/UM/AM */
734 PJ_VALIDATE_RBID(rlcId.ueId, rlcId.rbId, rlcId.rbType, ret);
738 /* DEBUG_PRINT EROR */
739 RLOG_ARG2(L_ERROR,DBG_UEID,rlcId.ueId,
740 "PJ_VALIDATE_RBID Failed -- rbId(%d), cellId(%d)",
741 rlcId.rbId, rlcId.cellId);
746 if (pjDbmFetchDlUeCb(gCb, rlcId.ueId, rlcId.cellId, &ueCb) != ROK)
748 RLOG_ARG1(L_ERROR, DBG_CELLID, rlcId.cellId,"UeId[%u] not found",
754 PJ_DBM_FETCH_DL_RBCB(rlcId.rbId, rlcId.rbType, ueCb, tRbCb);
758 RLOG_ARG2(L_ERROR, DBG_UEID,rlcId.ueId, "CellId[%u]:RbId[%d] not found",
759 rlcId.cellId, rlcId.rbId);
766 } /* pjDbmFetchRbCb */
771 * @brief Handler to delete RbCb
775 * This function is invoked by CFG to remove RbCb from Ue/Cell hashlist
778 * @param[in] rbCbLst - Rb Cb List
779 * @param[in] numRbCb - Number of rbCbs
787 PUBLIC S16 pjDbmDelAllDlRb
790 PjDlRbCb **rbCbLst, /* RB Cb list */
791 U8 numRbCb /* Number of rbCbs */
794 PUBLIC S16 pjDbmDelAllDlRb(gCb,rbCbLst, numRbCb)
796 PjDlRbCb **rbCbLst; /* RB Cb list */
797 U8 numRbCb; /* Number of rbCbs */
801 PjDlRbCb *rbCb; /* RB Control Block */
803 TRC3(pjDbmDelAllDlRb)
806 RLOG1(L_DEBUG, "pjDbmDelAllRb(rbCbLst, numRbCb(%d))", numRbCb);
809 for (idx = 0; idx < numRbCb; idx++)
814 PJ_DBM_DELETE_DL_RBCB(gCb, rbCb);
815 rbCbLst[idx] = NULLP;
820 } /* pjDbmDelAllRb */
825 * @brief Handler to create an UeCb
829 * This function is invoked by CFG to create UeCb and insert into the Ue hashlist
833 * @param[in] ueId UE Identifier
834 * @param[in] cellId Cell Identifier
842 PUBLIC S16 pjDbmCreateDlUeCb
845 CmLteRnti ueId, /* UE Identifier */
846 CmLteCellId cellId, /* Cell Identifier */
847 PjDlUeCb **ueCb /* UE Control Block */
850 PUBLIC S16 pjDbmCreateDlUeCb(gCb, ueId, cellId, ueCb)
852 CmLteRnti ueId; /* UE Identifier */
853 CmLteCellId cellId; /* Cell Identifier */
854 PjDlUeCb **ueCb; /* UE Control Block */
857 S16 ret; /* Return Value */
858 PjDlUeCb *tUeCb; /* UE Control Block */
860 TRC3(PjDbmCreateDlUeCb)
863 RLOG2(L_DEBUG, "pjDbmCreateUeCb(ueId(%d), cellId(%d))", ueId, cellId);
866 PJ_ALLOC(gCb, *ueCb, sizeof(PjDlUeCb));
868 #if (ERRCLASS & ERRCLS_ADD_RES)
872 RLOG0(L_FATAL, "Memory Allocation failed.");
875 #endif /* ERRCLASS & ERRCLS_ADD_RES */
878 tUeCb->key.ueId = ueId;
879 tUeCb->key.cellId = cellId;
881 ret = cmHashListInsert(&(gCb->u.dlCb->ueLstCp), (PTR)tUeCb, (U8 *)&(tUeCb->key),
882 (U16) sizeof(PjUeKey));
886 RLOG_ARG1(L_ERROR,DBG_UEID,ueId,
887 "DL UE CB Hash Insert Failed for cellId (%d)", cellId);
892 /* kw005.201 ccpu00117318, updating the statistics */
893 gCb->u.dlCb->pjGenSts.numUe++;
894 (*ueCb)->libInfo.state = PJ_STATE_NORMAL;
895 cmInitTimers(&((*ueCb)->libInfo.obdTmr), 1);
897 } /* kwDbmCreateUeCb */
902 * @brief Handler to Fetch an UeCb
906 * This function is invoked by CFG to fetch UeCb from the Ue hashlist
910 * @param[in] ueId UE Identifier
911 * @param[in] cellId Cell Identifier
912 * @param[out] ueCb UE Control Block
920 PUBLIC S16 pjDbmFetchDlUeCb
923 CmLteRnti ueId, /* UE Identifier */
924 CmLteCellId cellId, /* Cell Identifier */
925 PjDlUeCb **ueCb /* UE Control Block */
928 PUBLIC S16 pjDbmFetchDlUeCb(gCb, ueId, cellId, ueCb)
930 CmLteRnti ueId; /* UE Identifier */
931 CmLteCellId cellId; /* Cell Identifier */
932 PjDlUeCb **ueCb; /* UE Control Block */
935 S16 ret; /* Return Value */
936 PjUeKey key; /* Key for UE Hash List */
938 TRC3(pjDbmFetchDlUeCb)
944 ret = cmHashListFind(&(gCb->u.dlCb->ueLstCp), (U8 *)&(key), sizeof(PjUeKey),
945 PJ_DEF_SEQ_NUM, (PTR *) ueCb);
949 RLOG_ARG0(L_WARNING,DBG_UEID,ueId,
950 "pjDbmFetchUeCb: cmHashListFind Failed for ueCb.");
956 } /* pjDbmFetchUeCb */
961 * @brief Handler to delete an UeCb
965 * This function is invoked by CFG to delete UeCb from the Ue hashlist
969 * @param[in] ueCb UE Control Block
970 * @param[in] abrtFlag Abort Flag
978 PUBLIC S16 pjDbmDelDlUeCb
981 PjDlUeCb *ueCb, /* UE Identifier */
982 Bool abortFlag /* Abort Flag */
985 PUBLIC S16 pjDbmDelDlUeCb(gCb, ueCb, abortFlag)
987 PjDlUeCb *ueCb; /* UE Identifier */
988 Bool abortFlag; /* Abort Flag */
991 S16 ret; /* Return Value */
997 RLOG2(L_DEBUG, "pjDbmDelUeCb(ueId(%d), cellId(%d))",
998 ueCb->key.ueId, ueCb->key.cellId);
1001 /* kw005.201 Check to see if there is atleast one logical channel */
1003 for ( idx = 0; idx< PJ_MAX_SRB_PER_UE; idx++)
1004 pjCfgDelPjDlRbCb(gCb, ueCb, ueCb->srbCb[idx]);
1006 for ( idx = 0; idx< PJ_MAX_DRB_PER_UE; idx++)
1007 pjCfgDelPjDlRbCb(gCb, ueCb, ueCb->drbCb[idx]);
1009 /* Close the Integrity/Ciphering channels */
1010 if(ueCb->secInfo.secAct)
1013 pjUtlDlIntClose(gCb,ueCb->secInfo.cpIntSessCxtId);
1014 pjUtlDlCipherClose(gCb,ueCb->secInfo.cpCiphSessCxtId);
1015 pjUtlDlCipherClose(gCb,ueCb->secInfo.upCiphSessCxtId);
1017 pjUtlDlIntClose(gCb,ueCb->secInfo.intCxtId);
1018 pjUtlDlCipherClose(gCb,ueCb->secInfo.cpCxtId);
1019 pjUtlDlCipherClose(gCb,ueCb->secInfo.upCxtId);
1023 /* Delete hoInfo if present */
1024 if (ueCb->hoInfo != NULLP)
1026 for (idx = 0; idx < PJ_MAX_DRB_PER_UE; idx++)
1028 if (ueCb->hoInfo->hoCfmInfo[idx].pres == TRUE)
1029 { /* should these be dl? */
1034 PJ_FREE(gCb, ueCb->hoInfo->hoCfmInfo, (PJ_MAX_DRB_PER_UE * sizeof(PjDlHoCfmInfo)));
1035 PJ_FREE(gCb, ueCb->hoInfo, sizeof(PjDlHoInfo));
1038 /* Delete ueCb entry from ueLstCp */
1039 ret = cmHashListDelete(&(gCb->u.dlCb->ueLstCp), (PTR) ueCb);
1044 RLOG_ARG0(L_ERROR,DBG_UEID,ueCb->key.ueId,"Hash Delete Failed for ueCb");
1047 /* kw005.201 ccpu00117318, updating the statistics */
1048 gCb->pjGenSts.numUe--;
1049 /* Deallocate ueCb */
1050 PJ_FREE(gCb, ueCb, sizeof(PjDlUeCb));
1053 } /* pjDbmDelUeCb */
1058 * @brief Handler to delete all UeCbs
1062 * This function is invoked by CFG to delete all UeCbs from the Ue
1071 PUBLIC S16 PjDbmDelAllDlUe
1076 PUBLIC S16 PjDbmDelAllDlUe(gCb)
1081 PjDlUeCb *ueCb; /* UE Control Block */
1083 TRC3(pjDbmDelAllDlUe)
1086 RLOG0(L_DEBUG, "pjDbmDelAllUe()");
1092 /* Until no more ueCb is ueLstCp hash list get and delete ueCb */
1093 while (cmHashListGetNext(&(gCb->u.dlCb->ueLstCp), (PTR) ueCb, (PTR *)&ueCb) == ROK)
1096 ret = pjDbmDelDlUeCb(gCb,ueCb, TRUE);
1100 RLOG_ARG0(L_ERROR,DBG_UEID,ueCb->key.ueId,"DL Ue Cb Deletion Failed");
1108 } /* pjDbmDelAllUe */
1111 PUBLIC S16 pjDbmDlShutdown
1116 PUBLIC S16 pjDbmDlShutdown(gCb)
1120 #if (ERRCLASS & ERRCLS_DEBUG)
1123 TRC3(pjDbmDlShutdown)
1125 #if (ERRCLASS & ERRCLS_DEBUG)
1126 ret = pjDbmDlDeInit(gCb);
1129 RLOG0(L_FATAL, "DL DeInitialization Failed");
1133 #endif /* ERRCLASS & ERRCLS_DEBUG */
1136 } /* pjDbmShutdown */
1140 * @brief Handler to create a RB control block.
1144 * This function is called to create a RLC control block or PDCP
1145 * control block based on rb flag and update the pointers in RbCb.
1146 * If the RbCb is already allocated, the rbId is updated in KwRbCb
1147 * or PjDlRbCb based on rb. If the RbCb has not been allocated earlier,
1148 * a new RbCb is created and the pointers are updated along with the
1151 * @param[in] rbId RB ID of the entity
1152 * @param[in] rbCbLst List of the RBs in the UeCb
1153 * @param[in] rb The RB to be created. This can be
1154 * PJ_CFG_PDCP when PDCP is created
1155 * or PJ_CFG_RLC when RLC is being
1164 PUBLIC PjDlRbCb* pjDbmCreateDlRbCb
1173 PUBLIC PjDlRbCb* pjDbmCreateDlRbCb(gCb,rbId,rbType,ueCb,rb)
1184 TRC2(pjDbmCreateDlRbCb)
1189 PJ_DBM_FETCH_DL_RBCB(rbId, rbType, ueCb, rbCb);
1193 PJ_ALLOC(gCb, rbCb, sizeof(PjDlRbCb));
1194 if ( rbCb == NULLP )
1196 RLOG0(L_FATAL, "Memory Allocation failed.");
1202 rbCb->rbType = rbType;
1204 rbCbLst = ((rbType == CM_LTE_SRB)? ueCb->srbCb:ueCb->drbCb);
1205 rbCbLst[rbId] = rbCb;
1206 /* kw005.201 ccpu00117318, updating the statistics */
1207 PJ_LMM_RB_STS_INC(gCb);
1211 } /* pjDbmCreateRbCb */
1215 * @brief Handler to fetch a PDCP RB control block.
1219 * This function is used to fetch the PDCP RB control block based on
1220 * the RB id. The pointer to PjDlRbCb is returned.
1222 * @param[in] ueCb UE control block of the PDCP RB
1223 * @param[in] rbId RB ID of the required PDCP entity.
1224 * @param[out] pjRbCb PDCP RB Control Block.
1232 PUBLIC S16 pjDbmFetchPjDlRbCb
1240 PUBLIC S16 pjDbmFetchPjDlRbCb(ueCb,rbId,rbType,pjRbCb)
1249 TRC2(PjDbmFetchPjDlRbCb)
1253 PJ_DBM_FETCH_DL_RBCB(rbId, rbType, ueCb, rbCb);
1254 if ( rbCb != NULLP )
1261 } /* pjDbmFetchPjDlRbCb */
1265 * @brief Handler to delete a PDCP/RLC RB control block.
1269 * This function is used to delete the PDCP/RLC RB control block based
1270 * on RB id and the RB type (PDCP/RLC). If the corresponding RB is
1271 * present, the cfgStat flag is unset. If the cfgStat flag is zero,
1272 * the RBCB is freed.
1274 * @param[in] rbId RB ID of the to be deleted RB
1275 * @param[in] rbCbLst RbCb list in UE CB
1276 * @param[in] rb The RB to be deleted. This can be
1277 * PJ_CFG_PDCP when PDCP is created
1278 * or PJ_CFG_RLC when RLC is being
1286 PUBLIC S16 pjDbmDelDlRbCb
1296 PUBLIC S16 pjDbmDelDlRbCb(gCb,rbId,rbType,rbCb,rb,ueCb)
1309 TRC2(pjDbmDelDlRbCb)
1312 /*updating rbCbList */
1313 rbCbLst = ((rbType == CM_LTE_SRB)? ueCb->srbCb:ueCb->drbCb);
1315 if ( (*rbCb) != NULLP )
1317 PJ_DBM_DELETE_DL_RBCB(gCb,*rbCb);
1319 /*updating rbCbList */
1320 rbCbLst[rbId] = NULLP;
1324 } /* pjDbmDelRbCb */
1329 /********************************************************************30**
1332 **********************************************************************/