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:
40 **********************************************************************/
41 static const char* RLOG_MODULE_NAME="PDCP";
42 static int RLOG_MODULE_ID=1024;
43 static int RLOG_FILE_ID=231;
45 @brief PDCP Utility Module
48 /* header (.h) include files */
49 #include "envopt.h" /* environment options */
50 #include "envdep.h" /* environment dependent */
51 #include "envind.h" /* environment independent */
53 #include "gen.h" /* general */
54 #include "ssi.h" /* system services */
55 #include "cm5.h" /* common timer defines */
56 #include "cm_tkns.h" /* common tokens defines */
57 #include "cm_mblk.h" /* common memory allocation library defines */
58 #include "cm_llist.h" /* common link list defines */
59 #include "cm_hash.h" /* common hash list defines */
60 #include "cm_lte.h" /* common LTE defines */
61 #include "cpj.h" /* CPJ defines */
62 #include "pju.h" /* PJU defines */
63 #include "lpj.h" /* LPJ defines */
65 #include "pj_env.h" /* RLC environment options */
66 #include "pj.h" /* RLC defines */
69 #include "pj_err.h" /* Error defines */
71 /* extern (.x) include files */
72 #include "gen.x" /* general */
73 #include "ssi.x" /* system services */
75 #include "cm5.x" /* common timer library */
76 #include "cm_tkns.x" /* common tokens */
77 #include "cm_mblk.x" /* common memory allocation */
78 #include "cm_llist.x" /* common link list */
79 #include "cm_hash.x" /* common hash list */
80 #include "cm_lte.x" /* common LTE includes */
81 #include "cm_lib.x" /* common memory allocation library */
82 #include "cpj.x" /* CPJ */
83 #include "pju.x" /* PJU */
84 #include "lpj.x" /* LPJ */
86 #include "pj_udx.h" /* LIB */
87 #include "pj_udx.x" /* LIB */
91 #include "pj_lib.x" /* LIB */
95 #endif /* __cplusplus */
97 /** @addtogroup dldata */
101 /********************************************************************
102 * Input Handler from Offboarding unit *
103 *******************************************************************/
108 * Asynchronous handler to received that Init Confirm for
109 * compression for the offboarding unit.
113 * This function gets the context Id passed as the parameter and stores it
116 * @param[in] pst Post structure
117 * @param[in] cmpCxt Context for ROHC
118 * @param[in] ctxId Context Id
125 PUBLIC S16 PjLibObdCmpInitCfm
127 Pst *pst, /* post structure */
128 PjCmpCxt cmpCxt, /* Context for ROHC */
129 PTR ctxId /* Compression Context ID */
132 PUBLIC S16 PjLibObdCmpInitCfm(pst, cmpCxt, ctxId)
133 Pst *pst; /* post structure */
134 PjCmpCxt cmpCxt; /* Context for ROHC */
135 PTR ctxId; /* Compression Context ID */
140 TRC3(PjLibObdCmpInitCfm);
142 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
147 tPjCb = PJ_GET_PJCB(pst->dstInst);
149 RLOG4(L_DEBUG, "PjLibObdCmpInitCfm(pst, cmpCxt(%d,%d,%d,%d)"
150 cmpCxt.ueId, cmpCxt.rbId, cmpCxt.rbType, cmpCxt.cfgTxId);
151 RLOG1(L_DEBUG ," ctxId(%ld))",ctxId);
153 if (!(tPjCb->init.cfgDone & PJ_LMM_GENCFG_DONE))
158 if (tPjCb->pjGenCfg.mode == LPJ_MODE_PDCP_UL)
160 PjUlUeCb *ueCb = NULLP; /* UeCb control block */
161 PjUlRbCb *pjRbCb = NULLP; /* PDCP RB control block */
163 pjDbmFetchUlUeCb(tPjCb,cmpCxt.ueId, cmpCxt.cellId, &ueCb);
166 RLOG_ARG1(L_ERROR, DBG_CELLID, cmpCxt.cellId,"UL UeId[%u] not found",
171 pjDbmFetchPjUlRbCb(ueCb, cmpCxt.rbId, cmpCxt.rbType,&pjRbCb);
174 RLOG_ARG2(L_ERROR, DBG_UEID,cmpCxt.ueId,"CellId[%u]: UL RbId[%d] not found",
175 cmpCxt.cellId, cmpCxt.rbId);
179 pjRbCb->cmpCxtId = ctxId;
181 /* Check if all confirms have been received */
182 pjUtlUlHdlObdInitCfm(tPjCb,ueCb, cmpCxt.cfgTxId, PJ_CMP_INIT_CFM, cmpCxt.rbId);
186 PjDlUeCb *ueCb = NULLP; /* UeCb control block */
187 PjDlRbCb *pjRbCb = NULLP; /* PDCP RB control block */
189 pjDbmFetchDlUeCb(tPjCb,cmpCxt.ueId, cmpCxt.cellId, &ueCb);
192 RLOG_ARG1(L_ERROR, DBG_CELLID, cmpCxt.cellId,"DL UeId[%u] not found",
197 pjDbmFetchPjDlRbCb(ueCb, cmpCxt.rbId, cmpCxt.rbType,&pjRbCb);
200 RLOG_ARG2(L_ERROR, DBG_UEID,cmpCxt.ueId, "CellId[%u]: DL RbId[%d] not found",
201 cmpCxt.cellId, cmpCxt.rbId);
205 pjRbCb->cmpCxtId = ctxId;
207 /* Check if all confirms have been received */
208 pjUtlDlHdlObdInitCfm(tPjCb,ueCb, cmpCxt.cfgTxId, PJ_CMP_INIT_CFM, cmpCxt.rbId);
214 } /* end of PjLibObdCmpInitCfm */
215 #endif /* PJ_SEC_ASYNC */
222 * Asynchronous handler to received that Init Confirm for
223 * Integrity for the offboarding unit.
227 * This function gets the context Id passed as the parameter and stores it
230 * @param[in] pst Post structure
231 * @param[in] secCxt Context for Integrity protection/verification
232 * @param[in] ctxId Integrity Context Id
240 PUBLIC S16 PjLibObdIntInitCfm
242 Pst *pst, /* post structure */
243 PjSecCxt secCxt, /* Secutiry Context */
244 PTR ctxId /* Integrity Context ID */
247 PUBLIC S16 PjLibObdIntInitCfm(pst, secCxt, ctxId)
248 Pst *pst; /* post structure */
249 PjSecCxt secCxt; /* Secutriy Context */
250 PTR ctxId; /* Integrity Context ID */
255 TRC3(PjLibObdIntInitCfm)
257 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
262 tPjCb = PJ_GET_PJCB(pst->dstInst);
265 RLOG4(L_DEBUG, "PjLibObdCmpInitCfm(pst, secCxt(%d,%d,%d), ctxId(%ld))",
266 secCxt.cellId, secCxt.ueId, secCxt.cfgTxId, ctxId);
268 if (!(tPjCb->init.cfgDone & PJ_LMM_GENCFG_DONE))
273 if (tPjCb->pjGenCfg.mode == LPJ_MODE_PDCP_UL)
275 PjUlUeCb *ueCb = NULLP; /* UeCb control block */
278 pjDbmFetchUlUeCb(tPjCb, secCxt.ueId, secCxt.cellId, &ueCb);
281 RLOG_ARG1(L_ERROR, DBG_CELLID, secCxt.cellId,"UL UeId[%u] not found",
286 /* Update context Id */
287 ueCb->secInfo.intCxtId = ctxId;
289 pjUtlUlHdlObdInitCfm(tPjCb, ueCb, secCxt.cfgTxId, PJ_SEC_INIT_CFM,
290 PJ_LIB_INT_BIT_MASK);
294 PjDlUeCb *ueCb = NULLP; /* UeCb control block */
297 pjDbmFetchDlUeCb(tPjCb, secCxt.ueId, secCxt.cellId, &ueCb);
300 RLOG_ARG1(L_ERROR, DBG_CELLID, secCxt.cellId,"DL UeId[%u] not found",
305 /* Update context Id */
306 ueCb->secInfo.intCxtId = ctxId;
308 pjUtlDlHdlObdInitCfm(tPjCb, ueCb, secCxt.cfgTxId, PJ_SEC_INIT_CFM,
309 PJ_LIB_INT_BIT_MASK);
314 } /* end of PjLibObdIntInitCfm */
320 * Asynchronous handler to received that Init Confirm for
321 * Ciphering Cp Key for the offboarding unit.
325 * This function gets the context Id passed as the parameter and stores it
328 * @param[in] pst Post structure
329 * @param[in] secCxt Context for Ciphering
330 * @param[in] ctxId Ciphering CP Context Id
337 PUBLIC S16 PjLibObdCpInitCfm
339 Pst *pst, /* post structure */
340 PjSecCxt secCxt, /* Secutiry Context */
341 PTR ctxId /* Ciphering Context ID */
344 PUBLIC S16 PjLibObdCpInitCfm(pst, secCxt, ctxId)
345 Pst *pst; /* post structure */
346 PjSecCxt secCxt; /* Secutriy Context */
347 PTR ctxId; /* Ciphering Context ID */
352 TRC3(PjLibObdCpInitCfm);
354 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
359 tPjCb = PJ_GET_PJCB(pst->dstInst);
362 RLOG4(L_DEBUG, "PjLibObdCpInitCfm(pst, secCxt(%d,%d,%d), ctxId(%ld))",
363 secCxt.cellId, secCxt.ueId, secCxt.cfgTxId, ctxId);
365 if (!(tPjCb->init.cfgDone & PJ_LMM_GENCFG_DONE))
370 if (tPjCb->pjGenCfg.mode == LPJ_MODE_PDCP_UL)
372 PjUlUeCb *ueCb = NULLP; /* UeCb control block */
374 pjDbmFetchUlUeCb(tPjCb, secCxt.ueId, secCxt.cellId, &ueCb);
377 RLOG_ARG1(L_ERROR, DBG_CELLID, secCxt.cellId,"UL UeId[%u] not found",
382 ueCb->secInfo.cpCxtId = ctxId;
384 /* Update bit mask and check if all confirms have been received */
385 pjUtlUlHdlObdInitCfm(tPjCb, ueCb, secCxt.cfgTxId, PJ_SEC_INIT_CFM,
386 (U8)PJ_LIB_CP_CIP_BIT_MASK);
390 PjDlUeCb *ueCb = NULLP; /* UeCb control block */
392 pjDbmFetchDlUeCb(tPjCb, secCxt.ueId, secCxt.cellId, &ueCb);
395 RLOG_ARG1(L_ERROR, DBG_CELLID, secCxt.cellId,"DL UeId[%u] not found",
400 ueCb->secInfo.cpCxtId = ctxId;
402 /* Update bit mask and check if all confirms have been received */
403 pjUtlDlHdlObdInitCfm(tPjCb, ueCb, secCxt.cfgTxId, PJ_SEC_INIT_CFM,
404 (U8)PJ_LIB_CP_CIP_BIT_MASK);
408 } /* end of PjLibObdCpInitCfm */
414 * Asynchronous handler to received that Init Confirm for
415 * Ciphering Up Key for the offboarding unit.
419 * This function gets the context Id passed as the parameter and stores it
422 * @param[in] pst Post structure
423 * @param[in] secCxt Context for Ciphering
424 * @param[in] ctxId Ciphering UP Context Id
431 PUBLIC S16 PjLibObdUpInitCfm
433 Pst *pst, /* post structure */
434 PjSecCxt secCxt, /* Secutiry Context */
435 PTR ctxId /* Ciphering Context ID */
438 PUBLIC S16 PjLibObdUpInitCfm(pst, secCxt, ctxId)
439 Pst *pst; /* post structure */
440 PjSecCxt secCxt; /* Secutriy Context */
441 PTR ctxId; /* Ciphering Context ID */
446 TRC3(PjLibObdUpInitCfm);
448 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
453 tPjCb = PJ_GET_PJCB(pst->dstInst);
455 RLOG4(L_DEBUG, "PjLibObdUpInitCfm(pst, secCxt(%d,%d,%d), ctxId(%ld))",
456 secCxt.cellId, secCxt.ueId, secCxt.cfgTxId, ctxId);
458 if (!(tPjCb->init.cfgDone & PJ_LMM_GENCFG_DONE))
463 if (tPjCb->pjGenCfg.mode == LPJ_MODE_PDCP_UL)
465 PjUlUeCb *ueCb = NULLP; /* UeCb control block */
467 pjDbmFetchUlUeCb(tPjCb, secCxt.ueId, secCxt.cellId, &ueCb);
470 RLOG_ARG1(L_ERROR, DBG_CELLID, secCxt.cellId,"UL UeId[%u] not found",
475 ueCb->secInfo.upCxtId = ctxId;
477 /* Update bit mask and check if all confirms have been received */
478 pjUtlUlHdlObdInitCfm(tPjCb, ueCb, secCxt.cfgTxId, PJ_SEC_INIT_CFM,
479 (U8)PJ_LIB_UP_CIP_BIT_MASK);
483 PjDlUeCb *ueCb = NULLP; /* UeCb control block */
485 pjDbmFetchDlUeCb(tPjCb, secCxt.ueId, secCxt.cellId, &ueCb);
488 RLOG_ARG1(L_ERROR, DBG_CELLID, secCxt.cellId,"DL UeId[%u] not found",
493 ueCb->secInfo.upCxtId = ctxId;
495 /* Update bit mask and check if all confirms have been received */
496 pjUtlDlHdlObdInitCfm(tPjCb, ueCb, secCxt.cfgTxId, PJ_SEC_INIT_CFM,
497 (U8)PJ_LIB_UP_CIP_BIT_MASK);
502 } /* end of PjLibObdUpInitCfm */
504 #endif /* PJ_SEC_ASYNC */
511 * Asynchronous handler to receive the compressed SDU from off-board
516 * This function receives an output from compression unit and
517 * sends the same for ciphering with relevant input paramenters.
519 * @param[in] pst Post structure
520 * @param[in] cmpCxtId Context Id for compression
521 * @param[in] libTrans Transaction Id
522 * @param[in] opSdu compressed SDU
530 PUBLIC S16 PjLibObdCmpCfm
532 Pst *pst, /* post structure */
533 PTR cmpCxtId, /* Context Id for compression */
534 PjLibTrans libTrans, /* Transaction Id */
535 Buffer *opSdu /* compressed SDU */
538 PUBLIC S16 PjLibObdCmpCfm(pst, cmpCxtId, libTrans, opSdu)
539 Pst *pst; /* post structure */
540 PTR cmpCxtId; /* Context Id for compression */
541 PjLibTrans libTrans; /* Transaction Id */
542 Buffer *opSdu; /* compressed SDU */
549 U32 macI; /* MAC-I value to be padded to the PDU */
550 /* pj005.201 ccpu00114955 corrected the RB ID calculation */
555 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
560 tPjCb = PJ_GET_PJCB(pst->dstInst);
563 RLOG4(L_DEBUG, "PjLibObdCmpCfm(pst, cmpCxtId(%ld), libTrans(%d,%d,%d))",
564 cmpCxtId, libTrans.rbId, libTrans.rbType, libTrans.count);
566 RLOG4(L_DEBUG, "PjLibObdCmpCfm(pst, cmpCxtId(%ld), libTrans(%d,%d,%ld))",
567 cmpCxtId, libTrans.rbId, libTrans.rbType, libTrans.count);
570 /* If PDCP Layer is not configured and recieved message from Off-board, then
571 * clean the resources recieved and return RFAILED.
572 * Else proceed with processing.*/
573 if (!(tPjCb->init.cfgDone & PJ_LMM_GENCFG_DONE))
579 /* pj005.201 ccpu00114955 corrected the RB ID calculation */
580 rbId = libTrans.rbId + 1;
581 pjDbmFetchPjDlRbCb((PjDlUeCb*)libTrans.ueCb, rbId, libTrans.rbType,&pjRbCb);
582 if ( pjRbCb == NULLP )
584 RLOG_ARG2(L_ERROR, DBG_UEID,libTrans.ueId, "CellId[%u]: DL RbId[%d] not found",
585 libTrans.cellId, rbId);
590 if ( pjRbCb->state == PJ_STATE_REEST || pjRbCb->state == PJ_STATE_REEST_HO)
596 txEnt = pjDbmGetTxEnt(tPjCb,&(pjRbCb->dlCb.txBuf), libTrans.count);
597 if ( txEnt == NULLP )
599 RLOG1(L_ERROR, "txEnt not found for Cnt [%lu]", libTrans.count);
603 if ( opSdu == NULLP )
605 RLOG_ARG0(L_ERROR, DBG_RBID, rbId ,"Compression Failed , Count [%lu]", libTrans.count);
606 PJ_UPD_DL_VAR(tPjCb, pjRbCb, txEnt->count);
608 if ( pjRbCb->dlCb.cfmReqd)
610 PJ_SND_CFM(tPjCb,pjRbCb, txEnt, PJU_COMP_FAILED);
614 pjDbmDelTxEnt( tPjCb,&(pjRbCb->dlCb.txBuf), txEnt->count);
616 tPjCb->pjGenSts.numCmpFails++;
621 if(pjRbCb->ueCb->secInfo.intProtEnbForDrb)
624 PJ_PACK_MACI(txEnt->sdu, macI);
626 if ( pjRbCb->ueCb->secInfo.secAct )
628 ret = pjDlmHdlCiph(tPjCb,pjRbCb, txEnt);
631 RLOG_ARG0(L_ERROR, DBG_RBID, rbId ,"CipherReq Failed , Count [%lu]", libTrans.count);
638 ret = pjDlmDeliverPdu(tPjCb,pjRbCb, txEnt);
641 } /* end of PjLibObdCmpCfm */
647 * Asynchronous handler to receive the decompressed SDU from off-board
652 * This function receives an output from decompression unit and
653 * sends the SDU to upper layer in sequence.
655 * @param[in] pst post structure
656 * @param[in] cmpCxtId Context Id for decompression
657 * @param[in] libTrans Transaction Id
658 * @param[in] opSdu decompressed SDU
659 * @param[in] fbPkt Feedback Pkt
667 PUBLIC S16 PjLibObdDecmpCfm
669 Pst *pst, /* post structure */
670 PTR cmpCxtId, /* Context Id for decompression */
671 PjLibTrans libTrans, /* Transaction Id */
672 Buffer *opSdu, /* decompressed SDU */
673 Buffer *fbPkt /* Feedback pkt */
676 PUBLIC S16 PjLibObdDecmpCfm(pst, cmpCxtId, libTrans, opSdu, fbPkt)
677 Pst *pst; /* post structure */
678 PTR cmpCxtId; /* Context Id for decompression */
679 PjLibTrans libTrans; /* Transaction Id */
680 Buffer *opSdu; /* decompressed SDU */
681 Buffer *fbPkt; /* feedback Pkt */
689 /* pj005.201 ccpu00114955 corrected the RB ID calculation */
692 TRC2(PjLibObdDecmpCfm);
693 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
698 tPjCb = PJ_GET_PJCB(pst->dstInst);
701 RLOG4(L_DEBUG, "PjLibObdDecmpCfm(pst, cmpCxtId(%ld), libTrans(%d,%d,%d))",
702 cmpCxtId, libTrans.rbId, libTrans.rbType, libTrans.count);
704 RLOG4(L_DEBUG, "PjLibObdDecmpCfm(pst, cmpCxtId(%ld), libTrans(%d,%d,%ld))",
705 cmpCxtId, libTrans.rbId, libTrans.rbType, libTrans.count);
708 /* If PDCP Layer is not configured and recieved message from Off-board, then
709 * clean the resources recieved and return RFAILED.
710 * Else proceed with processing.*/
711 if (!(tPjCb->init.cfgDone & PJ_LMM_GENCFG_DONE))
718 /* 1. Initialisations */
719 /* pj005.201 ccpu00114955 corrected the RB ID calculation */
720 rbId = libTrans.rbId + 1;
721 pjDbmFetchPjUlRbCb((PjUlUeCb*)libTrans.ueCb, rbId, libTrans.rbType,&pjRbCb);
724 RLOG_ARG2(L_ERROR, DBG_UEID,libTrans.ueId, "CellId[%u]: UL RbId[%d] not found",
725 libTrans.cellId, rbId);
728 ulCb = &pjRbCb->ulCb;
730 /* 2. Send the feedback packet */
733 pjUtlUlSndUlRohcFdbk(tPjCb,pjRbCb,fbPkt);
737 /* 3. Get the rxEnt */
738 rxEnt = pjDbmGetRxEnt(tPjCb,&ulCb->recBuf, libTrans.count );
739 if((rxEnt == NULLP) || (rxEnt->state != PJ_SENT_TO_DCOMP))
741 /* We have got a duplicate .
742 * It is NULLP if the original has been sent up,
743 * Or, the original is in another state
744 * (if both are in the same state, we accept the
750 /* 4. check decompression status */
753 RLOG_ARG0(L_ERROR,DBG_RBID,rbId,"opSdu is NULLP");
755 PJ_SND_PJU_STA_IND(tPjCb,pjRbCb, rxEnt);
756 PJ_STS_INC_GEN_CNT(tPjCb,numDecmpFails);
757 pjUlmHdlErrUpdates(tPjCb,pjRbCb, rxEnt->count);
758 pjDbmDelRxEnt(tPjCb,&ulCb->recBuf, rxEnt->count);
762 /* 5. check for discardable entries */
763 if(rxEnt->discFlag == TRUE)
765 pjDbmDelRxEnt(tPjCb,&ulCb->recBuf, rxEnt->count);
770 /* 6. Post decomp updations */
771 rxEnt->state = PJ_RDY_TO_SUBMIT;
772 PJ_FREE_BUF(rxEnt->mBuf);
775 /* 7. Call the function to deliver the pdu*/
776 PJ_DEC_OBD_COUNT(tPjCb,pjRbCb, rxEnt->count);
777 PJ_ULM_DELIVER_DRB(tPjCb,pjRbCb, rxEnt);
780 } /* end of PjLibObdDecmpCfm */
782 #endif /* PJ_CMP_ASYNC */
789 * Asynchronous handler to receive the MAC-I from off-board
794 * This function receives an output, MAC-I from Integration unit and
795 * sends the data for ciphering with relevant input paramenters.
797 * @param[in] pst Post structure
798 * @param[in] cxtId Context Id for Integrity protection
799 * @param[in] libTrans Transaction Id
800 * @param[in] macI Message authentication code
808 PUBLIC S16 PjLibObdIntProtCfm
810 Pst *pst, /* post structure */
811 PTR cxtId, /* Context Id for Integrity protection*/
812 PjLibTrans libTrans, /* Transaction Id */
813 U32 macI /* Message authentication code */
816 PUBLIC S16 PjLibObdIntProtCfm(pst, cxtId, libTrans, macI)
817 Pst *pst; /* post structure */
818 PTR cxtId; /* Context Id for Integrity protection */
819 PjLibTrans libTrans; /* Transaction Id */
820 U32 macI; /* Message authentication code */
830 /* pj005.201 ccpu00114955 corrected the RB ID calculation */
833 TRC3(PjLibObdIntProtCfm)
834 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
839 tPjCb = PJ_GET_PJCB(pst->dstInst);
842 RLOG4(L_DEBUG, "PjLibObdIntProtCfm(pst, cxtId(%ld), libTrans(%d,%d,%d))",
843 cxtId, libTrans.rbId, libTrans.rbType, libTrans.count);
845 RLOG4(L_DEBUG, "PjLibObdIntProtCfm(pst, cxtId(%ld), libTrans(%d,%d,%ld))",
846 cxtId, libTrans.rbId, libTrans.rbType, libTrans.count);
850 /* If PDCP Layer is not configured and recieved message from Off-board, then
851 * clean the resources recieved and return RFAILED.
852 * Else proceed with processing.*/
853 if (!(tPjCb->init.cfgDone & PJ_LMM_GENCFG_DONE))
858 count = libTrans.count;
862 /* pj005.201 ccpu00114955 corrected the RB ID calculation */
863 rbId = libTrans.rbId + 1;
864 pjDbmFetchPjDlRbCb((PjDlUeCb*)libTrans.ueCb, rbId, libTrans.rbType,&pjRbCb);
865 if ( pjRbCb == NULLP )
867 RLOG_ARG2(L_ERROR, DBG_UEID,libTrans.ueId, "CellId[%u]: DL RbId[%d] not found",
868 libTrans.cellId, rbId);
871 if ( pjRbCb->state == PJ_STATE_REEST || pjRbCb->state == PJ_STATE_REEST_HO)
876 txEnt = pjDbmGetTxEnt(tPjCb,&(pjRbCb->dlCb.txBuf), count);
879 RLOG_ARG1(L_ERROR,DBG_RBID,rbId,"txEnt is NULLP, Count[%lu]",
885 PJ_PACK_MACI(txEnt->sdu, macI);
887 ret = SRemPreMsg(&hdr, txEnt->sdu);
890 RLOG_ARG1(L_ERROR,DBG_RBID,rbId,"SRemPreMsg failed , Count [%lu]",
892 PJ_UPD_DL_VAR(tPjCb,pjRbCb, txEnt->count);
893 PJ_SND_CFM(tPjCb,pjRbCb, txEnt, PJ_REM_MSG_FAILED);
894 pjDbmDelTxEnt(tPjCb,&(pjRbCb->dlCb.txBuf), txEnt->count);
898 txEnt->pdu = txEnt->sdu;
900 if (pjRbCb->firstDlMsg == TRUE && pjRbCb->firstSn == txEnt->sn)
902 pjRbCb->firstDlMsg = FALSE;
904 ret = pjDlmDeliverPdu(tPjCb,pjRbCb, txEnt);
908 ret = pjDlmHdlCiph(tPjCb,pjRbCb, txEnt);
911 RLOG_ARG1(L_ERROR,DBG_RBID,rbId,"CipherReq failed, Count[%lu]",
918 } /* end of PjLibObdIntProtCfm */
924 * Asynchronous handler to receive the ciphered SDU from off-board
929 * This function receives an output from ciphering unit and
930 * sends the PDU to lower layer in sequence.
932 * @param[in] pst Post structure
933 * @param[in] cxtId Context Id for Ciphering
934 * @param[in] libTrans Transaction Id
935 * @param[in] opSdu ciphered SDU
943 PUBLIC S16 PjLibObdCipherCfm
945 Pst *pst, /* post structure */
946 PTR cxtId, /* Context Id for Ciphering */
947 PjLibTrans libTrans, /* Transaction Id */
948 Buffer *opSdu /* ciphered SDU */
951 PUBLIC S16 PjLibObdCipherCfm(pst, cxtId, libTrans, opSdu)
952 Pst *pst; /* post structure */
953 PTR cxtId; /* Context Id for Integrity protection */
954 PjLibTrans libTrans; /* Transaction Id */
955 Buffer *opSdu; /* ciphered SDU */
963 /* pj005.201 ccpu00114955 corrected the RB ID calculation */
966 TRC3(PjLibObdCipherCfm)
967 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
972 tPjCb = PJ_GET_PJCB(pst->dstInst);
975 RLOG4(L_DEBUG, "PjLibObdCipherCfm(pst, cxtId(%ld), libTrans(%d,%d,%d))",
976 cxtId, libTrans.rbId, libTrans.rbType, libTrans.count);
978 RLOG4(L_DEBUG, "PjLibObdCipherCfm(pst, cxtId(%ld), libTrans(%d,%d,%ld))",
979 cxtId, libTrans.rbId, libTrans.rbType, libTrans.count);
982 count = libTrans.count;
985 /* If PDCP Layer is not configured and recieved message from Off-board, then
986 * clean the resources recieved and return RFAILED.
987 * Else proceed with processing.*/
988 if (!(tPjCb->init.cfgDone & PJ_LMM_GENCFG_DONE))
994 /* pj005.201 ccpu00114955 corrected the RB ID calculation */
995 rbId = libTrans.rbId + 1;
996 pjDbmFetchPjDlRbCb((PjDlUeCb*)libTrans.ueCb, rbId, libTrans.rbType,&pjRbCb);
997 if ( pjRbCb == NULLP )
999 RLOG_ARG2(L_ERROR, DBG_UEID,libTrans.ueId, "CellId[%u]: DL RbId[%d] not found",
1000 libTrans.cellId, rbId);
1004 if ( pjRbCb->state == PJ_STATE_REEST || pjRbCb->state == PJ_STATE_REEST_HO)
1009 txEnt = pjDbmGetTxEnt(tPjCb,&(pjRbCb->dlCb.txBuf), count);
1010 if ( txEnt == NULLP )
1012 /* Log an error and return */
1013 RLOG_ARG1(L_ERROR,DBG_RBID,rbId,"txEnt is NULLP, Count[%lu]",
1018 if ( opSdu == NULLP )
1020 RLOG_ARG0(L_ERROR,DBG_RBID,rbId,"opSdu is NULLP");
1021 PJ_UPD_DL_VAR(tPjCb,pjRbCb, txEnt->count);
1022 if (!pjRbCb->rohc.hdrCmpUsed)
1026 if ( pjRbCb->dlCb.cfmReqd)
1028 PJ_SND_CFM(tPjCb,pjRbCb, txEnt, PJU_CIPHER_FAILED);
1032 pjDbmDelTxEnt(tPjCb, &(pjRbCb->dlCb.txBuf), txEnt->count);
1034 tPjCb->pjGenSts.numCiphFails++;
1038 if ( pjRbCb->rohc.hdrCmpUsed )
1040 PJ_FREE_BUF(txEnt->pdu);
1043 ret = pjDlmDeliverPdu(tPjCb,pjRbCb, txEnt);
1047 } /* end of PjLibObdCipherCfm */
1054 * Asynchronous handler to receive the deciphered SDU from off-board
1059 * This function receives an output from deciphering unit and
1060 * sends the same for Integrity verification or decompression
1061 * based on the rbType.
1063 * @param[in] pst Post structure
1064 * @param[in] cxtId Context Id for Integrity protection
1065 * @param[in] libTrans Transaction Id
1066 * @param[in] opPdu Deciphered SDU
1074 PUBLIC S16 PjLibObdDecipherCfm
1076 Pst *pst, /* post structure */
1077 PTR cxtId, /* Context Id for Integrity protection*/
1078 PjLibTrans libTrans, /* Transaction Id */
1079 Buffer *opPdu /* deciphered SDU */
1082 PUBLIC S16 PjLibObdDecipherCfm(pst, cxtId, libTrans, opPdu)
1083 Pst *pst; /* post structure */
1084 PTR cxtId; /* Context Id for Integrity protection*/
1085 PjLibTrans libTrans; /* Transaction Id */
1086 Buffer *opPdu; /* deciphered SDU */
1093 Buffer *outPdu = NULLP;
1095 /* pj005.201 ccpu00114955 corrected the RB ID calculation */
1098 TRC2(PjLibObdDecipherCfm);
1100 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
1105 tPjCb = PJ_GET_PJCB(pst->dstInst);
1108 RLOG4(L_DEBUG, "PjLibObdDecipherCfm(pst, cxtId(%ld), libTrans(%d,%d,%d))",
1109 cxtId, libTrans.rbId, libTrans.rbType, libTrans.count);
1111 RLOG4(L_DEBUG, "PjLibObdDecipherCfm(pst, cxtId(%ld), libTrans(%d,%d,%ld))",
1112 cxtId, libTrans.rbId, libTrans.rbType, libTrans.count);
1115 /* If PDCP Layer is not configured and recieved message from Off-board, then
1116 * clean the resources recieved and return RFAILED.
1117 * Else proceed with processing.*/
1118 if (!(tPjCb->init.cfgDone & PJ_LMM_GENCFG_DONE))
1124 /* pj005.201 ccpu00114955 corrected the RB ID calculation */
1125 rbId = libTrans.rbId + 1;
1126 /* 1. Initialisations */
1127 pjDbmFetchPjUlRbCb((PjUlUeCb*)libTrans.ueCb, rbId, libTrans.rbType,&pjRbCb);
1130 RLOG_ARG2(L_ERROR, DBG_UEID,libTrans.ueId, "CellId[%u]: UL RbId[%d] not found",
1131 libTrans.cellId, rbId);
1133 PJ_STS_INC_GEN_CNT(tPjCb,numDeciphFails);
1137 ulCb = &pjRbCb->ulCb;
1139 /* Validating rxEnt will be done later in code */
1140 rxEnt = pjDbmGetRxEnt(tPjCb,&ulCb->recBuf, libTrans.count);
1142 /* 2. check decipher status */
1145 RLOG_ARG0(L_ERROR, DBG_RBID, rbId,"opPdu is NULL");
1147 PJ_STS_INC_GEN_CNT(tPjCb,numDecmpFails);
1148 if ( rxEnt != NULLP )
1150 PJ_SND_PJU_STA_IND(tPjCb,pjRbCb, rxEnt);
1151 pjUlmHdlErrUpdates(tPjCb,pjRbCb, rxEnt->count);
1152 pjDbmDelRxEnt(tPjCb,&ulCb->recBuf, rxEnt->count);
1158 /* 3. Check if it is SRB */
1159 if(pjRbCb->rbType == PJ_SRB)
1161 /* 3.1 For reestablishment scenarios, discard */
1162 if(pjRbCb->state != PJ_STATE_NORMAL )
1164 /* Discard the mBuf */
1169 /* 3.2 Validate the rxEnt */
1172 RLOG_ARG0(L_ERROR, DBG_RBID,rbId,"rxEnt not found");
1174 PJ_STS_INC_GEN_CNT(tPjCb,numDeciphFails);
1178 /* 3.3 Post deciphering updations */
1179 rxEnt->state = PJ_RDY_TO_INTVER;
1180 PJ_FREE_BUF(rxEnt->mBuf);
1181 rxEnt->mBuf = opPdu;
1183 /* 3.4 Send for IntVer. This will be ASYNC */
1184 ret = pjUlmHdlIntVer(tPjCb,pjRbCb, rxEnt);
1192 * Duplicate entries, can be sent out of order */
1193 if((rxEnt == NULLP)||
1194 (rxEnt->discFlag == TRUE) ||
1195 (rxEnt->state != PJ_SENT_TO_DCIPHER))
1197 /* 4.1 is decompression applicable */
1198 if(pjRbCb->rohc.hdrCmpUsed == TRUE)
1201 /* 4.1.1 Calling decompression hook */
1202 if(pjUtlDeCmpReq(tPjCb,pjRbCb, libTrans.count, opPdu, &outPdu) != ROK)
1210 #endif /* PJ_CMP_ASYNC */
1213 /* 4.1.2 discard output and exit */
1215 PJ_FREE_BUF(outPdu);
1216 if((rxEnt != NULLP) &&
1217 (rxEnt->discFlag == TRUE))
1219 pjDbmDelRxEnt(tPjCb,&ulCb->recBuf, rxEnt->count);
1226 /* 5. Post deciphering updations */
1227 rxEnt->state = PJ_RDY_TO_SUBMIT;
1228 PJ_FREE_BUF(rxEnt->mBuf);
1229 rxEnt->mBuf = opPdu;
1231 /* 6. Submit it for decompression */
1232 pjUlmSubmitForDecmp(tPjCb,pjRbCb, rxEnt);
1234 }/* if(pjRbCb->rbType == PJ_DRB) */
1238 } /* end of PjLibObdDecipherCfm */
1244 * Asynchronous handler to receive the status for Integrity verification
1245 * from off-board entity.
1249 * This function receives status, success or failure for Integrity
1250 * verification and sends the data for deciphering with relevant input paramenters.
1252 * @param[in] pst post structure
1253 * @param[in] cxtId Context Id for Integrity protection
1254 * @param[in] libTrans Transaction Id
1255 * @param[in] status Integrity verification status
1263 PUBLIC S16 PjLibObdIntVerCfm
1265 Pst *pst, /* post structure */
1266 PTR cxtId, /* Context Id for Integrity protection*/
1267 PjLibTrans libTrans, /* Transaction Id */
1268 Status status /* Integrity verification status */
1271 PUBLIC S16 PjLibObdIntVerCfm(pst, cxtId, libTrans, status)
1272 Pst *pst; /* post structure */
1273 PTR cxtId; /* Context Id for Integrity protection */
1274 PjLibTrans libTrans; /* Transaction Id */
1275 Status status; /* Integrity verification status */
1282 /* pj005.201 ccpu00114955 corrected the RB ID calculation */
1285 TRC2(PjLibObdIntVerCfm)
1287 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
1292 tPjCb = PJ_GET_PJCB(pst->dstInst);
1295 RLOG4(L_DEBUG, "PjLibObdIntVerCfm(cxtId(%ld), libTrans(%d,%d,%d))",
1296 cxtId, libTrans.rbId, libTrans.rbType, libTrans.count);
1298 RLOG4(L_DEBUG, "PjLibObdIntVerCfm(cxtId(%ld), libTrans(%d,%d,%ld))",
1299 cxtId, libTrans.rbId, libTrans.rbType, libTrans.count, status);
1301 RLOG1(L_DEBUG," status(%d)",status);
1303 /* If PDCP Layer is not configured and recieved message from Off-board, then
1304 * clean the resources recieved and return RFAILED.
1305 * Else proceed with processing.*/
1306 if (!(tPjCb->init.cfgDone & PJ_LMM_GENCFG_DONE))
1311 /* Initialisations */
1312 /* pj005.201 ccpu00114955 corrected the RB ID calculation */
1313 rbId = libTrans.rbId + 1;
1314 pjDbmFetchPjUlRbCb((PjUlUeCb*)libTrans.ueCb, rbId, libTrans.rbType,&pjRbCb);
1317 RLOG_ARG2(L_ERROR, DBG_UEID,libTrans.ueId, "CellId[%u]: UL RbId[%d] not found",
1318 libTrans.cellId, rbId);
1319 PJ_STS_INC_GEN_CNT(tPjCb, numIntgVrfFails);
1322 ulCb = &pjRbCb->ulCb;
1324 /* For reestablishment cases, exit */
1325 if(pjRbCb->state != PJ_STATE_NORMAL)
1331 rxEnt = pjDbmGetRxEnt(tPjCb,&ulCb->recBuf, libTrans.count);
1334 RLOG_ARG1(L_ERROR, DBG_RBID, rbId, "rxEnt not found for Count [%lu]", libTrans.count);
1335 PJ_STS_INC_GEN_CNT(tPjCb, numIntgVrfFails);
1336 PJ_PERFORM_ERR_UPDATES(tPjCb, pjRbCb, libTrans.count);
1340 /* Validate status */
1343 RLOG_ARG1(L_ERROR, DBG_RBID, rbId, "Integrity Verification Failed , Count [%lu]"
1345 PJ_SND_PJU_STA_IND(tPjCb,pjRbCb, rxEnt);
1346 PJ_STS_INC_GEN_CNT(tPjCb,numIntgVrfFails);
1347 PJ_PERFORM_ERR_UPDATES(tPjCb,pjRbCb, rxEnt->count);
1348 /* pjDbmDelRxEnt(&ulCb->recBuf, rxEnt->count); */
1352 /* Check if next in line for delivery */
1353 rxEnt->state = PJ_RDY_TO_SUBMIT;
1354 if(rxEnt->count != ulCb->nxtSubCnt)
1359 /* Send for delivery */
1360 pjUlmDeliverSrb(tPjCb,pjRbCb, rxEnt);
1364 } /* end of PjLibObdIntVerCfm */
1365 #endif /* PJ_SEC_ASYNC */
1372 * Handler for redirecing compression request to either synchronous
1373 * or asynchronous module.
1377 * This function sends compression request as either synchronous or
1378 * asynchronous function calls with relevant input parameters.
1380 * @param[in] pjRbCb PDCP RbCb
1381 * @param[in] mBuf SDU to be compressed
1382 * @param[in] opSdu Compressed SDU
1383 * @param[in] count COUNT - transaction Id
1390 PUBLIC S16 pjUtlCmpReq
1393 PjDlRbCb *pjRbCb, /* PDCP RbCb */
1394 Buffer *mBuf, /* SDU to be compressed */
1395 Buffer **opSdu, /* Compressed SDU */
1396 U32 count /* COUNT - transaction Id */
1399 PUBLIC S16 pjUtlCmpReq(gCb,pjRbCb, mBuf, opSdu, count)
1401 PjDlRbCb *pjRbCb; /* PDCP RbCb */
1402 Buffer *mBuf; /* SDU to be compressed */
1403 Buffer **opSdu; /* Compressed SDU */
1404 U32 count; /* COUNT - transaction Id */
1408 PjLibTrans libTrans; /* Transaction Id for compression */
1417 PJDBGP(gCb,(PJ_DBGMASK_UTL | PJ_DBGMASK_DETAIL),
1418 (gCb->init.prntBuf, "pjUtlCmpReq(pjRbCb(%d,%d), count(%d))\n",\
1419 pjRbCb->rbId, pjRbCb->rbType, count));
1421 PJDBGP(gCb,(PJ_DBGMASK_UTL | PJ_DBGMASK_DETAIL),
1422 (gCb->init.prntBuf, "pjUtlCmpReq(pjRbCb(%d,%d), count(%ld))\n",\
1423 pjRbCb->rbId, pjRbCb->rbType, count));
1428 /* Assign transId and cxtId */
1429 libTrans.count = count;
1430 /* pj005.201 ccpu00114955 corrected the RB ID calculation */
1431 libTrans.rbId = pjRbCb->rbId - 1;
1432 libTrans.rbType = pjRbCb->rbType;
1433 libTrans.ueCb = (PTR)pjRbCb->ueCb;
1435 /* Start the timer if it is not started already */
1436 if((pjChkTmr(gCb, (PTR)pjRbCb, PJ_EVT_DL_OBD_TMR)) == FALSE)
1438 pjStartTmr(gCb, (PTR)pjRbCb, PJ_EVT_DL_OBD_TMR);
1441 /* Send to the library */
1442 ret = PjLibObdCmpReq(&(gCb->pjGenCfg.obdPst.cmpPst), pjRbCb->cmpCxtId,
1445 ret = pjLibCmpReq(pjRbCb->cmpCxtId, mBuf, opSdu);
1450 } /* end of pjUtlCmpReq */
1458 * Handler for redirecing decompression request to either synchronous
1459 * or asynchronous module.
1463 * This function sends decompression protection request as either synchronous or
1464 * asynchronous function calls with relevant input parameters.
1466 * @param[in] pjRbCb PDCP RbCb
1467 * @param[in] mBuf SDU to be compressed
1468 * @param[in] opSdu Compressed SDU
1469 * @param[in] count COUNT - transaction Id
1476 PUBLIC S16 pjUtlDeCmpReq
1479 PjUlRbCb *pjRbCb, /* PDCP RbCb */
1480 U32 count, /* COUNT - transaction Id */
1481 Buffer *mBuf, /* SDU to be compressed */
1482 Buffer **opSdu /* Compressed SDU */
1485 PUBLIC S16 pjUtlDeCmpReq(pjRbCb, count, mBuf, opSdu)
1487 PjUlRbCb *pjRbCb; /* PDCP RbCb */
1488 U32 count; /* COUNT - transaction Id */
1489 Buffer *mBuf; /* SDU to be compressed */
1490 Buffer **opSdu; /* Compressed SDU */
1495 PjLibTrans libTrans; /* Transaction Id for compression */
1497 Buffer *feedback = NULLP;
1498 #endif /* PJ_CMP_ASYNC */
1503 PJDBGP(gCb,(PJ_DBGMASK_UTL | PJ_DBGMASK_DETAIL),
1504 (gCb->init.prntBuf, "pjUtlDeCmpReq(pjRbCb(%d,%d), count(%d))\n",\
1505 pjRbCb->rbId, pjRbCb->rbType, count));
1507 PJDBGP(gCb,(PJ_DBGMASK_UTL | PJ_DBGMASK_DETAIL),
1508 (gCb->init.prntBuf, "pjUtlDeCmpReq(pjRbCb(%d,%d), count(%ld))\n",\
1509 pjRbCb->rbId, pjRbCb->rbType, count));
1512 /* Assign transId and cxtId */
1513 libTrans.count = count;
1514 /* pj005.201 ccpu00114955 corrected the RB ID calculation */
1515 libTrans.rbId = pjRbCb->rbId - 1;
1516 libTrans.rbType = pjRbCb->rbType;
1517 libTrans.ueCb = (PTR)pjRbCb->ueCb;
1519 /* Start the timer if it is not started already */
1520 if((pjChkTmr(gCb, (PTR)pjRbCb, PJ_EVT_UL_OBD_TMR)) == FALSE)
1522 pjRbCb->ulCb.obdPdu = count;
1523 pjStartTmr(gCb, (PTR)pjRbCb, PJ_EVT_UL_OBD_TMR);
1526 ret = PjLibObdDecmpReq(&(gCb->pjGenCfg.obdPst.cmpPst),
1527 pjRbCb->cmpCxtId, libTrans, mBuf);
1529 ret = pjLibDecmpReq(pjRbCb->cmpCxtId, mBuf, &feedback, opSdu);
1531 if(feedback != NULLP)
1533 pjUtlUlSndUlRohcFdbk(gCb,pjRbCb,feedback);
1539 } /* end of pjUtlDeCmpReq */
1546 * Handler for redirecing compression request to either synchronous
1547 * or asynchronous module.
1551 * This function sends compression request as either synchronous or
1552 * asynchronous function calls with relevant input parameters.
1554 * @param[in] pjRbCb PDCP RbCb
1555 * @param[in] feedback ROHC Feedback
1562 PUBLIC S16 pjUtlSndFeedback
1565 PjUlRbCb *pjRbCb, /* PDCP RbCb */
1566 Buffer *feedback /* ROHC Feedback */
1569 PUBLIC S16 pjUtlSndFeedback(pjRbCb, feedback)
1571 PjUlRbCb *pjRbCb; /* PDCP RbCb */
1572 Buffer *feedback; /* Feedback */
1576 PjLibTrans libTrans; /* Transaction Id for compression */
1577 #endif /* PJ_SEC_ASYNC */
1579 TRC3(pjUtlSndFeedback)
1581 RLOG2(L_DEBUG, "pjUtlCmpReq(pjRbCb(%d,%d))",
1582 pjRbCb->rbId, pjRbCb->rbType);
1585 /* Assign transId and cxtId */
1586 libTrans.count = pjRbCb->ulCb.rxDeliv - 1;
1587 /* pj005.201 ccpu00114955 corrected the RB ID calculation */
1588 libTrans.rbId = pjRbCb->rbId - 1;
1589 libTrans.rbType = pjRbCb->rbType;
1590 libTrans.ueCb = (PTR)pjRbCb->ueCb;
1592 PjLibObdCmpFbReq(&(gCb->pjGenCfg.obdPst.cmpPst), pjRbCb->cmpCxtId, libTrans,
1595 pjLibCmpFbReq(pjRbCb->cmpCxtId, feedback);
1600 } /* end of pjUtlSndFeedback */
1606 * Handler for closing the context with the compression unit (either
1607 * synchronous or asynchronous) for RB within an UE.
1611 * This function closes an existing context with the compression unit per RB per
1612 * UE, either using synchronous / asynchronous function calls with relevant input parameters.
1615 * @param[in] cmpCxtId ROHC Context to be closed
1622 PUBLIC S16 pjUtlCmpClose
1625 PTR cmpCxtId /* ROHC Context to be closed */
1628 PUBLIC S16 pjUtlCmpClose(cmpCxtId)
1630 PTR cmpCxtId; /* ROHC Context to be closed */
1635 RLOG1(L_DEBUG, "pjUtlCmpClose(cmpCxtId(%ld))", cmpCxtId);
1637 #ifndef PJ_CMP_ASYNC
1638 pjLibCmpCloseReq(cmpCxtId);
1640 PjLibObdCmpCloseReq(&gCb->pjGenCfg.obdPst.cmpPst, cmpCxtId);
1645 } /* end of pjUtlCmpClose */
1649 /* pj005.201 added support for L2 Measurement */
1650 #ifdef LTE_L2_MEAS_COMMENT
1654 * @brief Handler for L2 Measurement timer expiry.
1658 * This function is called when the l2 measurement timer expires.
1659 * This function sends a consolidates the mesaurements taken during
1660 * this time and sends the confirm .
1662 * @param[in] measEvtCb Measurement Event Control Block.
1670 PUBLIC S16 pjUtlHdlL2TmrExp
1672 PjL2MeasEvtCb *measEvtCb
1675 PUBLIC S16 pjUtlHdlL2TmrExp(measEvtCb)
1676 PjL2MeasEvtCb *measEvtCb;
1682 PjL2MeasCfmEvt measCfmEvt;
1684 PjTxEnt *txEnt = NULLP;
1687 TRC3(pjUtlHdlL2TmrExp)
1689 RLOG1,"pjUtlHdlL2TmrExp(transId(%ld))", measEvtCb->transId);
1691 measCb = &measEvtCb->measCb;
1692 while((node = cmLListFirst(&measCb->rbList)))
1694 node = cmLListDelFrm(&measCb->rbList, node);
1695 pjRbCb = (PjRbCb *) node->node;
1697 /* Cleanup any pending buffers which were not acked */
1698 if(measCb->measType & LPJ_L2MEAS_DL_DELAY)
1700 for(idx = pjRbCb->rbL2Cb.startCount; idx < pjRbCb->dlCb.count; idx++)
1702 if((txEnt = pjDbmGetTxEnt( &(pjRbCb->dlCb.txBuf), idx)) == NULLP)
1706 if(txEnt->state != PJ_PDU_SUBMITTED)
1710 pjDbmDelTxEnt( &(pjRbCb->dlCb.txBuf), idx);
1712 pjRbCb->rbL2Cb.l2Sts[PJ_L2MEAS_DL_DELAY] = NULLP;
1714 if(measCb->measType & PJ_L2MEAS_ACT_UE)
1716 pjRbCb->rbL2Cb.l2Sts[PJ_L2MEAS_ACT_UE] = NULLP;
1718 if(measCb->measType & PJ_L2MEAS_DL_DISC )
1720 pjRbCb->rbL2Cb.l2Sts[PJ_L2MEAS_DL_DISC] = NULLP;
1722 if(measCb->measType & PJ_L2MEAS_UL_LOSS)
1724 pjRbCb->rbL2Cb.l2Sts[PJ_L2MEAS_UL_LOSS] = NULLP;
1726 }/* End of while loop */
1727 /* Initialize measCfmEvt */
1728 cmMemset((U8 *) &measCfmEvt, 0, sizeof(PjL2MeasCfmEvt));
1730 measCfmEvt.transId = measEvtCb->transId;
1731 measCfmEvt.numQciCfm = 0;
1732 /* Fill the measCfmEvt structure */
1733 for(qciIdx = 0; qciIdx < measCb->numQci; qciIdx++)
1735 pjCb.pjL2Cb.measOn[measCb->qci[qciIdx]] &= ~measCb->measType;
1736 measCfmEvt.measType = measCb->measType;
1737 measCfmEvt.measCfm[measCfmEvt.numQciCfm].qci = measCb->qci[qciIdx];
1738 measCfmEvt.status.status = LCM_PRIM_OK;
1739 measCfmEvt.status.reason = LCM_REASON_NOT_APPL;
1740 if((measCb->measType & LPJ_L2MEAS_DL_DELAY) &&
1741 (measCb->measData[measCb->qci[qciIdx]].dlDelay.numPkts > 0))
1743 /* Packed delay is in ms */
1744 measCfmEvt.measCfm[measCfmEvt.numQciCfm].dlDelay =
1745 (measCb->measData[measCb->qci[qciIdx]].dlDelay.val /
1746 measCb->measData[measCb->qci[qciIdx]].dlDelay.numPkts);
1748 if((measCb->measType & LPJ_L2MEAS_DL_DISC) &&
1749 (measCb->measData[measCb->qci[qciIdx]].dlDisc.numPkts > 0))
1751 /* dlDisc = num of Pkts Discarded * 10^6 / total no of pkts. */
1752 measCfmEvt.measCfm[measCfmEvt.numQciCfm].dlDisc =
1753 measCb->measData[measCb->qci[qciIdx]].dlDisc.val * (1000000) /
1754 measCb->measData[measCb->qci[qciIdx]].dlDisc.numPkts;
1756 if((measCb->measType & LPJ_L2MEAS_UL_LOSS) &&
1757 (measCb->measData[measCb->qci[qciIdx]].ulLoss.numPkts > 0))
1759 /* ul Loss = num of Pkts lost * 10^6 / total no of pkts. */
1760 measCfmEvt.measCfm[measCfmEvt.numQciCfm].ulLoss =
1761 measCb->measData[measCb->qci[qciIdx]].ulLoss.val * (1000000) /
1762 measCb->measData[measCb->qci[qciIdx]].ulLoss.numPkts;
1764 measCfmEvt.numQciCfm++;
1767 pjCb.pjL2Cb.pjMeasEvtCb[measEvtCb->cbIdx] = NULLP;
1768 PJ_FREE(measEvtCb, sizeof(PjL2MeasEvtCb));
1769 pjCb.pjL2Cb.pjNumMeas--;
1771 /* Send Measurement confirmation to layer manager */
1772 PjMiLpjL2MeasCfm(&pjCb.pjGenCfg.lmPst,&measCfmEvt);
1775 } /* pjUtlHdlL2TmrExp */
1779 * @brief Handler for Sending Negative confirm .
1783 * This function is called when the l2 measurement cannot be started
1784 * This function sends negative confirm for all the requests
1786 * @param[in] measReqEvt Measurement Req Structure
1794 PUBLIC S16 pjUtlSndL2MeasNCfm
1796 PjL2MeasReqEvt *measReqEvt,
1797 PjL2MeasCfmEvt *measCfmEvt
1800 PUBLIC S16 pjUtlSndL2MeasNCfm(measReqEvt, measCfmEvt)
1801 PjL2MeasReqEvt *measReqEvt;
1802 PjL2MeasCfmEvt *measCfmEvt;
1806 TRC3(pjUtlSndL2MeasNCfm)
1808 RLOG1,"pjUtlSndL2MeasNCfm(transId(%ld))", measReqEvt->transId);
1810 PjMiLpjL2MeasCfm(&pjCb.pjGenCfg.lmPst, measCfmEvt);
1813 } /* pjUtlSndL2MeasNCfm */
1816 #ifdef FLAT_BUFFER_OPT
1821 * Handler to move the 'FlatBuffer' into 'Buffer'
1826 * @param[in] gCb Global PDCP control block.
1827 * @param[in] FlatBuffer 'FlatBuffer' ptr to be converted.
1828 * @param[in_out] Buffer Output mBuf.
1837 PUBLIC S16 pjUtlConvFbToBuf
1844 PUBLIC S16 pjUtlConvFbToBuf(gCb, fb, mBuf)
1852 TRC3(pjUtlConvFbToBuf);
1853 #ifdef T2K_MEM_LEAK_DBG
1854 ret = SAttachPtrToBufNew(gCb->init.region,
1862 ret = SAttachPtrToBuf(gCb->init.region,
1871 RLOG0(L_ERROR,"SAttachPtrToBuf failed !!!!!");
1882 * Handler to copy a 'FlatBuffer' to 'Buffer'
1887 * @param[in] gCb Global PDCP control block.
1888 * @param[in] FlatBuffer 'FlatBuffer' to be converted.
1889 * @param[in_out] Buffer Output mBuf.
1898 PUBLIC S16 pjUtlCopyFbToBuf
1905 PUBLIC S16 pjUtlCopyFbToBuf(gCb, fb, mBuf)
1914 TRC3(pjUtlCopyFbToBuf);
1916 SGetSBufWls(gCb->init.region, gCb->init.pool,
1917 (Data **)&(opPdu), fb->len + 128);
1919 //cmMemcpy(opPdu + 2, fb->ptr, fb->len);
1920 cmMemcpy(opPdu + 128, fb->ptr, fb->len);
1922 ret = SAttachWlsPtrToMBuf(gCb->init.region,
1931 if((SGetStaticBuffer(gCb->init.region,
1939 RLOG0(L_ERROR,"SGetStaticBuffer failed !!!!!");
1943 cmMemcpy(opPdu, fb->ptr, fb->len);
1944 /*RLOG1(L_ERROR,"Data forwarding: PDCP SN %d is converted to mBuf",
1946 #ifdef T2K_MEM_LEAK_DBG
1947 ret = SAttachPtrToBufNew(gCb->init.region,
1955 ret = SAttachPtrToBuf(gCb->init.region,
1965 RLOG0(L_ERROR,"SAttachPtrToBuf failed !!!!!");
1974 #endif /* __cplusplus */
1975 /********************************************************************30**
1977 **********************************************************************/