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-RLC Layer - System Services Interface Functions
25 Desc: C source code for the interface to System Services
30 *********************************************************************21*/
31 static const char* RLOG_MODULE_NAME="RLC_DL";
32 static int RLOG_MODULE_ID=2048;
33 static int RLOG_FILE_ID=195;
35 /** @filekw_dl_ex_ms.c
36 @brief RLC System Services Interface
40 /* header (.h) include files */
41 #include "common_def.h"
42 #include "lkw.h" /* LKW defines */
43 #include "ckw.h" /* CKW defines */
44 #include "kwu.h" /* KWU defines */
45 #include "rgu.h" /* RGU defines */
46 #include "kw_err.h" /* Err defines */
47 #include "kw_env.h" /* RLC environment options */
48 #include "kw.h" /* RLC defines */
53 /* extern (.x) include files */
54 #include "lkw.x" /* LKW */
55 #include "ckw.x" /* CKW */
56 #include "kwu.x" /* KWU */
57 #include "rgu.x" /* RGU */
61 #include "du_app_rlc_inf.h"
62 #include "rlc_mac_inf.h"
65 S16 rlcUtlDlBatchProcPkts(Void);
66 S16 rlcDlBatchProc(Void);
67 #if (defined(MAC_RLC_HARQ_STA_RBUF) && defined(LTE_L2_MEAS))
68 uint32_t isDatReqProcessed;
69 void rlcUtlDlBatchProcHqStaInd ARGS ((Void));
72 #if (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF))
73 S16 rlcDlBatchProcSplit ARGS((Void));
77 uint32_t rlcAmmStaPduList[512] = {0};
78 S16 ssGetDBufOfSize ARGS((Region region, Size size, Buffer **dBuf));
80 S16 rlcDlInitExt ARGS (( Void ));
86 * <b> Initialize External </b>
89 * Initializes variables used to interface with Upper/Lower Layer
103 /***********************************************************************
104 System Service Interface Functions
105 ***********************************************************************/
110 * <b> Activates Initialization </b>
113 * This function is invoked by system services to initialize the LTE-RLC
114 * layer. This is an entry point used by LTE_RLC layer to initialize its
115 * global variables, before becoming operational.
117 * Allowable values for parameters are specified in ssi.h.
119 * @param[in] ent - Specify the entity id of the LTE-RLC task.
120 * @param[in] inst - Specify the entity id of the LTE-RLC task.
121 * @param[in] region - Specifies the memory region from which
122 * LTE-RLC should allocate structures and buffers.
123 * @param[in] reason - Specifies the reason for calling this
124 * initialization function.
132 Ent ent, /* entity */
133 Inst inst, /* instance */
134 Region region, /* region */
135 Reason reason /* reason */
140 if (inst >= MAX_RLC_INSTANCES)
142 /* intance greater than MAX instances */
146 if (rlcCb[inst] != NULLP)
151 if (SGetSBuf(region, 0, (Data **)&tRlcCb,
152 (Size)sizeof (RlcCb)) != ROK)
156 /* Initialize rlcCb */
157 RLC_MEM_SET(tRlcCb, 0, sizeof(RlcCb));
159 /* Initialize task configuration parameters */
160 tRlcCb->init.ent = ent; /* entity */
161 tRlcCb->init.inst = inst; /* instance */
162 tRlcCb->init.region = region; /* static region */
163 tRlcCb->init.pool = 0; /* static pool */
164 tRlcCb->init.reason = reason; /* reason */
165 tRlcCb->init.cfgDone = FALSE; /* configuration done */
166 tRlcCb->init.acnt = TRUE; /* enable accounting */
167 tRlcCb->init.usta = TRUE; /* enable unsolicited status */
168 tRlcCb->init.trc = FALSE; /* enable trace */
169 tRlcCb->init.procId = ODU_GET_PROCID();
171 rlcCb[inst] = tRlcCb;
175 for(int i = 0; i < 512; i++)
178 Buffer *bufPtr = NULL;
179 SGetMsg(1, 0 , &mBuf);
180 ssGetDBufOfSize(1 , 1800, &bufPtr);
181 SUpdMsg(mBuf, bufPtr, 0);
182 rlcAmmStaPduList[i] = (uint32_t)mBuf;
185 /* call external function for intialization */
200 * <b> Activation Task </b>
203 * Processes events received for MLTE-RLC layer via System Services from
206 * @param[in] pst - Pst Structure
207 * @param[in] mBuf - Message Buffer
213 #if (defined (MAC_FREE_RING_BUF) || defined (RLC_FREE_RING_BUF))
214 pthread_t gRlcTId = 0;
218 Pst *pst, /* pst structure */
219 Buffer *mBuf /* message buffer */
224 #ifdef RLC_FREE_RING_BUF
225 gRlcTId = pthread_self();
235 case LKW_EVT_CFG_REQ:
237 ret = unpackRlcConfigReq(RlcMiRlcConfigReq, pst, mBuf);
241 case LKW_EVT_CNTRL_REQ:
243 ret = cmUnpkLkwCntrlReq(RlcMiLkwCntrlReq, pst, mBuf);
247 case LKW_EVT_STS_REQ:
249 ret = cmUnpkLkwStsReq(RlcMiLkwStsReq, pst, mBuf);
253 case LKW_EVT_STA_REQ:
255 ret = cmUnpkLkwStaReq(RlcMiLkwStaReq, pst, mBuf);
258 /* kw005.201 added support for L2 Measurement */
262 case KWU_EVT_DAT_REQ: /* Data request */
264 //ret = cmUnpkKwuDatReq(rlcProcDlData, pst, mBuf);
269 case EVENT_DL_RRC_MSG_TRANS_TO_RLC:
271 ret = unpackDlRrcMsgToRlc(RlcProcDlRrcMsgTransfer, pst, mBuf);
275 ODU_PUT_MSG_BUF(mBuf);
276 if (pst->dstInst < MAX_RLC_INSTANCES)
278 RLOG1(L_ERROR,"Received Invalid Event[%d] from SM",
294 case UDX_EVT_BND_REQ: /* Bind request */
296 ret = cmUnpkUdxBndReq(rlcDlUdxBndReq, pst, mBuf );
300 case UDX_EVT_UBND_REQ: /* Bind request */
302 ret = cmUnpkUdxUbndReq(rlcDlUdxUbndReq, pst, mBuf );
305 case UDX_EVT_CFG_REQ: /* Unbind request */
307 ret = cmUnpkUdxCfgReq(rlcDlUdxCfgReq, pst, mBuf );
311 case UDX_EVT_UEIDCHG_REQ: /* Configuration request */
313 ret = cmUnpkUdxUeIdChgReq(rlcDlUdxUeIdChgReq, pst, mBuf);
317 case UDX_EVT_STA_UPD_REQ: /* Configuration request */
319 ret = cmUnpkUdxStaUpdReq(rlcDlUdxStaUpdReq, pst, mBuf);
323 case UDX_EVT_STA_PDU_REQ: /* Configuration request */
325 ret = cmUnpkUdxStaPduReq(rlcDlUdxStaPduReq, pst, mBuf);
330 case UDX_EVT_L2MEAS_REQ:
332 ret = cmUnpkUdxL2MeasReq(rlcDlUdxL2MeasReq, pst, mBuf);
335 case UDX_EVT_L2MEAS_SEND_REQ:
338 ret = cmUnpkUdxL2MeasSendReq(rlcDlUdxL2MeasSendReq, pst, mBuf);
342 case UDX_EVT_L2MEAS_STOP_REQ:
344 ret = cmUnpkUdxL2MeasStopReq(rlcDlUdxL2MeasStopReq, pst, mBuf);
350 case UDX_EVT_DL_CLEANUP_MEM:
352 rlcUtlFreeDlMemory(RLC_GET_RLCCB(pst->dstInst));
357 ODU_PUT_MSG_BUF(mBuf);
358 if (pst->dstInst < MAX_RLC_INSTANCES)
360 RLOG1(L_ERROR,"Received Invalid Event[%d] from RLC UL",
375 case KWU_EVT_BND_REQ: /* Bind request */
377 ret = cmUnpkKwuBndReq(RlcUiKwuBndReq, pst, mBuf );
381 case KWU_EVT_UBND_REQ: /* Unbind request */
383 ret = cmUnpkKwuUbndReq(RlcUiKwuUbndReq, pst, mBuf );
387 case KWU_EVT_CPLANE_DAT_REQ: /* C-Plane Data request */
389 ret = cmUnpkKwuDatReq(rlcProcDlData, pst, mBuf);
393 case KWU_EVT_DAT_REQ: /* Data request */
395 //ret = cmUnpkKwuDatReq(rlcProcDlData, pst, mBuf);
399 case KWU_EVT_DISC_SDU_REQ: /* Discard SDU request */
401 ret = cmUnpkKwuDiscSduReq(RlcUiKwuDiscSduReq, pst, mBuf);
407 ODU_PUT_MSG_BUF(mBuf);
408 if (pst->dstInst < MAX_RLC_INSTANCES)
410 RLOG1(L_ERROR,"Received Invalid Event[%d] from RRC",
425 case KWU_EVT_BND_REQ: /* Bind request */
427 ret = cmUnpkKwuBndReq(RlcUiKwuBndReq, pst, mBuf );
431 case KWU_EVT_UBND_REQ: /* Unbind request */
433 ret = cmUnpkKwuUbndReq(RlcUiKwuUbndReq, pst, mBuf );
437 case KWU_EVT_CPLANE_DAT_REQ: /* C-Plane Data request */
438 case KWU_EVT_UPLANE_DAT_REQ: /* U-Plane Data request */
440 ret = cmUnpkKwuDatReq(rlcProcDlData, pst, mBuf);
444 case KWU_EVT_DAT_REQ: /* Data request */
446 //ret = cmUnpkKwuDatReq(rlcProcDlData, pst, mBuf);
450 case KWU_EVT_DISC_SDU_REQ: /* Discard SDU request */
452 ret = cmUnpkKwuDiscSduReq(RlcUiKwuDiscSduReq, pst, mBuf);
457 ODU_PUT_MSG_BUF(mBuf);
458 if (pst->dstInst < MAX_RLC_INSTANCES)
460 RLOG1(L_ERROR,"Received Invalid Event[%d] from PDCP",
475 case EVTRGUBNDCFM: /* Bind request */
477 ret = cmUnpkRguBndCfm(RlcLiRguBndCfm, pst, mBuf );
480 case EVENT_SCHED_RESULT_TO_RLC:
482 ret = unpackSchedResultRpt(RlcProcSchedResultRpt, pst, mBuf);
485 /* kw005.201 added support for L2 Measurement */
487 case EVTRGUHQSTAIND: /* Harq status indication */
489 ret = cmUnpkRguHqStaInd(RlcLiRguHqStaInd, pst, mBuf);
493 case EVTRGUFLOWCNTRLIND:
495 ret = cmUnpkRguFlowCntrlInd(RlcLiRguFlowCntrlInd,pst,mBuf);
499 #ifdef RLC_STA_PROC_IN_MAC/* RLC Status PDU Processing */
500 case UDX_EVT_STA_UPD_REQ: /* Configuration request */
502 ret = cmUnpkUdxStaUpdReq(rlcDlUdxStaUpdReq, pst, mBuf);
508 ODU_PUT_MSG_BUF(mBuf);
509 if (pst->dstInst < MAX_RLC_INSTANCES)
511 RLOG1(L_ERROR,"Received Invalid Event[%d] from MAC",
524 case EVTCTFBTCHPROCTICK:
526 rlcUtlDlBatchProcPkts();
530 ODU_PUT_MSG_BUF(mBuf);
538 case KWU_EVT_TTI_IND:
540 #if (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF))
541 rlcDlBatchProcSplit();
543 #if defined(PDCP_RLC_DL_RBUF)
548 #if (defined(SPLIT_RLC_DL_TASK) && defined(MAC_RLC_HARQ_STA_RBUF) && defined(LTE_L2_MEAS))
549 //RlcDlHarqStaBatchProc();
550 rlcUtlDlBatchProcHqStaInd();
552 #ifndef KWSELFPSTDLCLEAN
554 /* Moving Cleanup from self post event to TTI event */
558 ODU_PUT_MSG_BUF(mBuf);
568 if (pst->dstInst < MAX_RLC_INSTANCES)
570 /*RlcCb *tRlcCb = RLC_GET_RLCCB(pst->dstInst);*/
571 RLOG1(L_ERROR, "Received Invalid Source Entity[%d]",
574 ODU_PUT_MSG_BUF(mBuf);
586 /********************************************************************30**
588 **********************************************************************/