1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /********************************************************************20**
21 Name: LTE-PDCP Layer - Upper Interface
25 Desc: C source code for the upper interface of LTE-PDCP
29 *********************************************************************21*/
30 static const char* RLOG_MODULE_NAME="PDCP";
31 static int RLOG_MODULE_ID=1024;
32 static int RLOG_FILE_ID=226;
34 @brief PDCP Upper Interface
38 /* header (.h) include files */
39 #include "envopt.h" /* environment options */
40 #include "envdep.h" /* environment dependent */
41 #include "envind.h" /* environment independent */
43 #include "gen.h" /* general */
44 #include "ssi.h" /* system services */
45 #include "cm5.h" /* common timer defines */
46 #include "cm_tkns.h" /* common tokens defines */
47 #include "cm_mblk.h" /* common memory allocation library defines */
48 #include "cm_llist.h" /* common link list defines */
49 #include "cm_hash.h" /* common hash list defines */
50 #include "cm_lte.h" /* common LTE defines */
51 #include "cpj.h" /* UDX defines */
52 #include "pju.h" /* PJU defines */
53 #include "lpj.h" /* LPJ defines */
56 #include "pj_env.h" /* RLC environment options */
61 /* extern (.x) include files */
62 #include "gen.x" /* general */
63 #include "ssi.x" /* system services */
65 #include "cm5.x" /* common timer library */
66 #include "cm_tkns.x" /* common tokens */
67 #include "cm_mblk.x" /* common memory allocation */
68 #include "cm_llist.x" /* common link list */
69 #include "cm_hash.x" /* common hash list */
70 #include "cm_lte.x" /* common LTE includes */
71 #include "cm_lib.x" /* common memory allocation library */
72 #include "cpj.x" /* UDX defines */
73 #include "pju.x" /* PJU defines */
74 #include "lpj.x" /* LPJ defines */
80 PRIVATE S16 pjHdlCpjUlCfgReq ARGS((PjCb *gCb,PjCfgInfo *cfgInfo,
81 UdxCfgCfmInfo *cfmInfo, CpjCfgCfmInfo *cfgCfm, Bool *sndCfgCfm));
93 * Handler for bind confirmation from DL.
97 * This function handles the bind confirmation received
100 * @param[in] pst Post structure
101 * @param[in] suId Service User ID
106 /****************************************************************************
107 * UDX Interface Mt functions
108 ***************************************************************************/
\f
110 PUBLIC S16 PjUlUdxBndCfm
117 PUBLIC S16 PjUlUdxBndCfm(pst, suId, status)
123 U16 event; /* Event */
124 U16 cause; /* Cause */
125 PjUdxUlSapCb *udxSap; /* RGU SAP Control Block */
130 #if (ERRCLASS & ERRCLS_INT_PAR)
131 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
136 tPjCb = PJ_GET_PJCB(pst->dstInst);
139 RLOG2(L_DEBUG, "PjUlUdxBndCfm(post, suId(%d), status(%d)", suId, status);
142 #if (ERRCLASS & ERRCLS_INT_PAR)
143 if (!(tPjCb->init.cfgDone & PJ_LMM_GENCFG_DONE))
145 /* INNC: ERROR CLASS */
146 RLOG0(L_FATAL, "General configuration not done");
147 PJ_SEND_SAPID_ALARM(tPjCb,suId,
148 LPJ_EVENT_LI_BND_CFM, LCM_CAUSE_INV_STATE);
155 /* INNC: ERROR CLASS */
156 RLOG0(L_ERROR, "Invalid suId");
157 PJ_SEND_SAPID_ALARM(tPjCb,suId,
158 LPJ_EVENT_LI_BND_CFM, LCM_CAUSE_INV_SUID);
162 #endif /* ERRCLASS & ERRCLS_INT_PAR */
164 udxSap = tPjCb->u.ulCb->udxUlSap + suId;
167 RLOG1(L_DEBUG, "PjLiRguBndCfm: For RGU SAP state=%d",
171 /* Check rguSap state */
172 switch (udxSap->state)
176 pjStopTmr (tPjCb,(PTR)udxSap, PJ_EVT_WAIT_UDX_BNDCFM);
178 udxSap->retryCnt = 0;
180 if (status == CM_BND_OK)
182 udxSap->state = PJ_SAP_BND;
183 event = LCM_EVENT_BND_OK;
184 cause = LPJ_CAUSE_SAP_BNDENB;
188 udxSap->state = PJ_SAP_CFG;
189 event = LCM_EVENT_BND_FAIL;
190 cause = LPJ_CAUSE_UNKNOWN;
196 event = LPJ_EVENT_RGU_BND_CFM;
197 cause = LCM_CAUSE_INV_STATE;
201 /* Send an alarm with proper event and cause */
202 /*PJ_SEND_SAPID_ALARM(tPjCb,suId, event, cause);*/
204 pjLmmSendAlarm(tPjCb,LCM_CATEGORY_INTERFACE, event, cause, suId, 0,0);
206 pjLmmSendAlarm(tPjCb,LCM_CATEGORY_INTERFACE, event, cause, suId, 0);
213 PUBLIC S16 PjUlUdxCfgCfm
217 UdxCfgCfmInfo * cfmInfo
220 PUBLIC S16 PjUlUdxCfgCfm(pst, suId, cfmInfo)
223 UdxCfgCfmInfo * cfmInfo;
229 CpjCfgCfmInfo *cfgCfm;
235 #if (ERRCLASS & ERRCLS_INT_PAR)
236 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
241 tPjCb = PJ_GET_PJCB(pst->dstInst);
244 RLOG1(L_DEBUG, "PjUlUdxBndCfm(post, suId(%d), )", suId);
247 #if (ERRCLASS & ERRCLS_INT_PAR)
250 /* INNC: ERROR CLASS */
251 RLOG0(L_ERROR, "Invalid suId");
252 PJ_SEND_SAPID_ALARM(tPjCb,suId,
253 LPJ_EVENT_LI_BND_CFM, LCM_CAUSE_INV_SUID);
257 #endif /* ERRCLASS & ERRCLS_INT_PAR */
259 ret = pjDbmFindUlTransIdLst(tPjCb,cfmInfo->transId, &cfgInfo);
262 RLOG0(L_ERROR, "Invalid transId");
263 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,cfmInfo, sizeof (UdxCfgCfmInfo));
266 /* Allocate memory and memset to 0 for cfmInfo */
267 cpjSap = &(tPjCb->u.ulCb->cpjSap);
268 if(SGetSBuf(cpjSap->pst.region,cpjSap->pst.pool,(Data **)&cfgCfm,
269 sizeof (CpjCfgCfmInfo)) != ROK)
271 RLOG0(L_FATAL, "Memory Allocation failed.");
272 /* pj002.201 Freeing from proper region */
273 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,cfmInfo, sizeof (UdxCfgCfmInfo));
274 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, cfgInfo->cfgInfo, sizeof(CpjCfgReqInfo));
275 PJ_FREE(tPjCb,cfgInfo,sizeof(PjCfgInfo));
280 ret = pjHdlCpjUlCfgReq(tPjCb,cfgInfo, cfmInfo, cfgCfm, &sndCfgCfm);
282 /* Free the cfg confirm allocated from DL, this should actually
283 be a sharable buffer and not a static buffer */
284 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,cfmInfo, sizeof (UdxCfgCfmInfo));
285 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, cfgInfo->cfgInfo, sizeof(CpjCfgReqInfo));
286 PJ_FREE(tPjCb,cfgInfo,sizeof(PjCfgInfo));
291 cpjSap = &(tPjCb->u.ulCb->cpjSap);
293 PjUiCpjCfgCfm(&(cpjSap->pst), cpjSap->suId, cfgCfm);
301 PUBLIC S16 PjUlUdxReEstCfm
305 UdxReEstCfmInfo *reEstCfm
308 PUBLIC S16 PjUlUdxReEstCfm(pst, suId, reEstCfm)
311 UdxReEstCfmInfo *reEstCfm;
318 CpjReEstCfmInfo *cpjReEstCfm;
320 TRC3(PjUlUdxReEstCfm)
322 #if (ERRCLASS & ERRCLS_INT_PAR)
323 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
325 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,reEstCfm, sizeof (UdxReEstCfmInfo));
330 tPjCb = PJ_GET_PJCB(pst->dstInst);
333 RLOG1(L_DEBUG, "PjUlUdxReEstCfm(post, suId(%d), ", suId);
336 #if (ERRCLASS & ERRCLS_INT_PAR)
339 /* INNC: ERROR CLASS */
340 RLOG0(L_ERROR, "Invalid suId");
341 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,reEstCfm, sizeof (UdxReEstCfmInfo));
344 #endif /* ERRCLASS & ERRCLS_INT_PAR */
346 ret = pjDbmFindUlTransIdLst(tPjCb, reEstCfm->transId, &cfgInfo);
349 RLOG0(L_ERROR, "Invalid transId");
350 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,reEstCfm, sizeof (UdxReEstCfmInfo));
356 cpjSap = &(tPjCb->u.ulCb->cpjSap);
357 if(SGetSBuf(cpjSap->pst.region,cpjSap->pst.pool,(Data **)&cpjReEstCfm,
358 sizeof (CpjReEstCfmInfo)) != ROK)
360 /* Free memory for CfgReqInfo */
361 /* kw002.201 Freeing from proper region */
362 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,reEstCfm, sizeof (UdxReEstCfmInfo));
363 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, cfgInfo->reEstReq, sizeof(CpjReEstReqInfo));
364 PJ_FREE(tPjCb, cfgInfo, sizeof (PjCfgInfo));
365 RLOG0(L_FATAL, "Memory Allocation failed.");
369 cpjReEstCfm->ueId = cfgInfo->reEstReq->pdcpId.ueId;
370 cpjReEstCfm->cellId = cfgInfo->reEstReq->pdcpId.cellId;
371 /* Assign number of entity configuraitons and suId */
372 cpjReEstCfm->transId = cfgInfo->uprLyrTransId;
373 cpjReEstCfm->status = reEstCfm->status;
375 if (CPJ_CFG_CFM_OK == reEstCfm->status)
377 /* handle ReEstablish here */
378 pjCfgUlReEstReq(tPjCb, cfgInfo->reEstReq, cpjReEstCfm);
382 PjUiCpjReEstCfm(&(cpjSap->pst), cpjSap->suId, cpjReEstCfm);
384 /* Configuration information needs to be freed from proper region */
385 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,reEstCfm, sizeof (UdxReEstCfmInfo));
386 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, cfgInfo->reEstReq, sizeof(CpjReEstReqInfo));
387 PJ_FREE(tPjCb, cfgInfo, sizeof (PjCfgInfo));
395 PUBLIC S16 PjUlUdxSecCfgCfm
399 UdxSecCfgCfmInfo * secCfgCfm
402 PUBLIC S16 PjUlUdxSecCfgCfm(pst, suId, secCfgCfm)
405 UdxSecCfgCfmInfo * secCfgCfm;
409 CpjSecCfgCfmInfo *cfgCfm; /* Security Cfg Confirm structure */
413 CpjSecCfgReqInfo *secCfg;
415 PjUlUeCb *ueCb = NULLP;
418 TRC3(PjUlUdxSecCfgCfm)
420 #if (ERRCLASS & ERRCLS_INT_PAR)
421 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
426 tPjCb = PJ_GET_PJCB(pst->dstInst);
429 RLOG1(L_DEBUG, "PjUlUdxUeIdChgCfm(post, suId(%d), ", suId);
432 #if (ERRCLASS & ERRCLS_INT_PAR)
435 /* INNC: ERROR CLASS */
436 RLOG0(L_ERROR, "Invalid suId");
439 #endif /* ERRCLASS & ERRCLS_INT_PAR */
441 cpjSap = &(tPjCb->u.ulCb->cpjSap);
443 ret = pjDbmFindUlTransIdLst(tPjCb,secCfgCfm->transId, &cfgInfo);
446 RLOG0(L_ERROR, "Invalid transId");
447 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,secCfgCfm, sizeof (UdxSecCfgCfmInfo));
451 secCfg = cfgInfo->secCfgInfo;
454 if(SGetSBuf(cpjSap->pst.region,cpjSap->pst.pool,(Data **)&cfgCfm,
455 sizeof (CpjSecCfgCfmInfo)) != ROK)
457 /* Free memory for CfgReqInfo */
458 /* kw002.201 Freeing from proper region */
459 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, secCfg, sizeof(CpjSecCfgReqInfo));
460 PJ_FREE(tPjCb, cfgInfo, sizeof (PjCfgInfo));
461 RLOG0(L_FATAL, "Memory Allocation failed.");
465 if ( pjCfgPrcSecUlCfg(tPjCb,secCfg,cfgCfm) != ROK )
467 RLOG_ARG2(L_ERROR,DBG_UEID,secCfg->ueId,
468 "PjUiCpjSecCfgReq cellId(%d) pjCfgSecCfg Failed: reason (%d)",
469 secCfg->cellId, cfgCfm->reason);
474 if (secCfgCfm->status != CPJ_CFG_CFM_OK)
476 PJ_MEM_CPY(cfgCfm, secCfgCfm, sizeof (CpjSecCfgCfmInfo));
480 cfgCfm->transId = cfgInfo->uprLyrTransId;
482 ret = pjDbmFetchUlUeCb(tPjCb,secCfg->ueId, secCfg->cellId, &ueCb);
485 pjUtlUlSaveCfmInfo(tPjCb, ueCb, PJ_SEC_ASYNC_CFM, TRUE, ENTPJ, (PTR)cfgCfm, NULLP);
486 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, cfgCfm, sizeof(CpjSecCfgCfmInfo));
490 RLOG_ARG1(L_ERROR, DBG_CELLID, secCfg->cellId,"UeId[%u] not found",
492 PjUiCpjSecCfgCfm(&(cpjSap->pst), cpjSap->suId, cfgCfm);
495 PjUiCpjSecCfgCfm(&(cpjSap->pst), cpjSap->suId, cfgCfm);
498 /* Configuration information needs to be freed from proper region */
499 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,secCfgCfm, sizeof (UdxSecCfgCfmInfo));
500 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, secCfg, sizeof(CpjSecCfgReqInfo));
501 PJ_FREE(tPjCb, cfgInfo, sizeof (PjCfgInfo));
507 PUBLIC S16 PjUlUdxUeIdChgCfm
516 PUBLIC S16 PjUlUdxUeIdChgCfm(pst, suId, transId, ueInfo, status)
530 TRC3(PjUlUdxUeIdChgCfm)
532 #if (ERRCLASS & ERRCLS_INT_PAR)
533 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
538 tPjCb = PJ_GET_PJCB(pst->dstInst);
541 RLOG1(L_DEBUG, "PjUlUdxUeIdChgCfm(post, suId(%d), ", suId);
544 #if (ERRCLASS & ERRCLS_INT_PAR)
547 /* INNC: ERROR CLASS */
548 RLOG0(L_ERROR, "Invalid suId");
551 #endif /* ERRCLASS & ERRCLS_INT_PAR */
553 ret = pjDbmFindUlTransIdLst(tPjCb, transId, &cfgInfo);
556 RLOG0(L_ERROR, "Invalid transId");
557 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,ueInfo, sizeof (UdxUeInfo));
562 tStatus.reason = CPJ_CFG_REAS_NONE;
563 tStatus.status = CPJ_CFG_CFM_OK;
565 if ( (ret = pjCfgUlUeIdChng(tPjCb,cfgInfo->ueInfo,
566 cfgInfo->newUeInfo, &tStatus)) != ROK)
569 RLOG_ARG4(L_ERROR,DBG_UEID,cfgInfo->ueInfo->ueId, "Cpj UeId Chg Req"
570 " old-ueId(%d), new-ueId(%d), cellId(%d))Failed: reason (%d)",
571 cfgInfo->ueInfo->ueId, cfgInfo->newUeInfo->ueId,
572 cfgInfo->newUeInfo->cellId, status.reason);
576 cpjSap = &(tPjCb->u.ulCb->cpjSap);
578 if ((status.status == CPJ_CFG_CFM_OK) ||
579 (tStatus.status == CPJ_CFG_CFM_OK))
581 tStatus.reason = CPJ_CFG_REAS_NONE;
582 tStatus.status = CPJ_CFG_CFM_OK;
585 PjUiCpjUeIdChgCfm(&cpjSap->pst,cpjSap->suId,cfgInfo->uprLyrTransId,(CpjUeInfo *)ueInfo,tStatus);
587 /* Free the buffers allocated before returning */
588 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, cfgInfo->ueInfo, sizeof(CpjUeInfo));
589 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, cfgInfo->newUeInfo, sizeof(CpjUeInfo));
590 PJ_FREE(tPjCb, cfgInfo, sizeof (PjCfgInfo));
597 PUBLIC S16 PjUlUdxCountCfm
601 UdxCountCfmInfo *cntCfm
604 PUBLIC S16 PjUlUdxCountCfm(pst, suId, cntCfm)
607 UdxCountCfmInfo *cntCfm;
615 CpjCountReqInfo *countReq = NULLP;
616 CpjCountCfmInfo *countCfm = NULLP;
618 TRC3(PjUlUdxCountCfm)
620 #if (ERRCLASS & ERRCLS_INT_PAR)
621 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
626 tPjCb = PJ_GET_PJCB(pst->dstInst);
629 RLOG1(L_DEBUG, "PjUlUdxUeIdChgCfm(post, suId(%d), ", suId);
632 #if (ERRCLASS & ERRCLS_INT_PAR)
635 /* INNC: ERROR CLASS */
636 RLOG0(L_ERROR, "Invalid suId");
639 #endif /* ERRCLASS & ERRCLS_INT_PAR */
641 ret = pjDbmFindUlTransIdLst(tPjCb, cntCfm->transId, &cfgInfo);
644 RLOG0(L_ERROR, "Invalid transId");
645 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,cntCfm, sizeof (UdxCountCfmInfo));
648 cpjSap = &tPjCb->u.ulCb->cpjSap;
649 countReq = cfgInfo->cntReq;
650 if(SGetSBuf(cpjSap->pst.region,cpjSap->pst.pool,(Data **)&countCfm,
651 sizeof (CpjCountCfmInfo)) != ROK)
653 /* Free memory for CfgReqInfo */
654 /* kw002.201 Freeing from proper region */
656 /* PJ_PST_FREE(pst->region, pst->pool, countReq, sizeof(CpjCountReqInfo)); */
657 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,cntCfm, sizeof (UdxCountCfmInfo));
658 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, countReq, sizeof(CpjCountReqInfo));
659 PJ_FREE(tPjCb, cfgInfo, sizeof (PjCfgInfo)); /*MEM_LEAK_FIX */
660 RLOG0(L_FATAL, "Memory Allocation failed.");
664 PJ_MEM_CPY(countCfm, cntCfm, sizeof(CpjCountCfmInfo)); /* KW_FIX */
665 if ( pjCfgPrcUlCount(tPjCb, countReq, countCfm, cntCfm) != ROK )
667 RLOG_ARG2(L_ERROR,DBG_UEID,countReq->ueId,
668 "PjUiCpjCountReq cellId(%d) pjCfgSecCfg Failed: reason (%d)",
669 countReq->cellId, countCfm->reason);
673 countCfm->transId = cfgInfo->uprLyrTransId;
674 /* Ned to consolidate confirms */
675 /* Freeing from proper region */
677 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,cntCfm, sizeof (UdxCountCfmInfo));
678 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, countReq, sizeof(CpjCountReqInfo));
679 PJ_FREE(tPjCb, cfgInfo, sizeof (PjCfgInfo)); /*MEM_LEAK_FIX */
682 PjUiCpjCountCfm(&(cpjSap->pst), cpjSap->suId,countCfm);
688 PUBLIC S16 PjUlUdxSduStaCfm
692 UdxSduStaCfmInfo *staCfm
695 PUBLIC S16 PjUlUdxSduStaCfm(pst, suId, staCfm)
698 UdxSduStaCfmInfo *staCfm;
705 CpjSduStaReqInfo *staReq;
706 CpjSduStaCfmInfo *sduStaCfm;
708 TRC3(PjUlUdxSduStaCfm)
710 #if (ERRCLASS & ERRCLS_INT_PAR)
711 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
716 tPjCb = PJ_GET_PJCB(pst->dstInst);
719 RLOG1(L_DEBUG, "PjUlUdxSduStaCfm(post, suId(%d), ", suId);
722 #if (ERRCLASS & ERRCLS_INT_PAR)
725 /* INNC: ERROR CLASS */
726 RLOG0(L_ERROR, "Invalid suId");
729 #endif /* ERRCLASS & ERRCLS_INT_PAR */
731 cpjSap = &(tPjCb->u.ulCb->cpjSap);
732 ret = pjDbmFindUlTransIdLst(tPjCb, staCfm->transId, &cfgInfo);
735 RLOG0(L_ERROR, "Invalid transId");
736 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,staCfm, sizeof (UdxSduStaCfmInfo));
740 staReq = cfgInfo->staReq;
742 if (ROK == staCfm->status)
744 if (pjCfgPrcUlSduSta(tPjCb, staReq, staCfm) != ROK )
746 RLOG_ARG1(L_ERROR,DBG_UEID,staReq->ueId,
747 "PjUlUdxSduStaReq ,cellId(%d) pjCfgSecCfg Failed",staReq->cellId);
748 /* Memory leak fix ccpu00135359 */
749 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,staCfm, sizeof (UdxSduStaCfmInfo));
755 /* Memory leak fix ccpu00135359 */
756 if(SGetSBuf(cpjSap->pst.region,cpjSap->pst.pool,(Data **)&sduStaCfm,
757 sizeof (CpjSduStaCfmInfo)) != ROK)
759 RLOG0(L_FATAL, "Memory Allocation failed.");
760 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,staCfm, sizeof (UdxSduStaCfmInfo));
761 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, cfgInfo->staReq, sizeof(CpjSduStaReqInfo));
762 PJ_FREE(tPjCb, cfgInfo, sizeof (PjCfgInfo));
765 sduStaCfm->ueId = staCfm->ueId;
766 sduStaCfm->cellId = staCfm->cellId;
767 sduStaCfm->transId = cfgInfo->uprLyrTransId;
768 sduStaCfm->status = RFAILED;
769 sduStaCfm->reason = staCfm->reason;
770 sduStaCfm->numRb = staCfm->numRb;
772 RLOG_ARG1(L_DEBUG,DBG_UEID,staCfm->ueId,
773 "PjUlUdxSduStaCfm- UdxSduStaCfm fail - cellId(%d)",staCfm->cellId);
775 PjUiCpjSduStaCfm(&(cpjSap->pst), cpjSap->suId, sduStaCfm);
776 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,staCfm, sizeof (UdxSduStaCfmInfo));
779 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, cfgInfo->staReq, sizeof(CpjSduStaReqInfo));
780 PJ_FREE(tPjCb, cfgInfo, sizeof (PjCfgInfo));
786 PUBLIC S16 PjUlUdxDatResumeCfm
790 UdxDatResumeCfmInfo *udxDatResumeCfm
793 PUBLIC S16 PjUlUdxDatResumeCfm(pst, suId, udxDatResumeCfm)
796 UdxDatResumeCfmInfo *udxDatResumeCfm;
803 CpjDatResumeReqInfo *datResReq;
804 CpjDatResumeCfmInfo *datResumeCfmInfo;
806 TRC3(PjUlUdxDatResumeCfm)
808 #if (ERRCLASS & ERRCLS_INT_PAR)
809 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES)
814 tPjCb = PJ_GET_PJCB(pst->dstInst);
817 RLOG1(L_DEBUG, "PjUlUdxDatResumeCfm(post, suId(%d), ", suId);
820 #if (ERRCLASS & ERRCLS_INT_PAR)
823 /* INNC: ERROR CLASS */
824 RLOG0(L_ERROR, "Invalid suId");
827 #endif /* ERRCLASS & ERRCLS_INT_PAR */
829 ret = pjDbmFindUlTransIdLst(tPjCb, udxDatResumeCfm->transId, &cfgInfo);
832 RLOG0(L_ERROR, "Invalid transId");
833 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,udxDatResumeCfm, sizeof (UdxDatResumeCfmInfo));
837 datResReq = cfgInfo->datResReq;
839 pjUtlUlPrcsDatResume (tPjCb, datResReq);
842 /* Perform processing for filling up cfm structures */
843 cpjSap = &(tPjCb->u.ulCb->cpjSap);
844 if(SGetSBuf(cpjSap->pst.region,cpjSap->pst.pool,(Data **)&datResumeCfmInfo,
845 sizeof (CpjDatResumeCfmInfo)) != ROK)
847 RLOG0(L_FATAL, "Memory Allocation failed.");
848 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,udxDatResumeCfm, sizeof (UdxDatResumeCfmInfo));
849 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, cfgInfo->datResReq, sizeof(CpjDatResumeReqInfo));
850 PJ_FREE(tPjCb, cfgInfo, sizeof (PjCfgInfo));
853 datResumeCfmInfo->ueId = datResReq->ueId;
854 datResumeCfmInfo->cellId = datResReq->cellId;
855 datResumeCfmInfo->transId = datResReq->transId;
856 datResumeCfmInfo->status = CPJ_CFG_CFM_OK;
857 PjUiCpjDatResumeCfm(&(cpjSap->pst), cpjSap->suId, datResumeCfmInfo);
859 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool,udxDatResumeCfm, sizeof (UdxDatResumeCfmInfo));
860 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, cfgInfo->datResReq, sizeof(CpjDatResumeReqInfo));
861 PJ_FREE(tPjCb, cfgInfo, sizeof (PjCfgInfo));
868 * This function processes Data Forwarding Confirm received from DL.
870 * Now the UL Module can start forwardng the UL Packets is Application
871 * has requested for UL Data Forwarding.
873 * @param[in] pst post structure
874 * @param[in] measType meas Type
877 * -# Failure : RFAILED
880 PUBLIC S16 PjUlUdxDatForwardCfm
884 UdxDatFwdCfmInfo *datFwdCfm
887 PUBLIC S16 PjUlUdxDatForwardCfm(pst, suId, datFwdCfm)
890 UdxDatFwdCfmInfo *datFwdCfm;
899 tPjCb = PJ_GET_PJCB(pst->dstInst);
901 ret = pjDbmFetchUlUeCb(tPjCb,datFwdCfm->ueId,
902 datFwdCfm->cellId, &ueCb);
904 /* Ue Cb is not present */
905 if( ROK != ret || NULLP == ueCb)
907 RLOG_ARG1(L_ERROR, DBG_CELLID, datFwdCfm->cellId,"UeId[%u] not found",
909 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool, datFwdCfm, sizeof(UdxDatFwdCfmInfo));
913 /* Forward UL Packets only if Application has requested */
914 if(ueCb->isUlDatFwdReqd == TRUE)
916 /* Call the UL Pkt Fwd Func for each Rab */
917 for(rbCnt = 0; rbCnt < PJ_MAX_DRB_PER_UE; rbCnt++)
919 if((pjRbCb = ueCb->drbCb[rbCnt]) == NULLP)
923 /* UL Data Forwarding done only for AM Mode Bearers
924 * datQ is in Buffer State and only during Handover */
925 if((pjRbCb->mode == PJ_DRB_AM) && (ueCb->libInfo.state == PJ_STATE_REEST_HO))
927 pjUlmStartDataFrwdPerRb(tPjCb, pjRbCb);
932 PJ_FREE_SHRABL_BUF_PST(pst->region, pst->pool, datFwdCfm, sizeof(UdxDatFwdCfmInfo));
941 * Handler for Configuration Request on UL
945 * This function handles the configuration on UL after receiving
946 * the configuration confirm from DL.
948 * @param[in] gCb PDCP Instance Control block
949 * @param[in] cfgInfo UL Configuration Info
950 * @param[in] cfmInfo Configuration Confirm Info
951 * @param[in] cfgCfm Configuration Confirm Info
952 * @param[in] sndCfgCfm Configuration Confirm Info
961 PRIVATE S16 pjHdlCpjUlCfgReq
965 UdxCfgCfmInfo *cfmInfo,
966 CpjCfgCfmInfo *cfgCfm,
970 PRIVATE S16 pjHdlCpjUlCfgReq(gCb, cfgInfo, cfmInfo, cfgCfm, sndCfgCfm)
973 UdxCfgCfmInfo *cfmInfo;
974 CpjCfgCfmInfo *cfgCfm;
982 PjUlUeCb *ueCb; /* UE Control Block for storing the
983 cfg structure in case of ReEstablishment */
986 cfg = cfgInfo->cfgInfo;
991 pjDbmFetchUlUeCb(gCb, cfg->ueId, cfg->cellId, &ueCb);
992 /* KW_FIX : CPJ_MAX_CFG,CPJ_MAX_CFM,UDX_MAX_CFM have the same value , hence checking for only one of them */
993 for (idx = 0; idx < cfg->numEnt && idx < CPJ_MAX_CFG; idx++)
995 CpjCfmEnt *entCfgCfm;
996 UdxCfmEnt *entDlCfgCfm;
999 entCfg = &(cfg->cfgEnt[idx]);
1000 entCfgCfm = &(cfgCfm->cfmEnt[idx]);
1001 entDlCfgCfm = &(cfmInfo->cfmEnt[idx]);
1005 /* Fill the detault values here */
1006 PJ_CFG_FILL_CFG_CFM(entCfgCfm, entCfg->rbId, entCfg->rbType,
1007 CPJ_CFG_CFM_OK,CPJ_CFG_REAS_NONE);
1011 RLOG_ARG1(L_INFO, DBG_CELLID, cfg->cellId,"UeId[%u] not found",
1013 PJ_CFG_FILL_CFG_CFM(entCfgCfm, entCfg->rbId, entCfg->rbType,
1014 CPJ_CFG_CFM_NOK,CPJ_CFG_REAS_UE_UNKWN);
1015 if (entCfg->cfgType != CPJ_CFG_ADD)
1017 /* all other requests require ueCb mandatorily */
1022 switch (entCfg->cfgType)
1026 if (entCfg->m.addCfg.rlcInfo.dir & PJ_DIR_UL)
1030 /* Add a new RB entity configuration */
1031 if (pjCfgAddUlRb(gCb,cfg->ueId, cfg->cellId, isHo,
1032 entCfg, &ueCb, entCfgCfm) != ROK)
1035 RLOG_ARG3(L_ERROR,DBG_UEID,cfg->ueId,"UL RB Addition for"
1036 "cellId(%d),rbId(%d) Failed: reason (%d)",
1037 cfg->cellId, cfg->cfgEnt[idx].rbId, entCfgCfm->reason);
1039 PJ_CFG_FILL_CFG_CFM(entCfgCfm,entCfg->rbId,entCfg->rbType,
1040 CPJ_CFG_CFM_NOK,CPJ_CFG_REAS_UE_UNKWN);
1042 /* Only In case of DRB only we need to set this flag */
1044 else if(PJ_DRB == entCfg->rbType)
1046 if(entCfg->m.addCfg.hdrCompCfg.hdrCompUsed)
1048 cfmType |= PJ_CFG_ASYNC_CFM;
1052 #endif /* PJ_CMP_ASYNC */
1053 if (entCfg->m.addCfg.rlcInfo.dir & PJ_DIR_DL)
1055 if (entDlCfgCfm->status != CPJ_CFG_CFM_OK)
1057 PJ_MEM_CPY(entCfgCfm, entDlCfgCfm,
1058 sizeof(CpjCfmEnt)); /* KW_FIX */
1062 else if (entCfg->m.addCfg.rlcInfo.dir & PJ_DIR_DL)
1064 PJ_MEM_CPY(entCfgCfm, entDlCfgCfm, sizeof(CpjCfmEnt)); /* KW_FIX */
1069 case CPJ_CFG_MODIFY:
1071 if ((entCfg->m.modCfg.bitFlag & 0x01) ||
1072 (entCfg->m.modCfg.hoInfo.isHoPres & CPJ_HO_UL))
1074 /* Re-configure the existing RB entity configuration */
1075 if (pjCfgReCfgUlRb(gCb,ueCb, entCfg, entCfgCfm) != ROK)
1078 RLOG_ARG3(L_ERROR,DBG_UEID,cfg->ueId,"RB Config Modify HO"
1079 "for cellId(%d), rbId(%d) Failed :reason (%d)",
1080 cfg->cellId, cfg->cfgEnt[idx].rbId, entCfgCfm->reason);
1084 else if(PJ_DRB == entCfg->rbType)
1086 if(entCfg->m.modCfg.hdrCompCfg.hdrCompUsed)
1088 cfmType |= PJ_CFG_ASYNC_CFM;
1092 #endif /* PJ_CMP_ASYNC */
1093 if ((entCfg->m.modCfg.bitFlag & 0x02) ||
1094 (entCfg->m.modCfg.hdrCompCfg.hdrCompUsed) ||
1095 (entCfg->m.modCfg.hoInfo.isHoPres & CPJ_HO_DL))
1097 if (entDlCfgCfm->status != CPJ_CFG_CFM_OK)
1099 PJ_MEM_CPY(entCfgCfm, entDlCfgCfm,
1104 else if (entCfg->m.modCfg.hdrCompCfg.hdrCompUsed)
1106 /* Re-configure the existing RB entity configuration */
1107 if (pjCfgReCfgUlRb(gCb,ueCb, entCfg, entCfgCfm) != ROK)
1110 RLOG_ARG3(L_ERROR,DBG_UEID,cfg->ueId,"UL RB Modify Normal"
1111 " for cellId(%d), rbId(%d) Failed: reason (%d)",
1112 cfg->cellId, cfg->cfgEnt[idx].rbId, entCfgCfm->reason);
1114 if (entCfgCfm->reason == CPJ_CFG_REAS_PDCPID_UNKWN)
1116 PJ_MEM_CPY(entCfgCfm, entDlCfgCfm,sizeof(CpjCfmEnt));
1120 else if(PJ_DRB == entCfg->rbType)
1122 if(entCfg->m.modCfg.hdrCompCfg.hdrCompUsed)
1124 cfmType |= PJ_CFG_ASYNC_CFM;
1128 #endif /* PJ_CMP_ASYNC */
1130 if ((entDlCfgCfm->reason != CPJ_CFG_REAS_PDCPID_UNKWN) &&
1131 (entDlCfgCfm->status != CPJ_CFG_CFM_OK))
1133 /* send configuration to DL instance */
1134 PJ_MEM_CPY(entCfgCfm, entDlCfgCfm,sizeof(CpjCfmEnt)); /* KW_FIX */
1137 else if ((entCfg->m.modCfg.bitFlag & 0x02) ||
1138 (entCfg->m.modCfg.hoInfo.isHoPres & CPJ_HO_DL))
1140 /* send configuration to DL instance */
1141 PJ_MEM_CPY(entCfgCfm, entDlCfgCfm,sizeof(CpjCfmEnt)); /* KW_FIX */
1145 case CPJ_CFG_DELETE:
1147 /* Delete the existing RB entity configuration */
1148 if (pjCfgDelUlRb(gCb,ueCb,entCfg, entCfgCfm) != ROK)
1151 RLOG_ARG3(L_ERROR,DBG_UEID,cfg->ueId, "Ul RB Delete for"
1152 "cellId(%d), rbId(%d) Failed: reason (%d)",
1153 cfg->cellId, cfg->cfgEnt[idx].rbId, entCfgCfm->reason);
1156 if ((entDlCfgCfm->status != CPJ_CFG_CFM_OK) || (entCfgCfm->status != CPJ_CFG_CFM_OK))
1158 PJ_MEM_CPY(entCfgCfm, entDlCfgCfm,
1159 sizeof(CpjCfmEnt)); /* KW_FIX */
1164 case CPJ_CFG_REESTABLISH:
1166 /* Re-establish the existing RB entity configuration */
1167 if (pjCfgReEstUlRb(gCb,ueCb,entCfg, entCfgCfm, entDlCfgCfm) != ROK)
1169 RLOG_ARG3(L_ERROR,DBG_UEID,cfg->ueId, "UL RB Re-establish "
1170 "for cellId(%d), rbId(%d) Failed: reason (%d)",
1171 cfg->cellId, cfg->cfgEnt[idx].rbId, entCfgCfm->reason);
1176 cfmType |= PJ_CFG_REEST_ASYNC_CFM;
1182 case CPJ_CFG_DELETE_UE:
1184 /* Delete all RB entity configuration under UE */
1185 if (pjCfgDelUlUe(gCb,ueCb,entCfg, entCfgCfm) != ROK)
1188 RLOG_ARG3(L_ERROR,DBG_UEID,cfg->ueId, "UL UE Delete for "
1189 "cellId(%d), rbId(%d) Failed: reason (%d)",
1190 cfg->cellId, cfg->cfgEnt[idx].rbId, entCfgCfm->reason);
1193 #if (defined(PJ_SEC_ASYNC) || defined(PJ_CMP_ASYNC))
1196 /* Wait for any messages in the Demand q to be processed */
1197 cfmType |= PJ_CFG_UEDEL_ASYNC_CFM;
1200 #endif /* (defined(PJ_SEC_ASYNC) || defined(PJ_CMP_ASYNC)) */
1201 if (entDlCfgCfm->status == CPJ_CFG_CFM_OK)
1203 PJ_MEM_CPY(entCfgCfm, entDlCfgCfm,
1204 sizeof(CpjCfmEnt)); /* KW_FIX */
1210 PJ_CFG_FILL_CFG_CFM(entCfgCfm, entCfg->rbId, entCfg->rbType,
1211 CPJ_CFG_CFM_NOK, CPJ_CFG_REAS_INVALID_CFG);
1214 RLOG_ARG4(L_ERROR,DBG_UEID,cfg->ueId, "Cfg Req with Invalid Cfg"
1215 "Type cellId(%d), cfgType(%d), rbId(%d)) Failed: reason (%d)",
1216 cfg->cellId, entCfg->cfgType,
1217 cfg->cfgEnt[idx].rbId, CPJ_CFG_REAS_INVALID_CFG);
1221 /* ccpu00137221 : KW Fix */
1224 PJ_CFG_FILL_CFG_CFM(entCfgCfm, entCfg->rbId, entCfg->rbType,
1225 CPJ_CFG_CFM_NOK,CPJ_CFG_REAS_UE_UNKWN);
1229 /* Assign number of entity configuraitons and suId */
1230 cfgCfm->transId = cfgInfo->uprLyrTransId;
1231 cfgCfm->ueId = cfg->ueId;
1232 cfgCfm->cellId = cfg->cellId;
1233 cfgCfm->numEnt = cfg->numEnt;
1234 /* ccpu00137221 : KW Fix */
1240 if (cfmType & PJ_CFG_REEST_ASYNC_CFM)
1242 if (ueCb->libInfo.numReEstCmp > 0)
1244 if (ueCb->libInfo.numReEstCmp > ueCb->libInfo.numReEstDrb)
1247 ueCb->libInfo.numReEstDrb = 0;
1248 ueCb->libInfo.numReEstCmp = 0;
1252 ueCb->libInfo.numReEstDrb -= ueCb->libInfo.numReEstCmp;
1253 ueCb->libInfo.numReEstCmp = 0;
1256 if (ueCb->libInfo.numReEstDrb == 0)
1259 pjUtlUlSaveCfmInfo(gCb, ueCb, cfmType, startTmr, ENTPJ, (PTR)cfgCfm, (PTR)cfg);
1261 pjUtlUlUpdUpSecKeys(gCb, ueCb);
1263 /* Memory leak fix ccpu00135359 */
1264 cpjSap = &(tPjCb->u.ulCb->cpjSap);
1265 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, cfgCfm, sizeof(CpjCfgCfmInfo));
1271 pjUtlUlSaveCfmInfo(gCb, ueCb, cfmType, startTmr, ENTPJ, (PTR)cfgCfm, (PTR)cfg);
1272 cpjSap = &(gCb->u.ulCb->cpjSap);
1273 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, cfgCfm, sizeof(CpjCfgCfmInfo));
1281 pjUtlUlSaveCfmInfo(gCb, ueCb, cfmType, startTmr, ENTPJ, (PTR)cfgCfm, (PTR)cfg);
1282 /* Memory leak fix ccpu00135359 */
1283 cpjSap = &(gCb->u.ulCb->cpjSap);
1284 PJ_PST_FREE(cpjSap->pst.region, cpjSap->pst.pool, cfgCfm, sizeof(CpjCfgCfmInfo));
1293 /********************************************************************30**
1295 **********************************************************************/