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*/
31 static const char* RLOG_MODULE_NAME="PDCP";
32 static int RLOG_MODULE_ID=1024;
33 static int RLOG_FILE_ID=217;
34 /** @file pj_dl_ex_ms.c
35 @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 "ctf.h" /* CPJ defines */
54 #include "pju.h" /* PJU defines */
55 #include "lpj.h" /* LPJ defines */
56 #include "pj_err.h" /* Err defines */
57 #include "pj_env.h" /* RLC environment options */
58 #include "pj.h" /* RLC defines */
64 /* extern (.x) include files */
65 #include "gen.x" /* general */
66 #include "ssi.x" /* system services */
68 #include "cm5.x" /* common timer library */
69 #include "cm_tkns.x" /* common tokens */
70 #include "cm_mblk.x" /* common memory allocation */
71 #include "cm_llist.x" /* common link list */
72 #include "cm_hash.x" /* common hash list */
73 #include "cm_lte.x" /* common LTE includes */
74 #include "cm_lib.x" /* common memory allocation library */
75 #include "kwu.x" /* KWU */
76 #include "cpj.x" /* CPJ defines */
77 #include "pju.x" /* PJU defines */
78 #include "lpj.x" /* LPJ defines */
87 PUBLIC S16 pjBatchProcTick(Void);
88 EXTERN S16 pjRBufFreeMsg(void);
93 EXTERN void egWrReadRingBuf(SsRngBufId ringId);
96 PUBLIC U32 ysPjPrcTtiInd = 0; /* UDAY */
98 /***********************************************************************
99 System Service Interface Functions
100 ***********************************************************************/
105 * <b> Activates Initialization </b>
108 * This function is invoked by system services to initialize the LTE-PDCP
109 * layer. This is an entry point used by LTE_PDCP layer to initialize its
110 * global variables, before becoming operational.
112 * Allowable values for parameters are specified in ssi.h.
114 * @param[in] ent - Specify the entity id of the LTE-RLC task.
115 * @param[in] inst - Specify the entity id of the LTE-RLC task.
116 * @param[in] region - Specifies the memory region from which
117 * LTE-PDCP should allocate structures and buffers.
118 * @param[in] reason - Specifies the reason for calling this
119 * initialization function.
126 PUBLIC S16 pjDlActvInit
128 Ent ent, /* entity */
129 Inst inst, /* instance */
130 Region region, /* region */
131 Reason reason /* reason */
134 PUBLIC S16 pjDlActvInit(ent, inst, region, reason)
135 Ent ent; /* entity */
136 Inst inst; /* instance */
137 Region region; /* region */
138 Reason reason; /* reason */
143 if (inst >= PJ_MAX_PDCP_INSTANCES)
145 /* intance greater than MAX instances */
149 if (pjCb[inst] != NULLP)
154 if (SGetSBuf(region, 0, (Data **)&tPjCb,
155 (Size)sizeof (PjCb)) != ROK)
159 /* Initialize kwCb */
160 PJ_MEM_SET(tPjCb, 0, sizeof(PjCb));
162 /* Initialize task configuration parameters */
163 /* We will take only entity name */
164 tPjCb->init.ent = ent; /* entity */
165 tPjCb->init.inst = inst; /* instance */
166 tPjCb->init.region = region; /* static region */
167 tPjCb->init.pool = 0; /* static pool */
168 tPjCb->init.reason = reason; /* reason */
169 tPjCb->init.cfgDone = FALSE; /* configuration done */
170 tPjCb->init.acnt = TRUE; /* enable accounting */
171 tPjCb->init.usta = TRUE; /* enable unsolicited status */
172 tPjCb->init.trc = FALSE; /* enable trace */
174 tPjCb->init.dbgMask = 0x00000000;
176 tPjCb->init.procId = SFndProcId();
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 pjDlActvTsk
204 Pst *pst, /* pst structure */
205 Buffer *mBuf /* message buffer */
208 PUBLIC S16 pjDlActvTsk(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 */
251 RLOG0(L_ERROR, "Received Invalid Event from SM");
267 cmUnpkPjUdxBndReq(PjDlUdxBndReq, pst, mBuf);
273 cmUnpkPjUdxUbndReq(PjDlUdxUbndReq, pst, mBuf);
279 cmUnpkPjUdxCfgReq(PjDlUdxCfgReq, pst, mBuf);
285 cmUnpkPjUdxUlStaRep(PjDlUdxUlStaRep, pst, mBuf);
291 cmUnpkPjUdxDlStaRep(PjDlUdxDlStaRep, pst, mBuf);
295 case EVTUDXULROHCFDB:
297 cmUnpkPjUdxUlFdbkPkt(PjDlUdxUlFdbkPktInfo, pst, mBuf);
301 case EVTUDXDLROHCFDB:
303 cmUnpkPjUdxDlFdbkPkt(PjDlUdxDlFdbkPktInfo, pst, mBuf);
309 cmUnpkPjUdxReEstReq(PjDlUdxReEstReq, pst, mBuf);
313 case EVTUDXSECCFGREQ:
315 cmUnpkPjUdxSecCfgReq(PjDlUdxSecCfgReq, pst, mBuf);
319 case EVTUDXUEIDCHGREQ:
321 cmUnpkPjUdxUeIdChgReq(PjDlUdxUeIdChgReq, pst, mBuf);
327 cmUnpkPjUdxCountReq(PjDlUdxCountReq, pst, mBuf);
331 case EVTUDXSDUSTAREQ:
333 cmUnpkPjUdxSduStaReq(PjDlUdxSduStaReq, pst, mBuf);
336 case EVTUDXDATRESUME:
338 #ifdef FLAT_BUFFER_OPT
339 cmUnpkPjUdxDatResumeReq(PjDlUdxDatResumeReq, pst, mBuf);
341 cmUnpkPjUdxDatResumeReq(PjDlUdxDatResumeReq, pst, mBuf);
347 #ifdef FLAT_BUFFER_OPT
348 printf("Received Event EVTUDXDATFRWD at PDCP DL \n");
349 cmUnpkPjUdxDatForwardReq(PjDlUdxDatForwardReqFB, pst, mBuf);
351 cmUnpkPjUdxDatForwardReq(PjDlUdxDatForwardReq, pst, mBuf);
356 case PJ_UDX_EVT_L2MEAS_REQ:
358 ret = cmUnpkPjUdxL2MeasReq(PjDlUdxL2MeasReq, pst, mBuf);
361 case PJ_UDX_EVT_L2MEAS_SEND_REQ:
364 ret = cmUnpkPjUdxL2MeasSendReq(PjDlUdxL2MeasSendReq, pst, mBuf);
368 case PJ_UDX_EVT_L2MEAS_STOP_REQ:
370 ret = cmUnpkPjUdxL2MeasStopReq(PjDlUdxL2MeasStopReq, pst, mBuf);
376 RLOG0(L_ERROR, "Received Invalid Event from PDCP UL");
393 cmUnpkPjuBndReq(PjUiPjuBndReq, pst, mBuf);
399 cmUnpkPjuUbndReq(PjUiPjuUbndReq, pst, mBuf);
405 cmUnpkPjuDatReq(PjUiPjuDatReq, pst, mBuf);
409 case EVTPJUDATFWDREQ:
411 cmUnpkPjuDatFwdReq(PjUiPjuDatFwdReq, pst, mBuf);
417 RLOG0(L_ERROR, " Received Invalid Event From RRC");
432 cmUnpkPjuBndReq(PjUiPjuBndReq, pst, mBuf);
438 cmUnpkPjuUbndReq(PjUiPjuUbndReq, pst, mBuf);
445 cmUnpkFpPjuDatReq(PjUiPjuDatReq, pst, mBuf);
447 cmUnpkPjuDatReq(PjUiPjuDatReq, pst, mBuf);
452 case EVTPJUDATFWDREQ:
454 cmUnpkPjuDatFwdReq(PjUiPjuDatFwdReq, pst, mBuf);
458 #ifdef PCAP_IP_DATGEN_LOAD_5GTF
459 case EVTPCAPIPDATIND:
461 //printf("ENTPX!!!!EVTPCAPIPDATIND:\n\r ");
462 //RLOG0(L_ERROR, " Received Invalid Event from Relay");
463 wrDamPcapDatInd(mBuf);
469 RLOG0(L_ERROR, " Received Invalid Event from Relay");
481 /* Compression Confirmations */
482 case OBD_EVT_CMP_INIT_CFM:
483 ret = cmUnpkLibObdCmpInitCfm(PjLibObdCmpInitCfm, pst,mBuf);
486 case OBD_EVT_CMP_CFM:
487 ret = cmUnpkLibObdCmpCfm(PjLibObdCmpCfm, pst, mBuf);
490 #endif /* PJ_CMP_ASYNC */
493 RLOG0(L_ERROR, "Received Invalid Event from Offboard Ciphering");
505 /* Integrity Confirmations */
506 case OBD_EVT_INT_INIT_CFM:
507 ret = cmUnpkLibObdIntInitCfm(PjLibObdIntInitCfm, pst, mBuf);
510 case OBD_EVT_INT_PROT_CFM:
511 ret = cmUnpkLibObdIntProtCfm(PjLibObdIntProtCfm, pst, mBuf);
514 /* Ciphering Confirmations */
515 case OBD_EVT_CP_INIT_CFM:
516 ret = cmUnpkLibObdCpInitCfm(PjLibObdCpInitCfm, pst, mBuf);
519 case OBD_EVT_UP_INIT_CFM:
520 ret = cmUnpkLibObdUpInitCfm(PjLibObdUpInitCfm, pst, mBuf);
523 case OBD_EVT_CIPHER_CFM:
524 ret = cmUnpkLibObdCipherCfm(PjLibObdCipherCfm, pst, mBuf);
527 #endif /* PJ_SEC_ASYNC */
530 RLOG0(L_ERROR, "Received Invalid Event from Offboard Security");
541 case KWU_EVT_BND_CFM: /* Bind request */
543 ret = cmUnpkKwuBndCfm(PjLiKwuBndCfm, pst, mBuf );
547 case KWU_EVT_DAT_CFM: /* Dedicated Channel Data request */
549 ret = cmUnpkKwuDatCfm(PjLiKwuDatCfm, pst, mBuf);
553 case KWU_EVT_DISC_SDU_REQ: /* Coomon Channel Status Response */
555 ret = cmUnpkKwuDiscSduReq(PjLiKwuDiscSduReq, pst , mBuf);
559 case KWU_EVT_STA_IND: /* Dedicated Channel Status Response */
561 ret = cmUnpkKwuStaInd(PjLiKwuStaInd, pst, mBuf);
564 case KWU_EVT_DISC_SDU_CFM: /* Harq status indication */
566 ret = cmUnpkKwuDiscSduCfm(PjLiKwuDiscSduCfm, pst, mBuf);
569 case KWU_EVT_FLOW_CNTRL_IND: /* Flow control indication*/
571 ret = cmUnpkKwuFlowCntrlInd(PjLiKwuFlowCntrlInd, pst, mBuf);
577 RLOG0(L_ERROR, "Received Invalid Event from RLC");
586 #ifdef TENB_AS_SECURITY
594 static U32 ttitick = 0;
597 ysPjPrcTtiInd++; /* UDAY */
599 /*Trigger batching of the packets queued for ciphering
601 /*Note: UL trigger should be posted to UL thread if UL
602 * and DL are on different threads.*/
604 #ifdef MAC_RLC_UL_RBUF
608 #ifdef XEON_SPECIFIC_CHANGES
610 PjCb *tPjCb = PJ_GET_PJCB(pst->dstInst);
611 pjPollQatDat(tPjCb,ttitick);
612 #endif /* INTEL_QAT_DP */
615 pjProcessSpaccRdWr(ttitick);
618 #if (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF))
619 #ifndef UL_RLC_NET_CLUSTER
620 pjUlBatchProcSplit();
626 #ifdef LC_EGTP_THREAD
627 egWrReadRingBuf(SS_RNG_BUF_EGTP_FREE_RING);
640 case EVTCTFBTCHPROCTICK:
645 case EVTCTFNRTRBUFCLEAN:
656 RLOG0(L_ERROR, "Recieved Invalid Source Entity ");
669 /********************************************************************30**
671 **********************************************************************/