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 EXTERN S16 rlcDlBatchProcSplit ARGS((Void));
77 uint32_t rlcAmmStaPduList[512] = {0};
78 EXTERN 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
109 /***********************************************************************
110 System Service Interface Functions
111 ***********************************************************************/
116 * <b> Activates Initialization </b>
119 * This function is invoked by system services to initialize the LTE-RLC
120 * layer. This is an entry point used by LTE_RLC layer to initialize its
121 * global variables, before becoming operational.
123 * Allowable values for parameters are specified in ssi.h.
125 * @param[in] ent - Specify the entity id of the LTE-RLC task.
126 * @param[in] inst - Specify the entity id of the LTE-RLC task.
127 * @param[in] region - Specifies the memory region from which
128 * LTE-RLC should allocate structures and buffers.
129 * @param[in] reason - Specifies the reason for calling this
130 * initialization function.
139 Ent ent, /* entity */
140 Inst inst, /* instance */
141 Region region, /* region */
142 Reason reason /* reason */
145 S16 rlcDlActvInit(ent, inst, region, reason)
146 Ent ent; /* entity */
147 Inst inst; /* instance */
148 Region region; /* region */
149 Reason reason; /* reason */
154 if (inst >= MAX_RLC_INSTANCES)
156 /* intance greater than MAX instances */
160 if (rlcCb[inst] != NULLP)
165 if (SGetSBuf(region, 0, (Data **)&tRlcCb,
166 (Size)sizeof (RlcCb)) != ROK)
170 /* Initialize rlcCb */
171 RLC_MEM_SET(tRlcCb, 0, sizeof(RlcCb));
173 /* Initialize task configuration parameters */
174 tRlcCb->init.ent = ent; /* entity */
175 tRlcCb->init.inst = inst; /* instance */
176 tRlcCb->init.region = region; /* static region */
177 tRlcCb->init.pool = 0; /* static pool */
178 tRlcCb->init.reason = reason; /* reason */
179 tRlcCb->init.cfgDone = FALSE; /* configuration done */
180 tRlcCb->init.acnt = TRUE; /* enable accounting */
181 tRlcCb->init.usta = TRUE; /* enable unsolicited status */
182 tRlcCb->init.trc = FALSE; /* enable trace */
183 tRlcCb->init.procId = ODU_GET_PROCID();
185 rlcCb[inst] = tRlcCb;
189 for(int i = 0; i < 512; i++)
192 Buffer *bufPtr = NULL;
193 SGetMsg(1, 0 , &mBuf);
194 ssGetDBufOfSize(1 , 1800, &bufPtr);
195 SUpdMsg(mBuf, bufPtr, 0);
196 rlcAmmStaPduList[i] = (uint32_t)mBuf;
199 /* call external function for intialization */
214 * <b> Activation Task </b>
217 * Processes events received for MLTE-RLC layer via System Services from
220 * @param[in] pst - Pst Structure
221 * @param[in] mBuf - Message Buffer
227 #if (defined (MAC_FREE_RING_BUF) || defined (RLC_FREE_RING_BUF))
228 pthread_t gRlcTId = 0;
233 Pst *pst, /* pst structure */
234 Buffer *mBuf /* message buffer */
237 S16 rlcDlActvTsk(pst, mBuf)
238 Pst *pst; /* pst structure */
239 Buffer *mBuf; /* message buffer */
244 #ifdef RLC_FREE_RING_BUF
245 gRlcTId = pthread_self();
255 case LKW_EVT_CFG_REQ:
257 ret = unpackRlcConfigReq(RlcMiRlcConfigReq, pst, mBuf);
261 case LKW_EVT_CNTRL_REQ:
263 ret = cmUnpkLkwCntrlReq(RlcMiLkwCntrlReq, pst, mBuf);
267 case LKW_EVT_STS_REQ:
269 ret = cmUnpkLkwStsReq(RlcMiLkwStsReq, pst, mBuf);
273 case LKW_EVT_STA_REQ:
275 ret = cmUnpkLkwStaReq(RlcMiLkwStaReq, pst, mBuf);
278 /* kw005.201 added support for L2 Measurement */
282 case KWU_EVT_DAT_REQ: /* Data request */
284 //ret = cmUnpkKwuDatReq(rlcProcDlData, pst, mBuf);
289 case EVENT_DL_RRC_MSG_TRANS_TO_RLC:
291 ret = unpackDlRrcMsgToRlc(RlcProcDlRrcMsgTransfer, pst, mBuf);
295 ODU_PUT_MSG_BUF(mBuf);
296 if (pst->dstInst < MAX_RLC_INSTANCES)
298 RLOG1(L_ERROR,"Received Invalid Event[%d] from SM",
314 case UDX_EVT_BND_REQ: /* Bind request */
316 ret = cmUnpkUdxBndReq(rlcDlUdxBndReq, pst, mBuf );
320 case UDX_EVT_UBND_REQ: /* Bind request */
322 ret = cmUnpkUdxUbndReq(rlcDlUdxUbndReq, pst, mBuf );
325 case UDX_EVT_CFG_REQ: /* Unbind request */
327 ret = cmUnpkUdxCfgReq(rlcDlUdxCfgReq, pst, mBuf );
331 case UDX_EVT_UEIDCHG_REQ: /* Configuration request */
333 ret = cmUnpkUdxUeIdChgReq(rlcDlUdxUeIdChgReq, pst, mBuf);
337 case UDX_EVT_STA_UPD_REQ: /* Configuration request */
339 ret = cmUnpkUdxStaUpdReq(rlcDlUdxStaUpdReq, pst, mBuf);
343 case UDX_EVT_STA_PDU_REQ: /* Configuration request */
345 ret = cmUnpkUdxStaPduReq(rlcDlUdxStaPduReq, pst, mBuf);
350 case UDX_EVT_L2MEAS_REQ:
352 ret = cmUnpkUdxL2MeasReq(rlcDlUdxL2MeasReq, pst, mBuf);
355 case UDX_EVT_L2MEAS_SEND_REQ:
358 ret = cmUnpkUdxL2MeasSendReq(rlcDlUdxL2MeasSendReq, pst, mBuf);
362 case UDX_EVT_L2MEAS_STOP_REQ:
364 ret = cmUnpkUdxL2MeasStopReq(rlcDlUdxL2MeasStopReq, pst, mBuf);
370 case UDX_EVT_DL_CLEANUP_MEM:
372 rlcUtlFreeDlMemory(RLC_GET_RLCCB(pst->dstInst));
377 ODU_PUT_MSG_BUF(mBuf);
378 if (pst->dstInst < MAX_RLC_INSTANCES)
380 RLOG1(L_ERROR,"Received Invalid Event[%d] from RLC UL",
395 case KWU_EVT_BND_REQ: /* Bind request */
397 ret = cmUnpkKwuBndReq(RlcUiKwuBndReq, pst, mBuf );
401 case KWU_EVT_UBND_REQ: /* Unbind request */
403 ret = cmUnpkKwuUbndReq(RlcUiKwuUbndReq, pst, mBuf );
407 case KWU_EVT_CPLANE_DAT_REQ: /* C-Plane Data request */
409 ret = cmUnpkKwuDatReq(rlcProcDlData, pst, mBuf);
413 case KWU_EVT_DAT_REQ: /* Data request */
415 //ret = cmUnpkKwuDatReq(rlcProcDlData, pst, mBuf);
419 case KWU_EVT_DISC_SDU_REQ: /* Discard SDU request */
421 ret = cmUnpkKwuDiscSduReq(RlcUiKwuDiscSduReq, pst, mBuf);
427 ODU_PUT_MSG_BUF(mBuf);
428 if (pst->dstInst < MAX_RLC_INSTANCES)
430 RLOG1(L_ERROR,"Received Invalid Event[%d] from RRC",
445 case KWU_EVT_BND_REQ: /* Bind request */
447 ret = cmUnpkKwuBndReq(RlcUiKwuBndReq, pst, mBuf );
451 case KWU_EVT_UBND_REQ: /* Unbind request */
453 ret = cmUnpkKwuUbndReq(RlcUiKwuUbndReq, pst, mBuf );
457 case KWU_EVT_CPLANE_DAT_REQ: /* C-Plane Data request */
458 case KWU_EVT_UPLANE_DAT_REQ: /* U-Plane Data request */
460 ret = cmUnpkKwuDatReq(rlcProcDlData, pst, mBuf);
464 case KWU_EVT_DAT_REQ: /* Data request */
466 //ret = cmUnpkKwuDatReq(rlcProcDlData, pst, mBuf);
470 case KWU_EVT_DISC_SDU_REQ: /* Discard SDU request */
472 ret = cmUnpkKwuDiscSduReq(RlcUiKwuDiscSduReq, pst, mBuf);
477 ODU_PUT_MSG_BUF(mBuf);
478 if (pst->dstInst < MAX_RLC_INSTANCES)
480 RLOG1(L_ERROR,"Received Invalid Event[%d] from PDCP",
495 case EVTRGUBNDCFM: /* Bind request */
497 ret = cmUnpkRguBndCfm(RlcLiRguBndCfm, pst, mBuf );
500 case EVENT_SCHED_RESULT_TO_RLC:
502 ret = unpackSchedResultRpt(RlcProcSchedResultRpt, pst, mBuf);
505 /* kw005.201 added support for L2 Measurement */
507 case EVTRGUHQSTAIND: /* Harq status indication */
509 ret = cmUnpkRguHqStaInd(RlcLiRguHqStaInd, pst, mBuf);
513 case EVTRGUFLOWCNTRLIND:
515 ret = cmUnpkRguFlowCntrlInd(RlcLiRguFlowCntrlInd,pst,mBuf);
519 #ifdef RLC_STA_PROC_IN_MAC/* RLC Status PDU Processing */
520 case UDX_EVT_STA_UPD_REQ: /* Configuration request */
522 ret = cmUnpkUdxStaUpdReq(rlcDlUdxStaUpdReq, pst, mBuf);
528 ODU_PUT_MSG_BUF(mBuf);
529 if (pst->dstInst < MAX_RLC_INSTANCES)
531 RLOG1(L_ERROR,"Received Invalid Event[%d] from MAC",
544 case EVTCTFBTCHPROCTICK:
546 rlcUtlDlBatchProcPkts();
550 ODU_PUT_MSG_BUF(mBuf);
558 case KWU_EVT_TTI_IND:
560 #if (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF))
561 rlcDlBatchProcSplit();
563 #if defined(PDCP_RLC_DL_RBUF)
568 #if (defined(SPLIT_RLC_DL_TASK) && defined(MAC_RLC_HARQ_STA_RBUF) && defined(LTE_L2_MEAS))
569 //RlcDlHarqStaBatchProc();
570 rlcUtlDlBatchProcHqStaInd();
572 #ifndef KWSELFPSTDLCLEAN
574 /* Moving Cleanup from self post event to TTI event */
578 ODU_PUT_MSG_BUF(mBuf);
588 if (pst->dstInst < MAX_RLC_INSTANCES)
590 /*RlcCb *tRlcCb = RLC_GET_RLCCB(pst->dstInst);*/
591 RLOG1(L_ERROR, "Received Invalid Source Entity[%d]",
594 ODU_PUT_MSG_BUF(mBuf);
606 /********************************************************************30**
608 **********************************************************************/