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 - System Services Interface Functions
25 Desc: C source code for the interface to System Services 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=243;
33 /** @file pj_ul_ex_ms.c
34 @brief PDCP System Services 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 "kwu.h" /* KWU defines */
52 #include "cpj.h" /* CPJ defines */
53 #include "pju.h" /* PJU defines */
54 #include "lpj.h" /* LPJ defines */
55 #include "pj_err.h" /* Err defines */
56 #include "pj_env.h" /* RLC environment options */
57 #include "pj.h" /* RLC defines */
62 /* extern (.x) include files */
63 #include "gen.x" /* general */
64 #include "ssi.x" /* system services */
66 #include "cm5.x" /* common timer library */
67 #include "cm_tkns.x" /* common tokens */
68 #include "cm_mblk.x" /* common memory allocation */
69 #include "cm_llist.x" /* common link list */
70 #include "cm_hash.x" /* common hash list */
71 #include "cm_lte.x" /* common LTE includes */
72 #include "cm_lib.x" /* common memory allocation library */
73 #include "kwu.x" /* KWU */
74 #include "cpj.x" /* CPJ defines */
75 #include "pju.x" /* PJU defines */
76 #include "lpj.x" /* LPJ defines */
83 #include "pj_tenb_stats.x"
85 #include "l2_tenb_stats.x"
88 #if (defined(TENB_STATS) && !(defined(L2_L3_SPLIT)))
89 #include "l2_tenb_stats.x"
92 EXTERN Void pjMsNativeSpaccProcessUlOutput(Void);
93 EXTERN Void EgTLSendMsg(Bool);
94 /***********************************************************************
95 System Service Interface Functions
96 ***********************************************************************/
101 * <b> Activates Initialization </b>
104 * This function is invoked by system services to initialize the LTE-PDCP
105 * layer. This is an entry point used by LTE_PDCP layer to initialize its
106 * global variables, before becoming operational.
108 * Allowable values for parameters are specified in ssi.h.
110 * @param[in] ent - Specify the entity id of the LTE-RLC task.
111 * @param[in] inst - Specify the entity id of the LTE-RLC task.
112 * @param[in] region - Specifies the memory region from which
113 * LTE-PDCP should allocate structures and buffers.
114 * @param[in] reason - Specifies the reason for calling this
115 * initialization function.
122 PUBLIC S16 pjUlActvInit
124 Ent ent, /* entity */
125 Inst inst, /* instance */
126 Region region, /* region */
127 Reason reason /* reason */
130 PUBLIC S16 pjUlActvInit(ent, inst, region, reason)
131 Ent ent; /* entity */
132 Inst inst; /* instance */
133 Region region; /* region */
134 Reason reason; /* reason */
140 if (inst >= PJ_MAX_PDCP_INSTANCES)
142 /* intance greater than MAX instances */
146 if (pjCb[inst] != NULLP)
151 if (SGetSBuf(region, 0, (Data **)&tPjCb,
152 (Size)sizeof (PjCb)) != ROK)
156 /* Initialize kwCb */
157 PJ_MEM_SET(tPjCb, 0, sizeof(PjCb));
159 /* Initialize task configuration parameters */
160 /* We will take only entity name */
161 tPjCb->init.ent = ent; /* entity */
162 tPjCb->init.inst = inst; /* instance */
163 tPjCb->init.region = region; /* static region */
164 tPjCb->init.pool = 0; /* static pool */
165 tPjCb->init.reason = reason; /* reason */
166 tPjCb->init.cfgDone = FALSE; /* configuration done */
167 tPjCb->init.acnt = TRUE; /* enable accounting */
168 tPjCb->init.usta = TRUE; /* enable unsolicited status */
169 tPjCb->init.trc = FALSE; /* enable trace */
171 tPjCb->init.dbgMask = 0x00000;
173 tPjCb->init.procId = SFndProcId();
176 #if (defined(TENB_STATS) && !(defined(L2_L3_SPLIT)))
177 TSL2AllocStatsMem(tPjCb->init.region, tPjCb->init.pool);
188 * <b> Activation Task </b>
191 * Processes events received for LTE-PDCP layer via System Services from
194 * @param[in] pst - Pst Structure
195 * @param[in] mBuf - Message Buffer
202 PUBLIC S16 pjUlActvTsk
204 Pst *pst, /* pst structure */
205 Buffer *mBuf /* message buffer */
208 PUBLIC S16 pjUlActvTsk(pst, mBuf)
209 Pst *pst; /* pst structure */
210 Buffer *mBuf; /* message buffer */
224 case LPJ_EVT_CFG_REQ:
226 ret = cmUnpkLpjCfgReq(PjMiLpjCfgReq, pst, mBuf);
230 case LPJ_EVT_CNTRL_REQ:
232 ret = cmUnpkLpjCntrlReq(PjMiLpjCntrlReq, pst, mBuf);
236 case LPJ_EVT_STS_REQ:
238 ret = cmUnpkLpjStsReq(PjMiLpjStsReq, pst, mBuf);
242 case LPJ_EVT_STA_REQ:
244 ret = cmUnpkLpjStaReq(PjMiLpjStaReq, pst, mBuf);
247 /* kw005.201 added support for L2 Measurement */
249 case LPJ_EVT_L2MEAS_REQ:
251 ret = cmUnpkLpjL2MeasReq(PjMiLpjL2MeasReq, pst, mBuf);
254 case LPJ_EVT_L2MEAS_SEND_REQ:
257 ret = cmUnpkLpjL2MeasSendReq(PjMiLpjL2MeasSendReq, pst, mBuf);
261 case LPJ_EVT_L2MEAS_STOP_REQ:
263 ret = cmUnpkLpjL2MeasStopReq(PjMiLpjL2MeasStopReq, pst, mBuf);
270 RLOG1(L_ERROR, "Received Invalid Event[%d] from SM", pst->event);
286 cmUnpkCpjKdfReq(PjUiCpjKdfReq, pst, mBuf);
292 RLOG1(L_ERROR, "Received Invalid Event[%d] from APP", pst->event);
306 cmUnpkPjUdxBndCfm(PjUlUdxBndCfm, pst, mBuf);
312 cmUnpkPjUdxCfgCfm(PjUlUdxCfgCfm, pst, mBuf);
318 cmUnpkPjUdxReEstCfm(PjUlUdxReEstCfm, pst, mBuf);
322 case EVTUDXSECCFGCFM:
324 cmUnpkPjUdxSecCfgCfm(PjUlUdxSecCfgCfm, pst, mBuf);
328 case EVTUDXUEIDCHGCFM:
330 cmUnpkPjUdxUeIdChgCfm(PjUlUdxUeIdChgCfm, pst, mBuf);
336 cmUnpkPjUdxCountCfm(PjUlUdxCountCfm, pst, mBuf);
340 case EVTUDXSDUSTACFM:
342 cmUnpkPjUdxSduStaCfm(PjUlUdxSduStaCfm, pst, mBuf);
345 case EVTUDXDATRESUMECFM:
347 cmUnpkPjUdxDatResumeCfm(PjUlUdxDatResumeCfm, pst, mBuf);
350 case EVTUDXDATFRWDCFM:
352 cmUnpkPjUdxDatForwardCfm(PjUlUdxDatForwardCfm, pst, mBuf);
358 RLOG1(L_ERROR, "Received Invalid Event[%d] from PDCP DL", pst->event);
374 cmUnpkCpjBndReq(PjUiCpjBndReq, pst, mBuf);
380 cmUnpkCpjUbndReq(PjUiCpjUbndReq, pst, mBuf);
386 cmUnpkCpjCfgReq(PjUiCpjCfgReq, pst, mBuf);
392 cmUnpkCpjReEstReq(PjUiCpjReEstReq, pst, mBuf);
396 case EVTCPJSECCFGREQ:
398 cmUnpkCpjSecCfgReq(PjUiCpjSecCfgReq, pst, mBuf);
402 case EVTCPJUEIDCHGREQ:
404 cmUnpkCpjUeIdChgReq(PjUiCpjUeIdChgReq, pst, mBuf);
410 cmUnpkCpjCountReq(PjUiCpjCountReq, pst, mBuf);
414 case EVTCPJSDUSTAREQ:
416 cmUnpkCpjSduStaReq(PjUiCpjSduStaReq, pst, mBuf);
419 case EVTCPJSTARTDATAFWDREQ: /* Start Data Forwarding Request from RRC user for Source eNB during HO */
421 cmUnpkCpjStartDataFwdReq(PjUiCpjDatForwardReq, pst, mBuf);
424 case EVTCPJDATRESUMEREQ: /* Data Resume Request from RRC user during Re-establishment */
426 cmUnpkCpjDatResumeReq(PjUiCpjDatResumeReq, pst, mBuf);
433 cmUnpkPjuBndReq(PjUiPjuBndReq, pst, mBuf);
439 cmUnpkPjuUbndReq(PjUiPjuUbndReq, pst, mBuf);
443 case EVTPJUDATFWDREQ:
445 cmUnpkPjuDatFwdReq(PjUiPjuDatFwdReq, pst, mBuf);
451 RLOG1(L_ERROR, "Received Invalid Event[%d] from RRC",pst->event);
465 cmUnpkPjuBndReq(PjUiPjuBndReq, pst, mBuf);
471 cmUnpkPjuUbndReq(PjUiPjuUbndReq, pst, mBuf);
477 cmUnpkPjuDatReq(PjUiPjuDatReq, pst, mBuf);
481 case EVTPJUDATFWDREQ:
483 cmUnpkPjuDatFwdReq(PjUiPjuDatFwdReq, pst, mBuf);
489 RLOG1(L_ERROR, "Received Invalid Event[%d] from Relay", pst->event);
501 /* Compression Confirmations */
502 case OBD_EVT_CMP_INIT_CFM:
503 ret = cmUnpkLibObdCmpInitCfm(PjLibObdCmpInitCfm, pst, mBuf);
506 case OBD_EVT_DECMP_CFM:
507 ret = cmUnpkLibObdDecmpCfm(PjLibObdDecmpCfm, pst, mBuf);
509 #endif /* PJ_CMP_ASYNC */
512 RLOG1(L_ERROR, "Received Invalid Event[%d] from Offboard Compression",pst->event);
524 /* Integrity Confirmations */
525 case OBD_EVT_INT_INIT_CFM:
526 ret = cmUnpkLibObdIntInitCfm(PjLibObdIntInitCfm, pst, mBuf);
529 case OBD_EVT_INT_VER_CFM:
530 ret = cmUnpkLibObdIntVerCfm(PjLibObdIntVerCfm, pst, mBuf);
533 /* Ciphering Confirmations */
534 case OBD_EVT_CP_INIT_CFM:
535 ret = cmUnpkLibObdCpInitCfm(PjLibObdCpInitCfm, pst, mBuf); /* TODO - Only Dl path? */
538 case OBD_EVT_UP_INIT_CFM:
539 ret = cmUnpkLibObdUpInitCfm(PjLibObdUpInitCfm, pst, mBuf); /* TODO - Only Dl path? */
542 case OBD_EVT_DECIPHER_CFM:
543 ret = cmUnpkLibObdDecipherCfm(PjLibObdDecipherCfm, pst, mBuf);
545 #endif /* PJ_SEC_ASYNC */
548 RLOG1(L_ERROR, "Received Invalid Event[%d] from Offboard Security",pst->event);
559 case KWU_EVT_BND_CFM: /* Bind request */
561 ret = cmUnpkKwuBndCfm(PjLiKwuBndCfm, pst, mBuf );
565 case KWU_EVT_DAT_IND: /* Coomon Channel Data request */
567 ret = cmUnpkKwuDatInd(PjLiKwuDatInd, pst, mBuf);
571 case KWU_EVT_REEST_CMP_IND: /* Dedicated Channel Status Response */
573 ret = cmUnpkKwuReEstCmpInd(PjLiKwuReEstCmpInd, pst, mBuf);
577 case KWU_EVT_DAT_ACK_IND: /* Harq status indication */
579 ret = cmUnpkKwuDatAckInd(PjLiKwuDatAckInd, pst, mBuf);
586 RLOG1(L_ERROR, "Received Invalid Event[%d] from RLC", pst->event);
595 #if (defined(TENB_STATS) && !(defined(L2_L3_SPLIT)))
603 tPjCb = PJ_GET_PJCB(pst->dstInst);
604 TSL2SendStatsToApp(&(tPjCb->pjGenCfg.lmPst), 0);
610 printf("\n ERROR Invalid Event[%d] from CL to PDCPUL\n",
619 #if (defined(TENB_AS_SECURITY) && defined(UL_DL_SPLIT))
626 pjMsNativeSpaccProcessUlOutput();
630 EgTLSendMsg(FALSE); /* Arg FALSE is req if ENB_CPU_OVERLOAD_CONTROL is enabled,
631 just to control the num of pkts to be sent over the socket*/
643 RLOG1(L_ERROR, "Received Invalid Src Entity[%d]", pst->event);
656 /********************************************************************30**
658 **********************************************************************/