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 /**********************************************************************
25 Desc: Source code for PDCP Utility Module
27 This file contains following functions:
41 **********************************************************************/
42 static const char* RLOG_MODULE_NAME="PDCP";
43 static int RLOG_MODULE_ID=1024;
44 static int RLOG_FILE_ID=218;
47 @brief PDCP Utility Module
50 /* header (.h) include files */
51 #include "envopt.h" /* environment options */
52 #include "envdep.h" /* environment dependent */
53 #include "envind.h" /* environment independent */
55 #include "gen.h" /* general */
56 #include "ssi.h" /* system services */
57 #include "cm5.h" /* common timer defines */
58 #include "cm_tkns.h" /* common tokens defines */
59 #include "cm_mblk.h" /* common memory allocation library defines */
60 #include "cm_llist.h" /* common link list defines */
61 #include "cm_hash.h" /* common hash list defines */
62 #include "cm_lte.h" /* common LTE defines */
63 #include "cpj.h" /* CPJ defines */
64 #include "pju.h" /* PJU defines */
65 #include "lpj.h" /* LPJ defines */
67 #include "pj_env.h" /* RLC environment options */
68 #include "pj.h" /* RLC defines */
70 #include "pj_err.h" /* Error defines */
74 /* extern (.x) include files */
75 #include "gen.x" /* general */
76 #include "ssi.x" /* system services */
78 #include "cm5.x" /* common timer library */
79 #include "cm_tkns.x" /* common tokens */
80 #include "cm_mblk.x" /* common memory allocation */
81 #include "cm_llist.x" /* common link list */
82 #include "cm_hash.x" /* common hash list */
83 #include "cm_lte.x" /* common LTE includes */
84 #include "cm_lib.x" /* common memory allocation library */
85 #include "cpj.x" /* CPJ */
86 #include "pju.x" /* PJU */
87 #include "lpj.x" /* LPJ */
92 #include "pj_lib.x" /* LIB */
95 EXTERN CmLListCp pjMsCiphQ;
96 EXTERN CmLListCp pjMsDeCiphQ;
97 #ifndef XEON_SPECIFIC_CHANGES
98 EXTERN U32 dbgPdcpMemCount,pdcpdrop, dbgSpaccThreshHoldDropCnt;
99 EXTERN U32 dbgPdcpQSizeThreshHoldDropCnt;
100 U32 spaccDropCount = 0;
101 EXTERN U32 pjMsDlSpaccQCnt;
102 EXTERN U32 pjMsUlSpaccQCnt;
106 #endif /* __cplusplus */
109 EXTERN S16 PjLibObdSwCipherReq(PjLibTrans *libTrans, Buffer *mBuf, PjCb *gCb, Buffer **opSdu);
111 EXTERN S16 pjSendToSwCipherFB ARGS((PjLibTrans *libTrans, FlatBuffer *mBuf,
112 PjCb *gCb, Buffer **opSdu));
115 PUBLIC S16 pjUtlReEstDl
118 PjDlUeCb *ueCb /* UE Control Block */
121 PRIVATE S16 pjUtlDlHdlSecInitCfm ARGS((PjCb *gCb,PjDlUeCb *ueCb,
122 U16 txIdx,PjAsyncCfm *asyncCfm, UdxSecCfgCfmInfo *secCfgCfm,UdxReEstCfmInfo *reEstCfm));
123 PRIVATE S16 pjUtlDlHdlCmpInitCfm ARGS((PjCb *gCb,PjDlUeCb *ueCb,
124 U16 txIdx,PjAsyncCfm *asyncCfm, UdxCfgCfmInfo *cfgCfm));
130 * Handler to apply the new security algorithms and
131 * reset the compression unit.
136 * 1. Creates new contexts for Control Plane Ciphering and Integrity.
137 * 2. Closes the old contexts for Control Plane Ciphering and Integrity.
139 * @param[in] ueCb UE Control Block
147 PUBLIC S16 pjUtlDlUpdUpSecKeys
150 PjDlUeCb *ueCb /* UE Control Block */
153 PUBLIC S16 pjUtlDlUpdUpSecKeys(gCb,ueCb)
155 PjDlUeCb *ueCb; /* UE Control Block */
160 TRC2(pjUtlDlUpdUpSecKeys);
162 RLOG2(L_DEBUG, "pjUtlReEstReconfig(ueCb(%d,%d))",
163 ueCb->key.ueId, ueCb->key.cellId);
165 if(ueCb->secInfo.secAct == TRUE)
167 /* Initialisation is done first followed by closure since we
168 * do not want the same ctxId to be returned for the new init.
169 * In ASYNC case, we drop packets if they are returned from a
170 * different ctxId. */
173 tmpUpCxt = ueCb->secInfo.upCiphSessCxtId;
175 tmpUpCxt = ueCb->secInfo.upCxtId;
178 pjUtlDlUpInit(gCb,ueCb);
179 pjUtlDlCipherClose(gCb,tmpUpCxt);
183 } /* pjUtlDlUpdUpSecKeys */
189 * Handler to apply the new security algorithms and
190 * reset the compression unit.
195 * 1. Creates new contexts for Control Plane Ciphering and Integrity.
196 * 2. Closes the old contexts for Control Plane Ciphering and Integrity.
198 * @param[in] ueCb UE Control Block
206 PUBLIC S16 pjUtlDlUpdCpSecKeys
209 PjDlUeCb *ueCb /* UE Control Block */
212 PUBLIC S16 pjUtlDlUpdCpSecKeys(gCb,ueCb)
214 PjDlUeCb *ueCb; /* UE Control Block */
220 TRC2(pjUtlDlUpdCpSecKeys);
222 RLOG2(L_DEBUG, "pjUtlReEstReconfig(ueCb(%d,%d))",
223 ueCb->key.ueId, ueCb->key.cellId);
225 if(ueCb->secInfo.secAct == TRUE)
227 /* Initialisation is done first followed by closure since we
228 * do not want the same ctxId to be returned for the new init.
229 * In ASYNC case, we drop packets if they are returned from a
230 * different ctxId. */
233 tmpIntCxt = ueCb->secInfo.cpIntSessCxtId;
234 tmpCpCxt = ueCb->secInfo.cpCiphSessCxtId;
236 tmpIntCxt = ueCb->secInfo.intCxtId;
237 tmpCpCxt = ueCb->secInfo.cpCxtId;
240 pjUtlDlCpInit(gCb,ueCb);
241 pjUtlDlIntInit(gCb,ueCb);
243 pjUtlDlIntClose(gCb,tmpIntCxt);
244 pjUtlDlCipherClose(gCb,tmpCpCxt);
250 } /* pjUtlDlUpdCpSecKeys */
252 /********************************************************************
253 * Utility Handler for Sending to Offboarding unit *
254 *******************************************************************/
260 * Handler for opening the context with the compression unit (either
261 * synchronous or asynchronous) for RB within an UE.
265 * This function opens the context with the compression unit per RB per
266 * UE, by sending ROHC configuration elements using synchronous / asynchronous
267 * function calls with relevant input parameters.
270 * @param[in] pjRbCb PDCP RbCb
277 PUBLIC S16 pjUtlDlCmpInit
280 PjDlRbCb *pjRbCb /* PDCP RbCb */
283 PUBLIC S16 pjUtlDlCmpInit(pjRbCb)
285 PjDlRbCb *pjRbCb; /* PDCP RbCb */
290 RLOG2(L_DEBUG, "pjUtlDlCmpInit(pjRbCb(%d,%d))",pjRbCb->rbId, pjRbCb->rbType);
293 pjRbCb->ueCb->libInfo.tCmpInitBitMask |= (1 << (pjRbCb->rbId - 1));
294 pjRbCb->ueCb->libInfo.tLibInitBitMask |= PJ_LIB_COMP_BIT_MASK;
295 pjRbCb->cmpCxt.cfgTxId = pjRbCb->ueCb->libInfo.nxtAvlbTxId;
297 PjLibObdCmpInitReq(&gCb->pjGenCfg.obdPst.cmpPst,
298 pjRbCb->cmpCxt, pjRbCb->rohc);
300 pjLibCmpInitReq(pjRbCb->cmpCxt, pjRbCb->rohc, &(pjRbCb->cmpCxtId));
301 #endif /* PJ_CMP_ASYNC */
305 } /* end of pjUtlCmpInit */
313 * Handler for opening the context with the Integration unit (either
314 * synchronous or asynchronous) for all SRBs of an UE.
318 * This function opens the context with the security algo unit per UE
319 * for Integration protection/verification by sending the configured
320 * Integrity Info using synchronous / asynchronous function calls with
321 * relevant input parameters.
323 * @param[in] pjRbCb Pointer to RB control Block
331 PUBLIC S16 pjUtlDlIntInit
334 PjDlUeCb *ueCb /* UE CB Ptr */
337 PUBLIC S16 pjUtlDlIntInit(*gCb, *ueCb)
339 PjDlUeCb *ueCb; /* UE CB Ptr */
347 U32 *libInitBitMask = NULLP;
352 RLOG2(L_DEBUG, "pjUtlDlIntInit(ueCb(%d,%d))",ueCb->key.ueId, ueCb->key.cellId);
356 if(ueCb->libInfo.state == PJ_STATE_REEST)
358 for(txIdx = 0; txIdx < PJ_MAX_ASYNC_CFM; txIdx++)
360 if((ueCb->libInfo.asyncCfm[txIdx] != NULLP) &&
361 (ueCb->libInfo.asyncCfm[txIdx]->cfmType == PJ_REEST_ASYNC_CFM))
363 libInitBitMask = &ueCb->libInfo.asyncCfm[txIdx]->libInitBitMask;
368 else if(ueCb->libInfo.state == PJ_STATE_NORMAL)
370 libInitBitMask = &ueCb->libInfo.tLibInitBitMask;
375 (*libInitBitMask) = (*libInitBitMask) | PJ_LIB_INT_BIT_MASK;
378 ret = PjLibObdIntInitReq(&gCb->pjGenCfg.obdPst.secPst,
379 ueCb->secInfo.secCxt, ueCb->secInfo.intInfo);
382 #ifdef QAT_TWO_INSTANCE
383 pjLibIntInitReq(gCb->u.dlCb->instHndl, ueCb->secInfo.intInfo,&ctxId);
385 pjLibIntInitReq(gCb, ueCb->secInfo.intInfo,&ctxId);
387 ueCb->secInfo.cpIntSessCxtId = ctxId;
389 pjLibIntInitReq(ueCb->secInfo.secCxt, ueCb->secInfo.intInfo,&(ctxId));
390 ueCb->secInfo.intCxtId = ctxId;
391 #endif /* INTEL_QAT_DP */
392 #endif /* PJ_SEC_ASYNC */
396 } /* end of pjUtlIntInit */
402 * Handler for opening the context with the Ciphering unit (either
403 * synchronous or asynchronous) for SRBs of an UE.
407 * This function opens the context with the security algo unit per UE
408 * for ciphering / deciphering by key by sending the configured
409 * Ciphering Info with control plane key using synchronous / asynchronous
410 * function calls with relevant input parameters.
412 * @param[in] pjRbCb Pointer to RB control Block
419 PUBLIC S16 pjUtlDlCpInit
422 PjDlUeCb *ueCb /* UE CB Ptr */
425 PUBLIC S16 pjUtlDlCpInit(*gCb, *ueCb)
427 PjDlUeCb *ueCb; /* UE CB Ptr */
433 U32 *libInitBitMask = NULLP;
439 RLOG2(L_DEBUG, "pjUtlCpInit(ueCb(%d,%d))",ueCb->key.ueId, ueCb->key.cellId);
443 if(ueCb->libInfo.state == PJ_STATE_REEST)
445 for(txIdx = 0; txIdx < PJ_MAX_ASYNC_CFM; txIdx++)
447 if((ueCb->libInfo.asyncCfm[txIdx] != NULLP) &&
448 (ueCb->libInfo.asyncCfm[txIdx]->cfmType == PJ_REEST_ASYNC_CFM))
450 libInitBitMask = &ueCb->libInfo.asyncCfm[txIdx]->libInitBitMask;
455 else if(ueCb->libInfo.state == PJ_STATE_NORMAL)
457 libInitBitMask = &ueCb->libInfo.tLibInitBitMask;
462 (*libInitBitMask) = (*libInitBitMask) | PJ_LIB_CP_CIP_BIT_MASK;
464 ret = PjLibObdCpInitReq(&gCb->pjGenCfg.obdPst.secPst, ueCb->secInfo.secCxt,
465 ueCb->secInfo.cipherInfo.algoType, ueCb->secInfo.cipherInfo.cpKey);
468 #ifdef QAT_TWO_INSTANCE
469 ret = pjLibCpInitReq(gCb->u.dlCb->instHndl, ueCb->secInfo.secCxt, ueCb->secInfo.cipherInfo.algoType,
470 ueCb->secInfo.cipherInfo.cpKey, &ctxId);
472 ret = pjLibCpInitReq(gCb, ueCb->secInfo.secCxt, ueCb->secInfo.cipherInfo.algoType,
473 ueCb->secInfo.cipherInfo.cpKey, &ctxId);
475 ueCb->secInfo.cpCiphSessCxtId= ctxId;
477 ret = pjLibCpInitReq(ueCb->secInfo.secCxt, (U8)ueCb->secInfo.cipherInfo.algoType,
478 ueCb->secInfo.cipherInfo.cpKey, &ctxId); /*KW_FIX*/
479 ueCb->secInfo.cpCxtId = ctxId;
480 #endif /* INTEL_QAT_DP */
481 #endif /* PJ_SEC_ASYNC */
485 } /* end of pjUtlCpInit */
491 * Handler for opening the context with the Ciphering unit (either
492 * synchronous or asynchronous) for DRBs of an UE.
496 * This function opens the context with the security algo unit per UE
497 * for ciphering / deciphering by sending the configured
498 * Ciphering Info with user plane key using synchronous / asynchronous
499 * function calls with relevant input parameters.
501 * @param[in] pjRbCb Pointer to RB control Block
508 PUBLIC S16 pjUtlDlUpInit
511 PjDlUeCb *ueCb /* UE CB Ptr */
514 PUBLIC S16 pjUtlDlUpInit(*gCb,*ueCb)
516 PjDlUeCb *ueCb; /* UE CB Ptr */
523 U32 *libInitBitMask = NULLP;
529 RLOG2(L_DEBUG, "pjUtlUpInit(ueCb(%d,%d))",ueCb->key.ueId, ueCb->key.cellId);
533 if(ueCb->libInfo.state == PJ_STATE_REEST)
535 for(txIdx = 0; txIdx < PJ_MAX_ASYNC_CFM; txIdx++)
537 if((ueCb->libInfo.asyncCfm[txIdx] != NULLP) &&
538 (ueCb->libInfo.asyncCfm[txIdx]->cfmType == PJ_REEST_ASYNC_CFM))
540 libInitBitMask = &ueCb->libInfo.asyncCfm[txIdx]->libInitBitMask;
545 else if(ueCb->libInfo.state == PJ_STATE_NORMAL)
547 libInitBitMask = &ueCb->libInfo.tLibInitBitMask;
551 (*libInitBitMask) = (*libInitBitMask) | PJ_LIB_UP_CIP_BIT_MASK;
553 ret = PjLibObdUpInitReq(&gCb->pjGenCfg.obdPst.secPst, ueCb->secInfo.secCxt,
554 ueCb->secInfo.cipherInfo.algoType, ueCb->secInfo.cipherInfo.upKey);
557 #ifdef QAT_TWO_INSTANCE
558 pjLibUpInitReq(gCb->u.dlCb->instHndl, ueCb->secInfo.secCxt, ueCb->secInfo.cipherInfo.algoType,
559 ueCb->secInfo.cipherInfo.upKey, &ctxId);
561 pjLibUpInitReq(gCb, ueCb->secInfo.secCxt, ueCb->secInfo.cipherInfo.algoType,
562 ueCb->secInfo.cipherInfo.upKey, &ctxId);
564 ueCb->secInfo.upCiphSessCxtId= ctxId;
566 pjLibUpInitReq(ueCb->secInfo.secCxt, (U8)ueCb->secInfo.cipherInfo.algoType,
567 ueCb->secInfo.cipherInfo.upKey, &ctxId); /*KW_FIX*/
568 ueCb->secInfo.upCxtId = ctxId;
569 #endif /* INTEL_QAT_DP */
570 #endif /* PJ_SEC_ASYNC */
572 } /* end of pjUtlUpInit */
580 * Handler for redirecing ciphering request to either synchronous
581 * or asynchronous module.
585 * This function sends ciphering protection request as either synchronous or
586 * asynchronous function calls with relevant input parameters.
588 * @param[in] pjRbCb PDCP RbCb
589 * @param[in] secInp Input parameters for deciphering
590 * @param[in] mBuf Data to be deciphered
591 * @param[in] opSdu Deciphered SDU
597 //#ifdef TENB_AS_SECURITY
599 PUBLIC S16 pjUtlCipherReq
602 PjDlRbCb *pjRbCb, /* PDCP RbCb */
603 U32 count, /* Input parameters for deciphering */
604 Buffer *mBuf, /* Data to be deciphered */
605 Buffer **opSdu /* Deciphered SDU */
608 PUBLIC S16 pjUtlCipherReq(gCb, pjRbCb, count, mBuf, opSdu)
610 PjDlRbCb *pjRbCb; /* PDCP RbCb */
611 U32 count; /* Input parameters for deciphering */
612 Buffer *mBuf; /* Data to be deciphered */
613 Buffer **opSdu; /* Deciphered SDU */
618 PjLibTrans libTrans; /* Transaction Id for deciphering */
621 Void *cxtId; /* Context Identifier */
626 dlUeCb = pjRbCb->ueCb;
627 libTrans.pdcpInstance = gCb->init.inst;
628 libTrans.count = count;
630 libTrans.rbId = pjRbCb->rbId - 1;
631 libTrans.dir = PJ_SEC_DIR_DL;
632 libTrans.rbType = pjRbCb->rbType;
633 libTrans.snLen = pjRbCb->snLen;
634 libTrans.ciphAlgoType = dlUeCb->secInfo.cipherInfo.algoType;
635 libTrans.ueCb = (PTR)dlUeCb;
636 libTrans.ueId = dlUeCb->key.ueId;
637 libTrans.cellId = dlUeCb->key.cellId;
638 if(PJ_SRB == pjRbCb->rbType)
640 libTrans.key = dlUeCb->secInfo.cipherInfo.cpKey;
642 libTrans.sessCxtId = dlUeCb->secInfo.cpCiphSessCxtId;
643 #ifdef QAT_TWO_INSTANCE
644 libTrans.instHndl = gCb->u.dlCb->instHndl;
646 libTrans.instHndl = gCb->instHndl;
652 libTrans.key = dlUeCb->secInfo.cipherInfo.upKey;
654 libTrans.sessCxtId = dlUeCb->secInfo.upCiphSessCxtId;
655 #ifdef QAT_TWO_INSTANCE
656 libTrans.instHndl = gCb->u.dlCb->instHndl;
658 libTrans.instHndl = gCb->instHndl;
664 /* Start the timer if it is not started already */
665 if((pjChkTmr(gCb, (PTR)pjRbCb, PJ_EVT_DL_OBD_TMR)) == FALSE)
667 pjStartTmr(gCb, (PTR)pjRbCb, PJ_EVT_DL_OBD_TMR);
670 if (pjRbCb->rbType == PJ_SRB)
672 cxtId = pjRbCb->ueCb->secInfo.cpCxtId;
676 cxtId = pjRbCb->ueCb->secInfo.upCxtId;
679 ret = PjLibObdCipherReq(&(gCb->pjGenCfg.obdPst.secPst), cxtId,
680 secInp, libTrans, mBuf);
684 ret = PjLibObdSwCipherReq(&libTrans, mBuf, gCb,opSdu);
686 ret = PjLibObdCipherReq(&libTrans, mBuf, opSdu);
687 #endif /* INTEL_SW_SEC */
695 #ifdef FLAT_BUFFER_OPT
700 * Handler for redirecing ciphering request to either synchronous
701 * or asynchronous module.
705 * This function sends ciphering protection request as either synchronous or
706 * asynchronous function calls with relevant input parameters.
708 * @param[in] pjRbCb PDCP RbCb
709 * @param[in] secInp Input parameters for deciphering
710 * @param[in] mBuf Flat Buffer to be deciphered
711 * @param[in] opSdu Deciphered SDU
719 PUBLIC S16 pjUtlCipherReqFB
722 PjDlRbCb *pjRbCb, /* PDCP RbCb */
723 U32 count, /* Input parameters for deciphering */
724 FlatBuffer *mBuf, /* Data to be deciphered */
725 Buffer **opSdu /* Deciphered SDU */
728 PUBLIC S16 pjUtlCipherReqFB(gCb, pjRbCb, count, mBuf, opSdu)
730 PjDlRbCb *pjRbCb; /* PDCP RbCb */
731 U32 count; /* Input parameters for deciphering */
732 FlatBuffer *mBuf; /* Data to be deciphered */
733 Buffer **opSdu; /* Deciphered SDU */
738 Void *cxtId; /* Context Identifier */
743 TRC3(pjUtlCipherReqFB)
746 cxtId = pjRbCb->ueCb->secInfo.upCxtId;
749 dlUeCb = pjRbCb->ueCb;
750 libTrans.pdcpInstance = gCb->init.inst;
751 libTrans.count = count;
753 libTrans.rbId = pjRbCb->rbId - 1;
754 libTrans.dir = PJ_SEC_DIR_DL;
755 libTrans.rbType = pjRbCb->rbType;
756 libTrans.snLen = pjRbCb->snLen;
757 libTrans.ciphAlgoType = dlUeCb->secInfo.cipherInfo.algoType;
758 libTrans.ueCb = (PTR)dlUeCb;
759 libTrans.ueId = dlUeCb->key.ueId;
760 libTrans.cellId = dlUeCb->key.cellId;
761 if(PJ_SRB == pjRbCb->rbType)
763 libTrans.key = dlUeCb->secInfo.cipherInfo.cpKey;
765 libTrans.sessCxtId = dlUeCb->secInfo.cpCiphSessCxtId;
766 #ifdef QAT_TWO_INSTANCE
767 libTrans.instHndl = gCb->u.dlCb->instHndl;
769 libTrans.instHndl = gCb->instHndl;
775 libTrans.key = dlUeCb->secInfo.cipherInfo.upKey;
777 libTrans.sessCxtId = dlUeCb->secInfo.upCiphSessCxtId;
778 #ifdef QAT_TWO_INSTANCE
779 libTrans.instHndl = gCb->u.dlCb->instHndl;
781 libTrans.instHndl = gCb->instHndl;
787 /* Start the timer if it is not started already */
788 if((pjChkTmr(gCb, (PTR)pjRbCb, PJ_EVT_DL_OBD_TMR)) == FALSE)
790 pjStartTmr(gCb, (PTR)pjRbCb, PJ_EVT_DL_OBD_TMR);
793 ret = PjLibObdCipherReq(&(gCb->pjGenCfg.obdPst.secPst), cxtId,
794 secInp, libTrans, mBuf);
798 ret = PjLibObdCipherReqFB(&libTrans, mBuf, opSdu);
800 ret = pjSendToSwCipherFB(&libTrans, mBuf,gCb,opSdu);
814 * Handler for redirecing Integration request to either synchronous
815 * or asynchronous module.
819 * This function sends Intergrity protection request as either synchronous or
820 * asynchronous function calls with relevant input parameters.
822 * @param[in] pjRbCb PDCP RbCb
823 * @param[in] secInp Input parameters for integrity
824 * @param[in] mBuf SDU to be compressed
825 * @param[out] macI Message authentication code for the SDU
832 PUBLIC S16 pjUtlIntProtReq
835 PjDlRbCb *pjRbCb, /* PDCP RbCb */
836 PjSecInp secInp, /* Input parameters for integrity */
837 Buffer **mBuf /* SDU to be compressed */
840 PUBLIC S16 pjUtlIntProtReq(gCb, pjRbCb, secInp, mBuf)
842 PjDlRbCb *pjRbCb; /* PDCP RbCb */
843 PjSecInp secInp; /* Input parameters for integrity */
844 Buffer **mBuf; /* SDU to be compressed */
851 Void *cxtId; /* Context Identifier */
854 TRC3(pjUtlIntProtReq)
857 cxtId = pjRbCb->ueCb->secInfo.intCxtId;
860 dlUeCb = pjRbCb->ueCb;
861 libTrans.pdcpInstance = gCb->init.inst;
862 libTrans.count = secInp.count;
863 libTrans.rbId = pjRbCb->rbId - 1;
864 libTrans.dir = secInp.dir;
865 libTrans.rbType = pjRbCb->rbType;
866 /*pSecInfo.snLen = pjRbCb->snLen;*/
867 libTrans.intAlgoType = dlUeCb->secInfo.intInfo.algoType;
868 libTrans.ueCb = (PTR)dlUeCb;
869 libTrans.ueId = dlUeCb->key.ueId;
870 libTrans.cellId = dlUeCb->key.cellId;
871 libTrans.key = &(dlUeCb->secInfo.intInfo.intKey[0]);
872 PJ_SEC_FILL_FRESH(libTrans.fresh, libTrans.rbId);
875 libTrans.sessCxtId = dlUeCb->secInfo.cpIntSessCxtId;
876 #ifdef QAT_TWO_INSTNACES
877 libTrans.instHndl = gCb->u.dlCb->instHndl;
879 libTrans.instHndl = gCb->instHndl;
884 /* Start the timer if it is not started already */
885 if((pjChkTmr(gCb, (PTR)pjRbCb, PJ_EVT_DL_OBD_TMR)) == FALSE)
887 pjStartTmr(gCb, (PTR)pjRbCb, PJ_EVT_DL_OBD_TMR);
890 ret = PjLibObdIntProtReq(&(gCb->pjGenCfg.obdPst.secPst), cxtId,
891 secInp, libTrans, mBuf);
894 #ifdef INTEL_SW_INTEG
895 ret = PjLibObdIntProtReq(gCb, &libTrans, mBuf);
897 ret = PjLibObdIntProtReq(&libTrans, mBuf);
898 #endif /* INTEL_SW_INTEG */
903 } /* end of pjUtlIntProtReq */
912 * Handler for closing the DL context with the Ciphering unit (either
913 * synchronous or asynchronous) for SRBs of an UE.
917 * This function closes an existing DL context with the security algo unit per UE
918 * for ciphering / deciphering with control plane key using synchronous / asynchronous
919 * function calls with relevant input parameters.
922 * @param[in] cpCxtId Context Id for Ciphering to be closed
929 PUBLIC S16 pjUtlDlCipherClose
932 Void *cpCxtId /* Context Id for Ciphering to be closed */
935 PUBLIC S16 pjUtlDlCipherClose(gCb, cpCxtId)
937 Void *cpCxtId; /* Context Id for Ciphering to be closed */
943 TRC3(pjUtlDlCipherClose)
945 RLOG0(L_DEBUG, "pjUtlDlCipherClose");
949 #ifdef QAT_TWO_INSTANCE
950 ret = PjLibObdCipherCloseReq(gCb->u.dlCb->instHndl, cpCxtId);
952 ret = PjLibObdCipherCloseReq(gCb->instHndl, cpCxtId);
955 PjLibObdCipherCloseReq(cpCxtId);
959 #ifdef QAT_TWO_INSTANCE
960 ret = PjLibObdCipherCloseReq(gCb->u.dlCb->instHndl, cpCxtId);
962 ret = PjLibObdCipherCloseReq(gCb->instHndl, cpCxtId);
965 PjLibObdCipherCloseReq(&gCb->pjGenCfg.obdPst.secPst, cpCxtId);
975 } /* end of pjUtlCipherClose */
982 * Handler for closing the DL context with the Integration unit (either
983 * synchronous or asynchronous) for all RBs of an UE.
987 * This function closes an existing DL context with the security algo unit per UE
988 * for Integration protection/verification using synchronous / asynchronous function
989 * calls with relevant input parameters.
992 * @param[in] intCxtId Integration CxtId to be closed
999 PUBLIC S16 pjUtlDlIntClose
1002 Void *intCxtId /* Integration CxtId to be closed */
1005 PUBLIC S16 pjUtlDlIntClose(gCb, intCxtId)
1007 Void *intCxtId; /* Integration CxtId to be closed */
1013 TRC3(pjUtlDlIntClose)
1015 RLOG0(L_DEBUG, "pjUtlDlIntClose");
1018 PjLibObdIntCloseReq(&gCb->pjGenCfg.obdPst.secPst,intCxtId);
1021 #ifdef QAT_TWO_INSTANCE
1022 ret = PjLibObdIntCloseReq(gCb->u.dlCb->instHndl,intCxtId);
1024 ret = PjLibObdIntCloseReq(gCb->instHndl,intCxtId);
1027 PjLibObdIntCloseReq(intCxtId);
1028 #endif /* INTEL_QAT_DP */
1029 #endif /* PJ_SEC_ASYNC */
1037 } /* end of pjUtlIntClose */
1044 * Handler for resetting the context with the compression unit (either
1045 * synchronous or asynchronous) for RB within an UE.
1049 * This function resets the context with the compression unit per RB per
1050 * UE by using synchronous / asynchronous function calls.
1053 * @param[in] cmpCxtId Context to be reset for compression
1060 PUBLIC S16 pjUtlDlCmpReset
1063 PjDlRbCb *pjRbCb /* Context to be reset for compression */
1066 PUBLIC S16 pjUtlDlCmpReset(pjRbCb)
1068 PjDlRbCb *pjRbCb; /* Context to be reset for compression */
1071 TRC3(pjUtlDlCmpReset)
1073 RLOG2(L_DEBUG, "pjUtlCmpReset(pjRbCb(%d,%d))",pjRbCb->rbId, pjRbCb->rbType);
1076 PjLibObdCmpResetReq(&gCb->pjGenCfg.obdPst.cmpPst, pjRbCb->cmpCxtId);
1078 pjLibCmpResetReq(pjRbCb->cmpCxtId);
1083 } /* end of pjUtlCmpReset */
1089 * Handle re-establishment on SRB1.
1093 * 1. Marks the state of the RBs as PJ_STATE_REEST.
1094 * 2. Calculates the number of RBs undergoing reestablishment.
1096 * @param[in] gCb PDCP Instance control block
1097 * @param[in] pjRbCb Downlink Rb control block
1105 PUBLIC S16 pjUtlDlReEstSrb1
1108 PjDlRbCb *pjRbCb /* PDCP Control Block Pointer */
1111 PUBLIC S16 pjUtlDlReEstSrb1(gCb, pjRbCb)
1113 PjDlRbCb *pjRbCb; /* PDCP Control Block Pointer */
1118 TRC2(pjUtlDlReEstSrb1)
1120 RLOG2(L_DEBUG, "pjUtlReEstSrb1(pjRbCb(%d,%d))",pjRbCb->rbId, pjRbCb->rbType);
1122 ueCb = pjRbCb->ueCb;
1124 ueCb->libInfo.state = PJ_STATE_REEST;
1126 /* SRB Reconfiguration we can update the control Plane keys and
1127 the Integrity Keys in the OBD module */
1129 pjUtlDlUpdCpSecKeys(gCb,ueCb);
1131 /* Perform downlink reestablishment of SRB1 */
1132 pjDlmReEstSrb(gCb,pjRbCb);
1134 /* If Only SRB1 configured then we can update userplane
1136 if ((ueCb->numSrbs == 1) && (ueCb->numDrbs == 0))
1138 pjUtlDlUpdUpSecKeys(gCb,ueCb);
1142 } /* pjUtlReEstSrb1 */
1149 * Handler to start reestablishment processing
1154 * 1. Marks the state of the RBs as PJ_STATE_REEST_HO.
1155 * 2. Calculates the number of RBs undergoing reestablishment.
1157 * @param[in] ueCb Number of RBs undergoing reestablishment
1165 PUBLIC S16 pjUtlDlReEstHO
1168 PjDlUeCb *ueCb /* Number of RBs undergoing reestablishment*/
1171 PUBLIC S16 pjUtlDlReEstHO(gCb,ueCb)
1173 PjDlUeCb *ueCb; /* Number of RBs undergoing reestablishment*/
1180 TRC2 (pjUtlDlReEstHO);
1183 RLOG2(L_DEBUG, "pjUtlReEstHO(ueCb(%d,%d))",ueCb->key.ueId, ueCb->key.cellId);
1185 RLOG2(L_DEBUG, "pjUtlReEstHO(ueCb(%d,%d))",ueCb->key.ueId, ueCb->key.cellId);
1188 /* Initialisations */
1189 ueCb->libInfo.numReEstDrb = 0;
1190 ueCb->libInfo.state = PJ_STATE_REEST_HO;
1192 /* Perform initialisations on the HO Info structure */
1193 PJ_ALLOC(gCb,ueCb->hoInfo, sizeof(PjDlHoInfo));
1194 #if (ERRCLASS & ERRCLS_ADD_RES)
1195 if (ueCb->hoInfo == NULLP)
1197 RLOG0(L_FATAL, "Memory Allocation failed.");
1200 #endif /* ERRCLASS & ERRCLS_ADD_RES */
1202 PJ_ALLOC(gCb,ueCb->hoInfo->hoCfmInfo, sizeof(PjDlHoCfmInfo) * PJ_MAX_DRB_PER_UE );
1203 #if (ERRCLASS & ERRCLS_ADD_RES)
1204 if (ueCb->hoInfo->hoCfmInfo == NULLP )
1207 PJ_PST_FREE(gCb->u.dlCb->udxDlSap[0].pst.region,
1208 gCb->u.dlCb->udxDlSap[0].pst.pool,
1209 ueCb->hoInfo, sizeof(PjDlHoInfo));
1210 RLOG0(L_FATAL, "Memory Allocation failed.");
1213 #endif /* ERRCLASS & ERRCLS_ADD_RES */
1215 /* Initialise the reestablishment states for the RBs */
1216 rbCbLst = ueCb->drbCb;
1217 for(rbCnt = 0; rbCnt < PJ_MAX_DRB_PER_UE; rbCnt ++)
1219 /* Check of rbCb available */
1220 if( (pjRbCb = rbCbLst[rbCnt]) == NULLP)
1225 /* Fetch the rbCb and intialise the states */
1226 pjRbCb->state = PJ_STATE_REEST_HO;
1228 if(pjRbCb->mode == PJ_DRB_AM)
1230 pjDlmReEstHoDrbAm(gCb, pjRbCb);
1236 } /* pjUtlReEstHO */
1243 * Called after the new security algorithms have been applied
1244 * and header compression/decompression reset. It starts
1245 * reestablishment procedures for downlink DRBs.
1250 * 1. Creates new contexts for Ciphering and Integrity.
1251 * 2. Closes the old contexts for Ciphering and Integrity.
1252 * 3. Resets the ROHC unit.
1254 * @param[in] ueCb UE Control Block
1262 PUBLIC S16 pjUtlReEstDl
1265 PjDlUeCb *ueCb /* UE Control Block */
1268 PUBLIC S16 pjUtlReEstDl(gCb, ueCb)
1270 PjDlUeCb *ueCb; /* UE Control Block */
1275 RLOG2(L_DEBUG, "pjUtlReEstDl(ueCb(%d,%d))",ueCb->key.ueId, ueCb->key.cellId);
1278 /* Send Cfms and update the state only
1279 when there is some cfgreq cfm is present for other RBs*/
1280 if(ueCb->libInfo.state == PJ_STATE_REEST)
1282 pjUtlDlSndReEstCfgCfm(gCb, ueCb);
1284 else if(ueCb->libInfo.state == PJ_STATE_REEST_HO)
1286 pjUtlDlSndSduStaCfm(gCb, ueCb);
1288 ueCb->libInfo.state = PJ_STATE_NORMAL;
1292 } /* pjUtlReEstDl */
1301 * Function to sent the REESTABLISHMENT COMPPLETE
1307 * 1. Sends a ReEstablishment Confirm for normal reestablishment.
1308 * 2. Sends a SDU status confirm for handover reestablishment.
1310 * @param[in] ueCb UE Control Block
1318 PUBLIC S16 pjUtlDlSndReEstCfgCfm
1321 PjDlUeCb *ueCb /* UE Control Block */
1324 PUBLIC S16 pjUtlDlSndReEstCfgCfm(ueCb)
1326 PjDlUeCb *ueCb; /* UE Control Block */
1331 CpjCfgCfmInfo *cfgCfmInfo;
1333 PjAsyncCfm *asyncCfm = NULLP;
1334 PjUdxDlSapCb *udxSap;
1337 TRC2(pjUtlDlSndReEstCfgCfm);
1339 RLOG2(L_DEBUG, "pjUtlSndReEstCfgCfm(ueCb(%d,%d))",ueCb->key.ueId, ueCb->key.cellId);
1341 ueCb->libInfo.state = PJ_STATE_NORMAL;
1343 /* Pick up the confirm info */
1344 for(txIdx = 0; txIdx < PJ_MAX_ASYNC_CFM; txIdx++)
1346 if((ueCb->libInfo.asyncCfm[txIdx] != NULLP) &&
1347 (ueCb->libInfo.asyncCfm[txIdx]->cfmType & PJ_CFG_REEST_ASYNC_CFM))
1349 asyncCfm = ueCb->libInfo.asyncCfm[txIdx];
1354 /* its a reestablishment with only srb1 configured */
1355 if(asyncCfm == NULLP)
1360 for(rbCnt = 0; rbCnt < PJ_MAX_SRB_PER_UE; rbCnt ++)
1362 if( ((tRbCb = ueCb->srbCb[rbCnt]) == NULLP) ||
1363 (tRbCb->state == PJ_STATE_NORMAL))
1368 /* Fetch the rbCb and intialise the states */
1369 tRbCb->state = PJ_STATE_NORMAL;
1372 /* Memory leak fix ccpu00135359 */
1373 udxSap = &(gCb->u.dlCb->udxDlSap[0]);
1374 PJ_ALLOC_BUF_SHRABL(udxSap->pst, cfgCfmInfo,
1375 sizeof (CpjCfgCfmInfo), ret);
1378 RLOG0(L_FATAL, "Memory Allocation failed.");
1382 PJ_FILL_REEST_CFG_CFM_INFO(cfgCfmInfo, asyncCfm);
1383 PJ_CLEAN_AND_UPD_ASYNCINFO(gCb,ueCb, txIdx);
1385 PjDlUdxCfgCfm(&gCb->u.dlCb->udxDlSap[0].pst,
1386 gCb->u.dlCb->udxDlSap[0].suId,
1387 (UdxCfgCfmInfo *)cfgCfmInfo);
1390 } /* pjUtlSndReEstCfgCfm */
1395 * @brief Handler to store the confirms while we wait for the init
1396 * confirms from the off-board.
1400 * This function is invoked during security config request,
1401 * reestablishment request and config request if the libraries
1402 * are off-boarded. This stores the entries in a confirm list
1403 * while waiting for the confirm from the offboard.
1412 PUBLIC S16 pjUtlDlSaveCfmInfo
1415 PjDlUeCb *ueCb, /* Pointer to UeCb */
1416 U8 cfmType, /* Confirm type */
1417 Bool startTmr, /* Start Timer */
1418 U8 entity, /* Confirm type */
1419 PTR cfmPtr, /* Pointer to the structure for confirm */
1420 PTR cfgPtr /* Pointer to the structure for request */
1423 PUBLIC S16 pjUtlDlSaveCfmInfo(ueCb, cfmType, startTmr, entity, cfmPtr, cfgPtr)
1425 PjDlUeCb *ueCb; /* Pointer to UeCb */
1426 U8 cfmType; /* Confirm type */
1427 Bool startTmr; /* Start Timer */
1428 U8 entity; /* Confirm type */
1429 PTR cfmPtr; /* Pointer to the structure for confirm */
1430 PTR cfgPtr; /* Pointer to the structure for request */
1433 S16 ret; /* Return value */
1434 CpjSecCfgCfmInfo *secCfm; /* Security confirm */
1435 CpjReEstCfmInfo *reEstCfm; /* Reestablishment confirm */
1436 CpjCfgCfmInfo *cfgCfm; /* Config confirm */
1437 U16 txId; /* Transaction Id */
1438 PjAsyncCfm *tAsyncCfm; /* Pointer to the async Cfm*/
1439 CpjCfgReqInfo *cfgReq; /* Pointer to the config request */
1440 U8 cfmIdx; /* index for loopoing */
1443 TRC3(pjUtlDlSaveCfmInfo)
1445 RLOG_ARG4(L_DEBUG,DBG_UEID,ueCb->key.ueId,
1446 "pjUtlSaveCfmInfo cellId(%d),cfmType(%d),startTmr(%d),entity(%d))",
1447 ueCb->key.cellId, cfmType, startTmr, entity);
1449 /* Initialisations */
1455 txId = ueCb->libInfo.nxtAvlbTxId;
1457 if(txId == PJ_MAX_ASYNC_CFM)
1459 /* The entire list is full, have to return negative confirms */
1463 /* is entry already present */
1464 if(ueCb->libInfo.asyncCfm[txId] != NULLP)
1469 /* Allocate the structure */
1470 PJ_ALLOC(gCb,ueCb->libInfo.asyncCfm[txId], sizeof(PjAsyncCfm));
1471 if(ueCb->libInfo.asyncCfm[txId]== NULLP)
1473 RLOG0(L_FATAL, "Memory Allocation failed.");
1477 /* Initialise the structure */
1478 tAsyncCfm = ueCb->libInfo.asyncCfm[txId];
1479 tAsyncCfm->libInitBitMask = ueCb->libInfo.tLibInitBitMask;
1480 tAsyncCfm->cmpInitBitMask = ueCb->libInfo.tCmpInitBitMask;
1481 tAsyncCfm->entity = entity;
1482 tAsyncCfm->startTmr = startTmr;
1484 ueCb->libInfo.tLibInitBitMask = 0;
1485 ueCb->libInfo.tCmpInitBitMask = 0;
1487 /* Assign the values */
1488 if(cfmType == PJ_SEC_ASYNC_CFM)
1490 secCfm = (CpjSecCfgCfmInfo *)cfmPtr;
1491 tAsyncCfm->cfmType = cfmType;
1492 tAsyncCfm->ueId = secCfm->ueId;
1493 tAsyncCfm->cellId = secCfm->cellId;
1494 tAsyncCfm->transId = secCfm->transId;
1496 else if(cfmType == PJ_REEST_ASYNC_CFM)
1498 reEstCfm = (CpjReEstCfmInfo *)cfmPtr;
1499 tAsyncCfm->cfmType = cfmType;
1500 tAsyncCfm->ueId = reEstCfm->ueId;
1501 tAsyncCfm->cellId = reEstCfm->cellId;
1502 tAsyncCfm->transId = reEstCfm->transId;
1504 else if((cfmType & PJ_CFG_ASYNC_CFM) ||
1505 (cfmType & PJ_CFG_REEST_ASYNC_CFM)||
1506 (cfmType & PJ_CFG_UEDEL_ASYNC_CFM))
1510 cfgCfm = (CpjCfgCfmInfo *)cfmPtr;
1511 cfgReq = (CpjCfgReqInfo *)cfgPtr;
1513 tAsyncCfm->cfmType = cfmType;
1514 tAsyncCfm->ueId = cfgCfm->ueId;
1515 tAsyncCfm->cellId = cfgCfm->cellId;
1516 tAsyncCfm->transId = cfgCfm->transId;
1517 tAsyncCfm->numEnt = cfgReq->numEnt;
1519 for ( cfmIdx = 0; cfmIdx < cfgReq->numEnt; cfmIdx++ )
1521 tAsyncCfm->cfmEnt[cfmIdx].status = cfgCfm->cfmEnt[cfmIdx].status;
1522 tAsyncCfm->cfmEnt[cfmIdx].reason = cfgCfm->cfmEnt[cfmIdx].reason;
1523 tAsyncCfm->cfmEnt[cfmIdx].rbId = cfgCfm->cfmEnt[cfmIdx].rbId;
1524 tAsyncCfm->cfmEnt[cfmIdx].rbType = cfgCfm->cfmEnt[cfmIdx].rbType;
1525 tAsyncCfm->cfmEnt[cfmIdx].cfgType = cfgReq->cfgEnt[cfmIdx].cfgType;
1528 else if(entity == ENTPJ)
1530 CpjCfgCfmInfo *pjCfgCfm; /* Configuraiton Confirm */
1532 pjCfgCfm = (CpjCfgCfmInfo *)cfmPtr;
1534 tAsyncCfm->cfmType = cfmType;
1535 tAsyncCfm->transId = pjCfgCfm->transId;
1536 tAsyncCfm->ueId = pjCfgCfm->ueId;
1537 tAsyncCfm->cellId = pjCfgCfm->cellId;
1538 tAsyncCfm->numEnt = pjCfgCfm->numEnt;
1540 for ( cfmIdx = 0; cfmIdx < pjCfgCfm->numEnt; cfmIdx++ )
1542 tAsyncCfm->cfmEnt[cfmIdx].status =
1543 pjCfgCfm->cfmEnt[cfmIdx].status;
1544 tAsyncCfm->cfmEnt[cfmIdx].reason =
1545 pjCfgCfm->cfmEnt[cfmIdx].reason;
1546 tAsyncCfm->cfmEnt[cfmIdx].rbId =
1547 pjCfgCfm->cfmEnt[cfmIdx].rbId;
1548 tAsyncCfm->cfmEnt[cfmIdx].rbType =
1549 pjCfgCfm->cfmEnt[cfmIdx].rbType;
1555 /* Timer should not be started when SEC is SYNC for ReEst Req
1556 * and for the subsequent config req for REEST. The config req
1557 * after reest req can still start the timer in the case comp being
1558 * async and sec being sync if it also adds a RB and a compInit has
1562 if(tAsyncCfm->startTmr == TRUE)
1564 if((pjChkTmr(gCb,(PTR)ueCb, PJ_EVT_OBD_WAIT_TMR)) == FALSE)
1566 pjStartTmr(gCb,(PTR)ueCb, PJ_EVT_OBD_WAIT_TMR);
1567 ueCb->libInfo.crntTmrTxId = ueCb->libInfo.nxtAvlbTxId;
1571 /* update nxtAvlbTxId to the next empty slot */
1572 for(cfmIdx = 0; cfmIdx < PJ_MAX_ASYNC_CFM; cfmIdx++)
1574 ueCb->libInfo.nxtAvlbTxId =
1575 (U16)((ueCb->libInfo.nxtAvlbTxId + 1) % PJ_MAX_ASYNC_CFM); /*KW_FIX*/
1577 if(ueCb->libInfo.asyncCfm[ueCb->libInfo.nxtAvlbTxId] == NULLP)
1583 /* Cant find an empty slot ? */
1584 if(cfmIdx == PJ_MAX_ASYNC_CFM)
1586 ueCb->libInfo.nxtAvlbTxId = PJ_MAX_ASYNC_CFM;
1590 }/* pjUtlSaveCfmInfo */
1594 * @brief Handler to store update the bitmaks and send confirms if necessary.
1598 * This function is invoked when receiving a InitCfm from Offboard.
1599 * It updates the bit masks and checks if it is necesary to send a
1609 PUBLIC S16 pjUtlDlHdlObdInitCfm
1612 PjDlUeCb *ueCb, /* Pointer to UeCb */
1613 U16 txIdx, /* Transaction Index for UeCb */
1614 U8 cfmType, /* Confirm type */
1615 U8 maskVal /* mask value */
1618 PUBLIC S16 pjUtlDlHdlObdInitCfm(ueCb, txIdx, cfmType, maskVal)
1620 PjDlUeCb *ueCb; /* Pointer to UeCb */
1621 U16 txIdx; /* Transaction Index for UeCb */
1622 U8 cfmType; /* Confirm type */
1623 U8 maskVal; /* mask value */
1626 UdxSecCfgCfmInfo *secCfgCfm; /* Security config confirm */
1627 UdxReEstCfmInfo *reEstCfm; /* Reest config confirm */
1628 PjAsyncCfm *asyncCfm;
1629 UdxCfgCfmInfo *cfgCfm;
1633 TRC3(pjUtlDlHdlObdInitCfm)
1635 RLOG_ARG4(L_DEBUG,DBG_UEID,ueCb->key.ueId,
1636 "pjUtlHdlDlObdInitCfm cellId(%d), txIdx(%d), cfmType(%d), maskVal(%d))",
1637 ueCb->key.cellId, txIdx, cfmType, maskVal);
1639 /* Initialisations */
1646 if((txIdx == PJ_MAX_ASYNC_CFM) ||
1647 (ueCb->libInfo.asyncCfm[txIdx] == NULLP))
1652 asyncCfm = ueCb->libInfo.asyncCfm[txIdx];
1654 if(cfmType & PJ_SEC_INIT_CFM)
1656 /* Update bit mask and check if all confirms have been received */
1657 asyncCfm->libInitBitMask ^= (maskVal);
1658 ret = pjUtlDlHdlSecInitCfm(gCb,ueCb,txIdx,asyncCfm,secCfgCfm,reEstCfm);
1660 else if(cfmType & PJ_CMP_INIT_CFM)
1662 /* Check if all confirms have been received */
1663 asyncCfm->cmpInitBitMask &= ~(1 << (maskVal - 1));
1665 /* Update the status and reason for the received CmpInitCfm */
1666 for ( idx = 0; idx < asyncCfm->numEnt; idx++ )
1668 if ( asyncCfm->cfmEnt[idx].rbId == maskVal)
1670 asyncCfm->cfmEnt[idx].status = CPJ_CFG_CFM_OK;
1671 asyncCfm->cfmEnt[idx].reason = CPJ_CFG_REAS_NONE;
1676 /* Check if we can send confirm */
1677 if(asyncCfm->cmpInitBitMask == 0)
1679 ret = pjUtlDlHdlCmpInitCfm(gCb,ueCb,txIdx,asyncCfm,cfgCfm);
1683 }/* pjUtlHdlDlObdInitCfm */
1687 * @brief Handler for init off-board timer expiry.
1691 * This function is called when the off-board timer expires for
1692 * a Init Req of a channel (either for ciphering/integrity/compression).
1693 * This function sends a confirm with failure for SecCfgReq if the
1694 * state of the RB is normal. It sends a confirm with failure
1695 * for config request(only for RBs with Re-establishment Req, a failure
1696 * is stored in the confirm) if the state of the RB is re-establishment.
1698 * @param[in] ueCb UE control block.
1706 PUBLIC S16 pjUtlDlHdlInitObdTmrExp
1712 PUBLIC S16 pjUtlDlHdlInitObdTmrExp(ueCb)
1717 S16 ret; /* Return Value */
1718 UdxSecCfgCfmInfo *secCfgCfm; /* Security Cfg Confirm Info */
1719 UdxCfgCfmInfo *cfgCfm; /* Config Confirm Info */
1720 UdxReEstCfmInfo *reEstCfm; /* Reest config confirm */
1721 UdxCfgCfmInfo *pjCfgCfm;
1722 PjLibInfo *libInfo; /* Off-board Info */
1723 PjAsyncCfm *asyncCfm; /* Async Cfm Info */
1724 PjUdxDlSapCb *udxSap;
1725 U16 txIdx; /* Tx Idx */
1726 U16 idx; /* Index for looping */
1729 TRC3(pjUtlDlHdlInitObdTmrExp)
1731 RLOG2(L_DEBUG, "pjUtlDlHdlInitObdTmrExp(ueCb(%d,%d))",
1732 ueCb->key.ueId, ueCb->key.cellId);
1735 udxSap = &(gCb->u.dlCb->udxDlSap[0]);
1737 libInfo = &ueCb->libInfo;
1738 txIdx = libInfo->crntTmrTxId;
1740 /* Restart the timer */
1741 PJ_CHK_RESTART_OBD_TIMER(gCb,ueCb, txIdx);
1743 /* Shouldnt happen, nevertheless, check */
1744 if( txIdx >= PJ_MAX_ASYNC_CFM || libInfo->asyncCfm[txIdx] == NULLP)
1749 asyncCfm = libInfo->asyncCfm[txIdx];
1751 /* Security confirm */
1752 if(asyncCfm->cfmType & PJ_SEC_ASYNC_CFM)
1754 PJ_ALLOC_BUF_SHRABL(udxSap->pst,secCfgCfm,
1755 sizeof (UdxSecCfgCfmInfo), ret);
1758 RLOG0(L_FATAL, "Memory Allocation failed.");
1761 PJ_FILL_SEC_CFM_INFO(secCfgCfm, asyncCfm);
1762 secCfgCfm->status = CPJ_CFG_CFM_NOK;
1763 secCfgCfm->reason = CPJ_CFG_REAS_OBD_TIMEOUT;
1765 PJ_CLEAN_AND_UPD_ASYNCINFO(gCb,ueCb, txIdx);
1767 PjDlUdxSecCfgCfm((&udxSap->pst), udxSap->suId, secCfgCfm);
1770 /* Configuration confirms */
1771 else if ((asyncCfm->cfmType & PJ_CFG_ASYNC_CFM) ||
1772 (asyncCfm->cfmType & PJ_CFG_REEST_ASYNC_CFM))
1774 PJ_FILL_TIMEOUT_CFG_CFM_INFO(gCb,cfgCfm, asyncCfm);
1776 PJ_CLEAN_AND_UPD_ASYNCINFO(gCb,ueCb, txIdx);
1778 PjDlUdxCfgCfm(&(gCb->u.dlCb->udxDlSap[0].pst),
1779 gCb->u.dlCb->udxDlSap[0].suId,
1782 else if (asyncCfm->cfmType & PJ_REEST_ASYNC_CFM)
1785 /* Memory leak fix ccpu00135359 */
1786 PJ_ALLOC_BUF_SHRABL(udxSap->pst,reEstCfm,
1787 sizeof (UdxReEstCfmInfo), ret);
1790 RLOG0(L_FATAL, "Memory Allocation failed.");
1793 PJ_FILL_REEST_CFM_INFO(reEstCfm, asyncCfm, LCM_PRIM_NOK);
1795 PJ_CLEAN_AND_UPD_ASYNCINFO(gCb,ueCb, txIdx);
1797 PjDlUdxReEstCfm(&udxSap->pst,
1798 udxSap->suId, reEstCfm);
1800 /* Send the config confirm also if any exists */
1801 cfgIdx = (U16)( txIdx + 1); /*KW_FIX*/
1803 for(idx = 0; idx < PJ_MAX_ASYNC_CFM; idx++, cfgIdx++)
1805 cfgIdx %= PJ_MAX_ASYNC_CFM;
1806 if((libInfo->asyncCfm[cfgIdx] != NULLP) &&
1807 (libInfo->asyncCfm[cfgIdx]->cfmType & PJ_CFG_REEST_ASYNC_CFM))
1813 /* This scenario occurs when only SRB1 is configured */
1814 if(idx == PJ_MAX_ASYNC_CFM)
1819 PJ_CHK_RESTART_OBD_TIMER(gCb,ueCb, cfgIdx);
1820 asyncCfm = libInfo->asyncCfm[cfgIdx];
1822 PJ_FILL_TIMEOUT_CFG_CFM_INFO(gCb,cfgCfm, asyncCfm);
1824 PJ_CLEAN_AND_UPD_ASYNCINFO(gCb,ueCb, txIdx);
1826 PjDlUdxCfgCfm(&gCb->u.dlCb->udxDlSap[0].pst,
1827 gCb->u.dlCb->udxDlSap[0].suId, cfgCfm);
1829 else if(asyncCfm->cfmType & PJ_CFG_UEDEL_ASYNC_CFM)
1831 /* Delete ueCb entry from ueLstCp */
1832 pjStopTmr(gCb,(PTR)ueCb, PJ_EVT_OBD_WAIT_TMR);
1833 ret = cmHashListDelete(&(gCb->u.ulCb->ueLstCp), (PTR) ueCb);
1838 RLOG_ARG0(L_ERROR, DBG_UEID,ueCb->key.ueId,
1839 "Hash List Delete Failed for DL ueCb");
1843 if ( asyncCfm->entity == ENTPJ )
1845 PJ_ALLOC_BUF_SHRABL(udxSap->pst,cfgCfm,
1846 sizeof (UdxCfgCfmInfo), ret);
1849 RLOG0(L_FATAL, "Memory Allocation failed.");
1853 for ( idx = 0; idx < asyncCfm->numEnt; idx++)
1855 cfgCfm->cfmEnt[idx].status = asyncCfm->cfmEnt[idx].status;
1856 cfgCfm->cfmEnt[idx].reason = asyncCfm->cfmEnt[idx].reason;
1857 cfgCfm->cfmEnt[idx].rbId = asyncCfm->cfmEnt[idx].rbId;
1858 cfgCfm->cfmEnt[idx].rbType = asyncCfm->cfmEnt[idx].rbType;
1860 cfgCfm->ueId = asyncCfm->ueId;
1861 cfgCfm->cellId = asyncCfm->cellId;
1862 cfgCfm->transId = asyncCfm->transId;
1863 cfgCfm->numEnt = asyncCfm->numEnt;
1865 /* delete all confirms present there */
1866 for(idx = 0; idx < PJ_MAX_ASYNC_CFM; idx++)
1868 if(libInfo->asyncCfm[idx] != NULLP)
1870 PJ_FREE(gCb,ueCb->libInfo.asyncCfm[idx], sizeof(PjAsyncCfm));
1871 ueCb->libInfo.asyncCfm[idx] = NULLP;
1875 PJ_FREE(gCb,ueCb, sizeof(PjDlUeCb));
1876 PjDlUdxCfgCfm(&(udxSap->pst), udxSap->suId, cfgCfm);
1878 else if ( asyncCfm->entity == ENTPJ )
1880 /* Memory leak fix ccpu00135359 */
1881 PJ_ALLOC_BUF_SHRABL(udxSap->pst,pjCfgCfm,
1882 sizeof (UdxCfgCfmInfo), ret);
1885 RLOG0(L_FATAL, "Memory Allocation failed.");
1888 for ( idx = 0; idx < asyncCfm->numEnt; idx++)
1890 pjCfgCfm->cfmEnt[idx].status = asyncCfm->cfmEnt[idx].status;
1891 pjCfgCfm->cfmEnt[idx].reason = asyncCfm->cfmEnt[idx].reason;
1892 pjCfgCfm->cfmEnt[idx].rbId = asyncCfm->cfmEnt[idx].rbId;
1893 pjCfgCfm->cfmEnt[idx].rbType = asyncCfm->cfmEnt[idx].rbType;
1895 pjCfgCfm->ueId = asyncCfm->ueId;
1896 pjCfgCfm->cellId = asyncCfm->cellId;
1897 pjCfgCfm->transId = asyncCfm->transId;
1898 pjCfgCfm->numEnt = asyncCfm->numEnt;
1900 /* delete all confirms present there */
1901 for(idx = 0; idx < PJ_MAX_ASYNC_CFM; idx++)
1903 if(libInfo->asyncCfm[idx] != NULLP)
1905 PJ_FREE(gCb,ueCb->libInfo.asyncCfm[idx], sizeof(PjAsyncCfm));
1906 ueCb->libInfo.asyncCfm[idx] = NULLP;
1910 PJ_FREE(gCb,ueCb, sizeof(PjDlUeCb));
1911 PjDlUdxCfgCfm(&(udxSap->pst), udxSap->suId, pjCfgCfm);
1916 } /* pjHdlUeDelWaitTmrExp */
1923 * Function to sent the REESTABLISHMENT COMPPLETE
1929 * 1. Sends a ReEstablishment Confirm for normal reestablishment.
1930 * 2. Sends a SDU status confirm for handover reestablishment.
1932 * @param[in] ueCb UE Control Block
1940 PUBLIC S16 pjUtlDlSndSduStaCfm
1943 PjDlUeCb *ueCb /* UE Control Block */
1946 PUBLIC S16 pjUtlDlSndSduStaCfm(gCb, ueCb)
1948 PjDlUeCb *ueCb; /* UE Control Block */
1951 UdxSduStaCfmInfo *cfmInfo;
1952 PjUdxDlSapCb *udxSap;
1955 TRC2(pjUtlDlSndSduStaCfm);
1957 RLOG2(L_DEBUG, "pjUtlSndSduStaCfm(ueCb(%d,%d))",ueCb->key.ueId, ueCb->key.cellId);
1959 /* Perform processing for filling up cfm structures */
1960 /* Memory leak fix ccpu00135359 */
1961 udxSap = &(gCb->u.dlCb->udxDlSap[0]);
1962 PJ_ALLOC_BUF_SHRABL(udxSap->pst, cfmInfo,
1963 sizeof (UdxSduStaCfmInfo), ret);
1966 RLOG0(L_FATAL, "Memory Allocation failed.");
1969 PJ_FILL_DL_SDU_CFM_INFO(gCb,cfmInfo, ueCb);
1971 PjDlUdxSduStaCfm(&gCb->u.dlCb->udxDlSap[0].pst,
1972 gCb->u.dlCb->udxDlSap[0].suId,
1977 } /* pjUtlSndSduStaCfm */
1981 * @brief Handler to clean up all the PDCP Control Blocks.
1985 * This function is invoked by LMM to shutdown the
1986 * layer. This cleans up recBuf and txBuf of all the
1987 * PDCP RBs in all the UEs.
1996 PUBLIC S16 pjUtlDlShutdown
2001 PUBLIC S16 pjUtlDlShutdown()
2005 S16 ret; /* Return Value */
2006 PjDlUeCb *ueCb; /* UE Control Block */
2007 PjDlUeCb *prevUeCb; /* Previos UE Control Block */
2008 PjDlRbCb *rbCb; /* RB Control Block */
2009 PjDlRbCb **rbCbLst; /* RB Control Block List */
2010 PjSec secInfo; /* Security info of UE */
2011 U8 idx; /* Index for RBs */
2012 #ifdef LTE_L2_MEAS_COMMENT
2013 PjL2MeasEvtCb *measEvtCb = NULLP;
2015 TRC3(pjUtlDlShutdown)
2017 RLOG0(L_DEBUG, "pjUtlShutdown()");
2026 /* Until no more ueCb is ueLstCp hash list get and delete ueCb */
2027 while (cmHashListGetNext(&(gCb->u.dlCb->ueLstCp), (PTR) prevUeCb, (PTR *)&ueCb) == ROK)
2029 if ( ueCb != NULLP )
2031 #if (defined(PJ_SEC_ASYNC) || defined (PJ_CMP_ASYNC))
2032 if (ueCb->libInfo.obdTmr.tmrEvnt == PJ_EVT_OBD_TMR)
2034 pjStopTmr(gCb,(PTR)ueCb, PJ_EVT_OBD_TMR);
2037 rbCbLst = ueCb->srbCb;
2038 for (idx = 0; idx < PJ_MAX_SRB_PER_UE; idx++)
2040 rbCb = rbCbLst[idx];
2043 /* Free the Buffers of RbCb */
2044 pjUtlDlFreeRb(gCb,rbCb);
2047 rbCbLst = ueCb->drbCb;
2048 for (idx = 0; idx < PJ_MAX_DRB_PER_UE; idx++)
2050 rbCb = rbCbLst[idx];
2053 pjUtlDlFreeRb(gCb,rbCb);
2056 /* Close all the context info for offboarding */
2057 secInfo = ueCb->secInfo;
2059 pjUtlDlIntClose(gCb,ueCb->secInfo.cpIntSessCxtId);
2060 pjUtlDlCipherClose(gCb,ueCb->secInfo.cpCiphSessCxtId);
2061 pjUtlDlCipherClose(gCb,ueCb->secInfo.upCiphSessCxtId);
2063 pjUtlDlCipherClose(gCb,secInfo.cpCxtId);
2064 pjUtlDlCipherClose(gCb,secInfo.upCxtId);
2065 pjUtlDlIntClose(gCb,secInfo.intCxtId);
2068 /* Delete hoInfo if present */
2069 if (ueCb->hoInfo != NULLP)
2071 PJ_FREE(gCb,ueCb->hoInfo->hoCfmInfo,
2072 (PJ_MAX_DRB_PER_UE * sizeof(PjDlHoCfmInfo)));
2073 PJ_FREE(gCb,ueCb->hoInfo, sizeof(PjDlHoInfo));
2078 #ifdef LTE_L2_MEAS_COMMENT
2079 for(idx = 0; idx < PJ_MAX_L2MEAS_EVT; idx++)
2081 if(gCb->u.dlCb->pjL2Cb.pjMeasEvtCb[idx] != NULLP)
2083 measEvtCb = gCb->u.dlCb->pjL2Cb.pjMeasEvtCb[idx];
2084 pjStopTmr((PTR)measEvtCb, PJ_EVT_L2_TMR);
2085 gCb->u.dlCb->pjL2Cb.pjNumMeas--;
2086 PJ_FREE(gCb,measEvtCb, sizeof(PjL2MeasEvtCb));
2087 gCb->u.dlCb->pjL2Cb.pjMeasEvtCb[idx] = NULLP;
2091 ret = pjDbmDlDeInit(gCb);
2092 #if (ERRCLASS & ERRCLS_DEBUG)
2095 RLOG0(L_FATAL, "PDCP DL DeInitialization Failed.");
2097 #endif /* ERRCLASS & ERRCLS_DEBUG */
2100 /* commented this to use in deregister timer and kwusap */
2101 /* gCb->init.cfgDone &= ~PJ_LMM_GENCFG_DONE; */
2109 * Handler to free a PDCP Control Block.
2113 * This function frees the txBuf and rxBuf in a PDCP control block.
2114 * and closes the compression channel opened. It stops the timers
2115 * of this control block if they are running.
2117 * @param[in] pst Post structure
2118 * @param[in] secCxt Context for Integrity protection/verification
2119 * @param[in] ctxId Integrity Context Id
2128 PUBLIC Void pjUtlDlFreeRb
2134 PUBLIC Void pjUtlDlFreeRb(pjRbCb)
2140 RLOG0(L_DEBUG, "pjUtlFreeRb()");
2143 #if (defined(PJ_SEC_ASYNC) || defined (PJ_CMP_ASYNC))
2144 if (pjRbCb->dlCb.obdTmr.tmrEvnt == PJ_EVT_DL_OBD_TMR)
2146 pjStopTmr(gCb,(PTR)pjRbCb, PJ_EVT_DL_OBD_TMR);
2150 pjUtlCmpClose(gCb,pjRbCb->cmpCxtId);
2151 /*pj004.201 Adding of Missing Trace in LTE RLC PDCP*/
2155 /* pj005.201 added function to send data forward indication message */
2160 * Handler to send Data Fwd Indication
2163 * This function sends Data Fwd Indication message to PDCP user
2165 * @param[in] pjRbCb PDCP RbCb
2166 * @param[in] datFwdInd Data forward indication
2175 PUBLIC S16 pjUtlDlSndDatFwdInd
2179 PjuDatFwdIndInfo *datFwdInd
2182 PUBLIC S16 pjUtlDlSndDatFwdInd(pjRbCb, datFwdInd)
2185 PjuDatFwdIndInfo *datFwdInd;
2188 CmLtePdcpId *pdcpId;
2191 TRC3(pjUtlDlSndDatFwdInd)
2193 RLOG0(L_DEBUG, "pjUtlSndDatFwdInd()");
2195 pjuSap = &(gCb->u.dlCb->pjuSap[PJ_DRB_SAP]);
2196 CmLtePdcpId pdcpIdTmp;
2197 pdcpId = &pdcpIdTmp;
2201 pdcpId->ueId = pjRbCb->ueCb->key.ueId;
2202 pdcpId->cellId = pjRbCb->ueCb->key.cellId;
2203 pdcpId->rbId = pjRbCb->rbId;
2204 pdcpId->rbType = pjRbCb->rbType;
2206 gCb->pjGenSts.numPktsFrwd += datFwdInd->numSdus;
2207 /* If trace flag is enabled send the trace indication */
2208 if(gCb->init.trc == TRUE)
2210 /* Populate the trace params */
2211 pjLmmSendTrc(gCb,EVTPJUDATFWDIND, NULLP);
2213 PjUiPjuDatFwdInd(&(pjuSap->pst), pjuSap->suId, pdcpId, datFwdInd);
2218 }/* end of pjUtlSndDatFwdInd */
2220 /* pj005.201 added support for L2 Measurement */
2224 * @brief Function to initialise measurement
2228 * @param[in] gCb PDCP Instance Control Block
2233 S16 pjUtlL2MeasDlInit(PjCb *gCb)
2237 gCb->u.dlCb->pjL2Cb.pjNumMeas=0;
2238 for(cntr = 0; cntr < LPJ_MAX_L2MEAS; cntr++)
2240 cmMemset((U8 *)&(gCb->u.dlCb->pjL2Cb.pjL2EvtCb[cntr]), 0, sizeof(PjL2MeasEvtCb));
2242 gCb->u.dlCb->pjL2Cb.pjL2EvtCb[0].measCb.measType = LPJ_L2MEAS_DL_DISC;
2249 * @brief Handler for sending L2 Measurement report
2253 * @param[in] gCb PDCP Instance Control Block.
2254 * @param[in] measEvtCb Measurement Event Control Block.
2262 PUBLIC S16 pjUtlSndDlL2MeasCfm
2265 PjL2MeasEvtCb *measEvtCb
2268 PUBLIC S16 pjUtlSndDlL2MeasCfm(measEvtCb)
2270 PjL2MeasEvtCb *measEvtCb;
2274 PjL2MeasCfmEvt measCfmEvt;
2277 TRC3(pjUtlSndDlL2MeasCfm)
2279 measCb = &measEvtCb->measCb;
2280 cmMemset((U8*)&measCfmEvt, 0, sizeof(PjL2MeasCfmEvt));
2282 measCfmEvt.measType = measCb->measType;
2283 measCfmEvt.status.status = LCM_PRIM_OK;
2284 measCfmEvt.status.reason = LCM_REASON_NOT_APPL;
2285 for(qciIdx = 0; qciIdx < (LPJ_MAX_QCI-1); qciIdx++)
2287 measCfmEvt.measCfm[measCfmEvt.numQciCfm].qci = measCb->qci[qciIdx];
2288 if(measCfmEvt.measCfm[measCfmEvt.numQciCfm].qci > 0)
2290 if((measCb->measType & LPJ_L2MEAS_DL_DISC) &&
2291 (measCb->measData[measCb->qci[qciIdx]].dlDisc.numPkts > 0))
2293 /* dlDisc = num of Pkts Discarded * 10^6 / total no of pkts. */
2294 measCfmEvt.measCfm[measCfmEvt.numQciCfm].dlDisc =
2295 measCb->measData[measCb->qci[qciIdx]].dlDisc.val * (1000000) /
2296 measCb->measData[measCb->qci[qciIdx]].dlDisc.numPkts;
2297 /* Reset the counters */
2298 measCb->measData[measCb->qci[qciIdx]].dlDisc.val = 0;
2299 measCb->measData[measCb->qci[qciIdx]].dlDisc.numPkts =0;
2301 measCfmEvt.numQciCfm++;
2305 /* Send Measurement confirmation to layer manager */
2306 PjMiLpjL2MeasCfm(&gCb->pjGenCfg.lmPst,&measCfmEvt);
2313 * @brief Validates the measurement request parameters.
2317 * Function :pjUtlValidateL2Meas
2319 * @param[in] PjL2MeasReqEvt measReqEvt
2320 * @param[out] PjL2MeasCfmEvt measCfmEvt
2324 * @brief Handler for resetting the DL measurement counters
2326 * Function :pjUtlResetDlL2MeasCntr
2330 * @param[in] measCb Measurement Control Block.
2337 PUBLIC Void pjUtlResetDlL2MeasCntr
2344 PUBLIC Void pjUtlResetDlL2MeasCntr(gCb, measCb, measType)
2350 /* for now the only meas should be DL discard in this case */
2351 if (measCb->measType & LPJ_L2MEAS_DL_DISC)
2354 for(i = 0; i < (LPJ_MAX_QCI - 1); i++)
2356 U8 qciVal = measCb->qci[i];
2358 measCb->measData[qciVal].dlDisc.val = 0;
2359 measCb->measData[qciVal].dlDisc.numPkts = 0;
2360 gCb->u.dlCb->pjL2Cb.measOn[qciVal] &= ~LPJ_L2MEAS_DL_DISC;
2369 * @brief Handler for storing address of MeasData in rbCb at right index
2373 * This function is called when LM sends measReq message to RLC.
2384 PUBLIC Void pjUtlPlcMeasDatInDlL2Sts
2387 PjL2MeasRbCb *rbL2Cb,
2391 PUBLIC Void pjUtlPlcMeasDatInDlL2Sts(measData, rbL2Cb, measType)
2393 PjL2MeasRbCb *rbL2Cb;
2397 TRC3(pjUtlPlcMeasDatInDlL2Sts)
2399 /* We should check the number of measType in the request. This can be done
2400 * by looking at each bit in the measType. Also store the measData in the
2401 * correct index of l2Sts in RbCb.
2404 if(measType & LPJ_L2MEAS_DL_DISC)
2406 rbL2Cb->l2Sts[PJ_L2MEAS_DL_DISC] = measData;
2409 }/* End of pjUtlPlcMeasDatInDlL2Sts */
2410 #endif /* LTE_L2_MEAS */
2412 void dumpPDCPDlRbInformation(PjDlRbCb* dlRbCb, U16 ueId)
2414 PjDlCb* dlCb = &dlRbCb->dlCb;
2415 RLOG_ARG1(L_INFO,DBG_UEID,ueId, "PDCP DL RB numEntries = %lu",
2416 dlCb->txBuf.numEntries);
2418 RTLIN_DUMP_DEBUG("UE [%u] PDCP DL RB numEntries = %lu",
2419 ueId, dlCb->txBuf.numEntries);
2421 RTLIN_DUMP_DEBUG("UE [%u] PDCP DL RB numEntries = %u",
2422 ueId, dlCb->txBuf.numEntries);
2426 void DumpPDCPDlDebugInformation(void)
2428 #ifndef RGL_SPECIFIC_CHANGES
2429 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
2430 void *iccHdl = NULLP;
2431 U32 poolZeroFreeCnt;
2434 U32 poolThreeFreeCnt;
2437 PjCb* dlInst = pjCb[1]; /* TODO: check whether DL is 0 or 1 */
2438 PjDlgCb* dlgCb = dlInst->u.dlCb;
2440 PjDlUeCb *ueCb = NULLP;
2441 RLOG0(L_INFO,"PDCP DL Information");
2442 RLOG0(L_INFO,"===================");
2443 RTLIN_DUMP_DEBUG("PDCP DL Information\n");
2444 RTLIN_DUMP_DEBUG("===================\n");
2445 /* Until no more ueCb is ueLstCp hash list get and delete ueCb */
2446 while (ROK == cmHashListGetNext(&dlgCb->ueLstCp,
2451 for(i = 0; i < PJ_MAX_SRB_PER_UE; i++)
2453 PjDlRbCb* rbCb = ueCb->srbCb[i];
2456 dumpPDCPDlRbInformation(rbCb, ueCb->key.ueId);
2459 for(i = 0; i < PJ_MAX_DRB_PER_UE; i++)
2461 PjDlRbCb* rbCb = ueCb->drbCb[i];
2464 dumpPDCPDlRbInformation(rbCb, ueCb->key.ueId);
2468 /*printing ICC memory statistics*/
2469 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
2470 iccHdl = ssGetIccHdl(dlInst->init.region);
2473 poolZeroFreeCnt = TL_GetFreeBlocks(iccHdl, ICC_POOL_ZERO_SIZE);
2474 poolOneFreeCnt = TL_GetFreeBlocks(iccHdl, ICC_POOL_ONE_SIZE);
2475 poolTwoFreeCnt = TL_GetFreeBlocks(iccHdl, ICC_POOL_TWO_SIZE);
2476 poolThreeFreeCnt = TL_GetFreeBlocks(iccHdl, ICC_POOL_THREE_SIZE);
2477 RLOG1(L_ALWAYS,"ICC pool zero free count = %lu", poolZeroFreeCnt);
2478 RLOG1(L_ALWAYS,"ICC pool one free count = %lu", poolOneFreeCnt);
2479 RLOG1(L_ALWAYS,"ICC pool two free count = %lu", poolTwoFreeCnt);
2480 RLOG1(L_ALWAYS,"ICC pool three free count = %lu", poolThreeFreeCnt);
2481 RTLIN_DUMP_DEBUG("ICC pool zero free count = %lu\n", poolZeroFreeCnt);
2482 RTLIN_DUMP_DEBUG("ICC pool one free count = %lu\n", poolOneFreeCnt);
2483 RTLIN_DUMP_DEBUG("ICC pool two free count = %lu\n", poolTwoFreeCnt);
2484 RTLIN_DUMP_DEBUG("ICC pool three free count = %lu\n", poolThreeFreeCnt);
2487 RLOG1(L_ALWAYS,"SPACC cipher Q num of entry = %lu ", pjMsCiphQ.count);
2488 RLOG1(L_ALWAYS,"SPACC decipher Q num of entry = %lu ", pjMsDeCiphQ.count);
2489 RTLIN_DUMP_DEBUG("SPACC cipher Q num of entry = %lu \n", pjMsCiphQ.count);
2490 RTLIN_DUMP_DEBUG("SPACC decipher Q num of entry = %lu \n", pjMsDeCiphQ.count);
2495 PUBLIC Void pjUtlEmptyDlPktList(PjCb *gCb, PjDlRbCb *pjRbCb)
2498 CmLListCp *ulPktLst = &pjRbCb->dlCb.dlPktQ;
2499 while(ulPktLst->first)
2501 ulPkt = (PjDlPkt *)(ulPktLst->first->node);
2502 cmLListDelFrm(ulPktLst, ulPktLst->first);
2503 PJ_FREE_BUF(ulPkt->pdu);
2504 #ifdef FLAT_BUFFER_OPT
2505 PJ_FREE_FLAT_BUF(gCb, &(ulPkt->fb))
2507 PJ_FREE(gCb, ulPkt, sizeof(PjDlPkt));
2512 void ResetPDCPStats(void)
2514 cmMemset((U8*)&gPdcpStats, 0, sizeof(PDCPStats));
2518 void PrintPDCPStats(void)
2520 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
2522 #ifdef XEON_SPECIFIC_CHANGES
2523 RLOG3(L_INFO,"PDCP Stats: SDUs Dropped = (%ld),SDUs Queued for SPAcc Cipher = (%ld),"
2525 gPdcpStats.numPdcpSdusDiscarded, pjMsCiphQ.count, pjMsDeCiphQ.count);
2527 RLOG3(L_INFO,"PDCP Stats: SDUs Dropped = (%ld),SDUs Queued for SPAcc Cipher = (%ld),"
2529 gPdcpStats.numPdcpSdusDiscarded, pjMsDlSpaccQCnt, pjMsUlSpaccQCnt);
2531 #ifdef XEON_SPECIFIC_CHANGES
2532 if((gPdcpStats.numPdcpSdusDiscarded > 0) || (pjMsCiphQ.count > 0) || (pjMsDeCiphQ.count > 0) )
2534 RTLIN_DUMP_DEBUG("PDCP Stats: SDUs Dropped = (%d),"
2535 "SDUs Queued for SPAcc Cipher = (%d), Decipher = (%d) \n",
2536 gPdcpStats.numPdcpSdusDiscarded, pjMsCiphQ.count, pjMsDeCiphQ.count); /* UDAY */
2539 RTLIN_DUMP_DEBUG("PDCP Stats: SDUs Dropped = (%ld),"
2540 "SDUs Queued for SPAcc Cipher = (%ld), Decipher = (%ld) Rb Overload DROP = (%ld) dbgPdcpQSizeThreshHoldDropCnt is (%ld) MmThredHldDrp (%ld) spaccQDropCnt (%ld) dlSpaccPktDrop %ld\n",
2541 gPdcpStats.numPdcpSdusDiscarded, pjMsDlSpaccQCnt, pjMsUlSpaccQCnt,dbgPdcpMemCount,dbgPdcpQSizeThreshHoldDropCnt,pdcpdrop, dbgSpaccThreshHoldDropCnt,spaccDropCount); /* UDAY */
2543 dbgPdcpQSizeThreshHoldDropCnt=0;
2552 void PrintPDCPStats(void)
2554 printf ("\n============================== PDCP STATS ===========================\n");
2555 RTLIN_DUMP_DEBUG("SDUs Dropped = (%u) No of Reodering Tmr Exp (%u)",
2556 gPdcpStats.numPdcpSdusDiscarded, gPdcpStats.numPdcpCellReorderTmrExp);
2561 PRIVATE S16 pjUtlDlHdlSecInitCfm
2563 PjCb *gCb, /* Pointer to PJ DL Control Block */
2564 PjDlUeCb *ueCb, /* Pointer to UeCb */
2565 U16 txIdx, /* Transaction Index for UeCb */
2566 PjAsyncCfm *asyncCfm,
2567 UdxSecCfgCfmInfo *secCfgCfm, /* Security config confirm */
2568 UdxReEstCfmInfo *reEstCfm /* Reest config confirm */
2571 PRIVATE S16 pjUtlDlHdlSecInitCfm(gCb,ueCb,txIdx,secCfgCfm,reEstCfm)
2573 PjCb *gCb; /* Pointer to PJ DL Control Block */
2574 PjDlUeCb *ueCb; /* Pointer to UeCb */
2575 U16 txIdx; /* Transaction Index for UeCb */
2576 PjAsyncCfm *asyncCfm;
2577 UdxSecCfgCfmInfo *secCfgCfm; /* Security config confirm */
2578 UdxReEstCfmInfo *reEstCfm; /* Reest config confirm */
2582 PjUdxDlSapCb *udxSap;
2585 TRC3(pjUtlDlHdlSecInitCfm)
2587 if(asyncCfm->libInitBitMask == 0)
2589 PJ_CHK_RESTART_OBD_TIMER(gCb,ueCb, txIdx);
2590 if(ueCb->libInfo.state == PJ_STATE_NORMAL)
2592 /* Send security config confirm */
2593 /* Memory leak fix ccpu00135359 */
2594 udxSap = &(gCb->u.dlCb->udxDlSap[0]);
2595 PJ_ALLOC_BUF_SHRABL(udxSap->pst,secCfgCfm,
2596 sizeof (UdxSecCfgCfmInfo), ret);
2599 RLOG0(L_FATAL, "Memory Allocation failed.");
2602 PJ_FILL_SEC_CFM_INFO(secCfgCfm, asyncCfm);
2604 PJ_CLEAN_AND_UPD_ASYNCINFO(gCb,ueCb, txIdx);
2606 PjDlUdxSecCfgCfm(&gCb->u.dlCb->udxDlSap[0].pst,
2607 gCb->u.dlCb->udxDlSap[0].suId,
2608 (UdxSecCfgCfmInfo *) secCfgCfm);
2610 else if(ueCb->libInfo.state == PJ_STATE_REEST)
2613 /* Memory leak fix ccpu00135359 */
2614 udxSap = &(gCb->u.dlCb->udxDlSap[0]);
2615 PJ_ALLOC_BUF_SHRABL(udxSap->pst,reEstCfm,
2616 sizeof (UdxReEstCfmInfo), ret);
2619 RLOG0(L_FATAL, "Memory Allocation failed.");
2622 PJ_FILL_REEST_CFM_INFO(reEstCfm, asyncCfm, LCM_PRIM_OK);
2624 /* Some house keeping work */
2625 PJ_CLEAN_AND_UPD_ASYNCINFO(gCb,ueCb, txIdx);
2627 PjDlUdxReEstCfm(&gCb->u.dlCb->udxDlSap[0].pst,
2628 gCb->u.dlCb->udxDlSap[0].suId, reEstCfm);
2630 pjUtlReEstDl(gCb, ueCb);
2638 PRIVATE S16 pjUtlDlHdlCmpInitCfm
2640 PjCb *gCb, /* Pointer to PJ DL Control Block */
2641 PjDlUeCb *ueCb, /* Pointer to UeCb */
2642 U16 txIdx, /* Transaction Index for UeCb */
2643 PjAsyncCfm *asyncCfm, /* Async Confirm */
2644 UdxCfgCfmInfo *cfgCfm /* UDX Config Confirm */
2647 PRIVATE S16 pjUtlDlHdlCmpInitCfm(gCb,ueCb,txIdx,asyncCfm,cfgCfm)
2649 PjCb *gCb; /* Pointer to PJ DL Control Block */
2650 PjDlUeCb *ueCb; /* Pointer to UeCb */
2651 U16 txIdx; /* Transaction Index for UeCb */
2652 PjAsyncCfm *asyncCfm; /* Async Confirm */
2653 UdxCfgCfmInfo *cfgCfm; /* UDX Config Confirm */
2657 PjUdxDlSapCb *udxSap;
2660 TRC3(pjUtlDlHdlCmpInitCfm)
2662 asyncCfm->libInitBitMask ^= (PJ_LIB_COMP_BIT_MASK);
2664 if((asyncCfm->libInitBitMask == 0) &&
2665 !(asyncCfm->cfmType & PJ_CFG_REEST_ASYNC_CFM))
2668 /* Send config confirm */
2669 /* Memory leak fix ccpu00135359 */
2670 udxSap = &(gCb->u.dlCb->udxDlSap[0]);
2671 PJ_ALLOC_BUF_SHRABL(udxSap->pst,cfgCfm,
2672 sizeof (UdxCfgCfmInfo), ret);
2675 RLOG0(L_FATAL, "Memory Allocation failed.");
2678 cfgCfm->transId = asyncCfm->transId;
2679 cfgCfm->ueId = asyncCfm->ueId;
2680 cfgCfm->cellId = asyncCfm->cellId;
2681 cfgCfm->numEnt = asyncCfm->numEnt;
2682 for ( idx = 0; idx < asyncCfm->numEnt; idx++ )
2684 cfgCfm->cfmEnt[idx].status = asyncCfm->cfmEnt[idx].status;
2685 cfgCfm->cfmEnt[idx].reason = asyncCfm->cfmEnt[idx].reason;
2686 cfgCfm->cfmEnt[idx].rbId = asyncCfm->cfmEnt[idx].rbId;
2687 cfgCfm->cfmEnt[idx].rbType = asyncCfm->cfmEnt[idx].rbType;
2690 /* Some house keeping work */
2691 PJ_CHK_RESTART_OBD_TIMER(gCb,ueCb, txIdx);
2692 PJ_CLEAN_AND_UPD_ASYNCINFO(gCb,ueCb, txIdx);
2694 /* Send confirmtion to the User */
2695 PjDlUdxCfgCfm(&(gCb->u.dlCb->udxDlSap[0].pst),
2696 gCb->u.dlCb->udxDlSap[0].suId,
2697 (UdxCfgCfmInfo *)cfgCfm);
2707 #endif /* __cplusplus */
2708 /********************************************************************30**
2710 **********************************************************************/