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 U32 isDatReqProcessed;
69 void rlcUtlDlBatchProcHqStaInd ARGS ((Void));
72 #if (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF))
73 EXTERN S16 rlcDlBatchProcSplit ARGS((Void));
77 U32 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
111 /***********************************************************************
112 System Service Interface Functions
113 ***********************************************************************/
118 * <b> Activates Initialization </b>
121 * This function is invoked by system services to initialize the LTE-RLC
122 * layer. This is an entry point used by LTE_RLC layer to initialize its
123 * global variables, before becoming operational.
125 * Allowable values for parameters are specified in ssi.h.
127 * @param[in] ent - Specify the entity id of the LTE-RLC task.
128 * @param[in] inst - Specify the entity id of the LTE-RLC task.
129 * @param[in] region - Specifies the memory region from which
130 * LTE-RLC should allocate structures and buffers.
131 * @param[in] reason - Specifies the reason for calling this
132 * initialization function.
141 Ent ent, /* entity */
142 Inst inst, /* instance */
143 Region region, /* region */
144 Reason reason /* reason */
147 S16 rlcDlActvInit(ent, inst, region, reason)
148 Ent ent; /* entity */
149 Inst inst; /* instance */
150 Region region; /* region */
151 Reason reason; /* reason */
157 if (inst >= MAX_RLC_INSTANCES)
159 /* intance greater than MAX instances */
163 if (rlcCb[inst] != NULLP)
168 if (SGetSBuf(region, 0, (Data **)&tRlcCb,
169 (Size)sizeof (RlcCb)) != ROK)
173 /* Initialize rlcCb */
174 RLC_MEM_SET(tRlcCb, 0, sizeof(RlcCb));
176 /* Initialize task configuration parameters */
177 tRlcCb->init.ent = ent; /* entity */
178 tRlcCb->init.inst = inst; /* instance */
179 tRlcCb->init.region = region; /* static region */
180 tRlcCb->init.pool = 0; /* static pool */
181 tRlcCb->init.reason = reason; /* reason */
182 tRlcCb->init.cfgDone = FALSE; /* configuration done */
183 tRlcCb->init.acnt = TRUE; /* enable accounting */
184 tRlcCb->init.usta = TRUE; /* enable unsolicited status */
185 tRlcCb->init.trc = FALSE; /* enable trace */
186 tRlcCb->init.procId = ODU_GET_PROCID();
188 rlcCb[inst] = tRlcCb;
192 for(int i = 0; i < 512; i++)
195 Buffer *bufPtr = NULL;
196 SGetMsg(1, 0 , &mBuf);
197 ssGetDBufOfSize(1 , 1800, &bufPtr);
198 SUpdMsg(mBuf, bufPtr, 0);
199 rlcAmmStaPduList[i] = (U32)mBuf;
202 /* call external function for intialization */
217 * <b> Activation Task </b>
220 * Processes events received for MLTE-RLC layer via System Services from
223 * @param[in] pst - Pst Structure
224 * @param[in] mBuf - Message Buffer
230 #if (defined (MAC_FREE_RING_BUF) || defined (RLC_FREE_RING_BUF))
231 pthread_t gRlcTId = 0;
236 Pst *pst, /* pst structure */
237 Buffer *mBuf /* message buffer */
240 S16 rlcDlActvTsk(pst, mBuf)
241 Pst *pst; /* pst structure */
242 Buffer *mBuf; /* message buffer */
248 #ifdef RLC_FREE_RING_BUF
249 gRlcTId = pthread_self();
259 case LKW_EVT_CFG_REQ:
261 ret = unpackRlcConfigReq(RlcMiRlcConfigReq, pst, mBuf);
265 case LKW_EVT_CNTRL_REQ:
267 ret = cmUnpkLkwCntrlReq(RlcMiLkwCntrlReq, pst, mBuf);
271 case LKW_EVT_STS_REQ:
273 ret = cmUnpkLkwStsReq(RlcMiLkwStsReq, pst, mBuf);
277 case LKW_EVT_STA_REQ:
279 ret = cmUnpkLkwStaReq(RlcMiLkwStaReq, pst, mBuf);
282 /* kw005.201 added support for L2 Measurement */
286 case KWU_EVT_DAT_REQ: /* Data request */
288 //ret = cmUnpkKwuDatReq(rlcProcDlData, pst, mBuf);
293 case EVENT_DL_RRC_MSG_TRANS_TO_RLC:
295 ret = unpackDlRrcMsgToRlc(RlcProcDlRrcMsgTransfer, pst, mBuf);
299 ODU_PUT_MSG_BUF(mBuf);
300 if (pst->dstInst < MAX_RLC_INSTANCES)
302 RLOG1(L_ERROR,"Received Invalid Event[%d] from SM",
318 case UDX_EVT_BND_REQ: /* Bind request */
320 ret = cmUnpkUdxBndReq(rlcDlUdxBndReq, pst, mBuf );
324 case UDX_EVT_UBND_REQ: /* Bind request */
326 ret = cmUnpkUdxUbndReq(rlcDlUdxUbndReq, pst, mBuf );
329 case UDX_EVT_CFG_REQ: /* Unbind request */
331 ret = cmUnpkUdxCfgReq(rlcDlUdxCfgReq, pst, mBuf );
335 case UDX_EVT_UEIDCHG_REQ: /* Configuration request */
337 ret = cmUnpkUdxUeIdChgReq(rlcDlUdxUeIdChgReq, pst, mBuf);
341 case UDX_EVT_STA_UPD_REQ: /* Configuration request */
343 ret = cmUnpkUdxStaUpdReq(rlcDlUdxStaUpdReq, pst, mBuf);
347 case UDX_EVT_STA_PDU_REQ: /* Configuration request */
349 ret = cmUnpkUdxStaPduReq(rlcDlUdxStaPduReq, pst, mBuf);
354 case UDX_EVT_L2MEAS_REQ:
356 ret = cmUnpkUdxL2MeasReq(rlcDlUdxL2MeasReq, pst, mBuf);
359 case UDX_EVT_L2MEAS_SEND_REQ:
362 ret = cmUnpkUdxL2MeasSendReq(rlcDlUdxL2MeasSendReq, pst, mBuf);
366 case UDX_EVT_L2MEAS_STOP_REQ:
368 ret = cmUnpkUdxL2MeasStopReq(rlcDlUdxL2MeasStopReq, pst, mBuf);
374 case UDX_EVT_DL_CLEANUP_MEM:
376 rlcUtlFreeDlMemory(RLC_GET_RLCCB(pst->dstInst));
381 ODU_PUT_MSG_BUF(mBuf);
382 if (pst->dstInst < MAX_RLC_INSTANCES)
384 RLOG1(L_ERROR,"Received Invalid Event[%d] from RLC UL",
399 case KWU_EVT_BND_REQ: /* Bind request */
401 ret = cmUnpkKwuBndReq(RlcUiKwuBndReq, pst, mBuf );
405 case KWU_EVT_UBND_REQ: /* Unbind request */
407 ret = cmUnpkKwuUbndReq(RlcUiKwuUbndReq, pst, mBuf );
411 case KWU_EVT_CPLANE_DAT_REQ: /* C-Plane Data request */
413 ret = cmUnpkKwuDatReq(rlcProcDlData, pst, mBuf);
417 case KWU_EVT_DAT_REQ: /* Data request */
419 //ret = cmUnpkKwuDatReq(rlcProcDlData, pst, mBuf);
423 case KWU_EVT_DISC_SDU_REQ: /* Discard SDU request */
425 ret = cmUnpkKwuDiscSduReq(RlcUiKwuDiscSduReq, pst, mBuf);
431 ODU_PUT_MSG_BUF(mBuf);
432 if (pst->dstInst < MAX_RLC_INSTANCES)
434 RLOG1(L_ERROR,"Received Invalid Event[%d] from RRC",
449 case KWU_EVT_BND_REQ: /* Bind request */
451 ret = cmUnpkKwuBndReq(RlcUiKwuBndReq, pst, mBuf );
455 case KWU_EVT_UBND_REQ: /* Unbind request */
457 ret = cmUnpkKwuUbndReq(RlcUiKwuUbndReq, pst, mBuf );
461 case KWU_EVT_CPLANE_DAT_REQ: /* C-Plane Data request */
462 case KWU_EVT_UPLANE_DAT_REQ: /* U-Plane Data request */
464 ret = cmUnpkKwuDatReq(rlcProcDlData, pst, mBuf);
468 case KWU_EVT_DAT_REQ: /* Data request */
470 //ret = cmUnpkKwuDatReq(rlcProcDlData, pst, mBuf);
474 case KWU_EVT_DISC_SDU_REQ: /* Discard SDU request */
476 ret = cmUnpkKwuDiscSduReq(RlcUiKwuDiscSduReq, pst, mBuf);
481 ODU_PUT_MSG_BUF(mBuf);
482 if (pst->dstInst < MAX_RLC_INSTANCES)
484 RLOG1(L_ERROR,"Received Invalid Event[%d] from PDCP",
499 case EVTRGUBNDCFM: /* Bind request */
501 ret = cmUnpkRguBndCfm(RlcLiRguBndCfm, pst, mBuf );
504 case EVENT_SCHED_RESULT_TO_RLC:
506 ret = unpackSchedResultRpt(RlcProcSchedResultRpt, pst, mBuf);
509 /* kw005.201 added support for L2 Measurement */
511 case EVTRGUHQSTAIND: /* Harq status indication */
513 ret = cmUnpkRguHqStaInd(RlcLiRguHqStaInd, pst, mBuf);
517 case EVTRGUFLOWCNTRLIND:
519 ret = cmUnpkRguFlowCntrlInd(RlcLiRguFlowCntrlInd,pst,mBuf);
523 #ifdef RLC_STA_PROC_IN_MAC/* RLC Status PDU Processing */
524 case UDX_EVT_STA_UPD_REQ: /* Configuration request */
526 ret = cmUnpkUdxStaUpdReq(rlcDlUdxStaUpdReq, pst, mBuf);
532 ODU_PUT_MSG_BUF(mBuf);
533 if (pst->dstInst < MAX_RLC_INSTANCES)
535 RLOG1(L_ERROR,"Received Invalid Event[%d] from MAC",
548 case EVTCTFBTCHPROCTICK:
550 rlcUtlDlBatchProcPkts();
554 ODU_PUT_MSG_BUF(mBuf);
562 case KWU_EVT_TTI_IND:
564 #if (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF))
565 rlcDlBatchProcSplit();
567 #if defined(PDCP_RLC_DL_RBUF)
572 #if (defined(SPLIT_RLC_DL_TASK) && defined(MAC_RLC_HARQ_STA_RBUF) && defined(LTE_L2_MEAS))
573 //RlcDlHarqStaBatchProc();
574 rlcUtlDlBatchProcHqStaInd();
576 #ifndef KWSELFPSTDLCLEAN
578 /* Moving Cleanup from self post event to TTI event */
582 ODU_PUT_MSG_BUF(mBuf);
592 if (pst->dstInst < MAX_RLC_INSTANCES)
594 /*RlcCb *tRlcCb = RLC_GET_RLCCB(pst->dstInst);*/
595 RLOG1(L_ERROR, "Received Invalid Source Entity[%d]",
598 ODU_PUT_MSG_BUF(mBuf);
610 /********************************************************************30**
612 **********************************************************************/