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: NR RLC Layer - System Services Interface Functions
25 Desc: C source code for the interface to System Services
28 File: rlc_ul_msg_router.c
30 *********************************************************************21*/
32 /** @file rlc_ul_msg_router.c
33 @brief RLC System Services Interface
37 /* header (.h) include files */
38 #include "common_def.h"
39 #include "lkw.h" /* LKW defines */
40 #include "ckw.h" /* CKW defines */
41 #include "kwu.h" /* KWU defines */
42 #include "rgu.h" /* RGU defines */
43 #include "rlc_err.h" /* Err defines */
44 #include "rlc_env.h" /* RLC environment options */
47 /* extern (.x) include files */
48 #include "lkw.x" /* LKW */
49 #include "ckw.x" /* CKW */
50 #include "kwu.x" /* KWU */
51 #include "rgu.x" /* RGU */
53 #include "rlc_utils.h" /* RLC defines */
54 #include "rlc_dl_ul_inf.h"
56 #include "rlc_mac_inf.h"
57 #include "du_app_rlc_inf.h"
60 #include "l2_tenb_stats.x"
64 S16 rlcUlInitExt ARGS (( Void ));
70 * <b> Initialize External </b>
73 * Initializes variables used to interface with Upper/Lower Layer
88 /***********************************************************************
89 System Service Interface Functions
90 ***********************************************************************/
95 * <b> Activates Initialization </b>
98 * This function is invoked by system services to initialize the NR RLC
99 * layer. This is an entry point used by LTE_RLC layer to initialize its
100 * global variables, before becoming operational.
102 * Allowable values for parameters are specified in ssi.h.
104 * @param[in] ent - Specify the entity id of the NR RLC task.
105 * @param[in] inst - Specify the entity id of the NR RLC task.
106 * @param[in] region - Specifies the memory region from which
107 * NR RLC should allocate structures and buffers.
108 * @param[in] reason - Specifies the reason for calling this
109 * initialization function.
117 Ent ent, /* entity */
118 Inst inst, /* instance */
119 Region region, /* region */
120 Reason reason /* reason */
125 if (inst >= MAX_RLC_INSTANCES)
127 /* intance greater than MAX instances */
131 if (rlcCb[inst] != NULLP)
136 if (SGetSBuf(region, 0, (Data **)&tRlcCb,
137 (Size)sizeof (RlcCb)) != ROK)
142 /* Initialize rlcCb */
143 RLC_MEM_SET(tRlcCb, 0, sizeof(RlcCb));
145 /* Initialize task configuration parameters */
146 tRlcCb->init.ent = ent; /* entity */
147 tRlcCb->init.inst = inst; /* instance */
148 tRlcCb->init.region = region; /* static region */
149 tRlcCb->init.pool = 0; /* static pool */
150 tRlcCb->init.reason = reason; /* reason */
151 tRlcCb->init.cfgDone = FALSE; /* configuration done */
152 tRlcCb->init.acnt = TRUE; /* enable accounting */
153 tRlcCb->init.usta = TRUE; /* enable unsolicited status */
154 tRlcCb->init.trc = FALSE; /* enable trace */
155 tRlcCb->init.procId = ODU_GET_PROCID();
157 rlcCb[inst] = tRlcCb;
159 /* call external function for intialization */
164 TSL2AllocStatsMem(tRlcCb->init.inst);
168 } /* rlcUlActvInit */
170 #ifdef CALL_FLOW_DEBUG_LOG
175 * name : callFlowRlcUlActvTsk
178 * Function used to print values of src, dest, message
179 * received at the layer
181 * @param[in] pst - Pst Structure
186 void callFlowRlcUlActvTsk(Pst *pst)
189 char destTask[50]="ENTRLCUL";
196 strcpy(sourceTask,"ENTDUAPP");
200 case LKW_EVT_CFG_REQ:
202 strcpy(message,"LKW_EVT_CFG_REQ");
206 case LKW_EVT_CNTRL_REQ:
208 strcpy(message,"LKW_EVT_CNTRL_REQ");
212 case EVENT_RLC_UE_CREATE_REQ: /* UE Create Request */
214 strcpy(message,"EVENT_RLC_UE_CREATE_REQ");
217 case EVENT_RLC_UE_RECONFIG_REQ: /* UE Reconfig Request */
219 strcpy(message,"EVENT_RLC_UE_RECONFIG_REQ");
222 case EVENT_RLC_UE_DELETE_REQ:
224 strcpy(message,"EVENT_RLC_UE_DELETE_REQ");
228 case LKW_EVT_STS_REQ:
230 strcpy(message,"LKW_EVT_STS_REQ");
234 case LKW_EVT_STA_REQ:
236 strcpy(message,"LKW_EVT_STA_REQ");
239 /* kw005.201 added support for L2 Measurement */
243 strcpy(message,"Invalid Event");
252 strcpy(sourceTask,"ENTRLC");
256 case UDX_EVT_BND_CFM: /* Bind request */
258 strcpy(message,"UDX_EVT_BND_CFM");
262 case UDX_EVT_CFG_CFM: /* Unbind request */
264 strcpy(message,"UDX_EVT_CFG_CFM");
268 case UDX_EVT_UEIDCHG_CFM: /* Configuration request */
270 strcpy(message,"UDX_EVT_UEIDCHG_CFM");
274 case UDX_EVT_STA_PHBT_TMR_START: /* Status Prohibit Timer Start */
276 strcpy(message,"UDX_EVT_STA_PHBT_TMR_START");
283 strcpy(message,"Invalid Event");
292 strcpy(sourceTask,"ENTMAC");
296 case EVTRGUBNDCFM: /* Bind request */
298 strcpy(message,"EVTRGUBNDCFM");
302 case EVENT_UL_DATA_TO_RLC: /* UL Data request */
304 strcpy(message,"EVENT_UL_DATA_TO_RLC");
311 strcpy(message,"Invalid Event");
318 strcpy(sourceTask,"Invalid Source Entity Id");
321 DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
332 * <b> Activation Task </b>
335 * Processes events received for NR RLC layer via System Services from
338 * @param[in] pst - Pst Structure
339 * @param[in] mBuf - Message Buffer
347 Pst *pst, /* pst structure */
348 Buffer *mBuf /* message buffer */
353 #ifdef CALL_FLOW_DEBUG_LOG
354 callFlowRlcUlActvTsk(pst);
364 case LKW_EVT_CFG_REQ:
366 ret = unpackRlcConfigReq(RlcMiRlcConfigReq, pst, mBuf);
370 case LKW_EVT_CNTRL_REQ:
372 ret = cmUnpkLkwCntrlReq(RlcMiLkwCntrlReq, pst, mBuf);
376 case EVENT_RLC_UE_CREATE_REQ: /* UE Create Request */
378 ret = unpackRlcUeCreateReq(RlcProcUeCreateReq, pst, mBuf);
381 case EVENT_RLC_UE_RECONFIG_REQ: /* UE Reconfig Request */
383 ret = unpackRlcUeReconfigReq(RlcProcUeReconfigReq, pst, mBuf);
386 case EVENT_RLC_UE_DELETE_REQ:
388 ret = unpackRlcUeDeleteReq(RlcProcUeDeleteReq, pst, mBuf);
391 case EVENT_RLC_UE_REESTABLISH_REQ:
393 ret = unpackRlcUeReestablishReq(RlcProcUeReestablishReq, pst, mBuf);
397 case LKW_EVT_STS_REQ:
399 ret = cmUnpkLkwStsReq(RlcMiLkwStsReq, pst, mBuf);
403 case LKW_EVT_STA_REQ:
405 ret = cmUnpkLkwStaReq(RlcMiLkwStaReq, pst, mBuf);
408 /* kw005.201 added support for L2 Measurement */
410 case LKW_EVT_L2MEAS_REQ:
412 ret = cmUnpkLkwL2MeasReq(RlcMiLkwL2MeasReq, pst, mBuf);
415 case LKW_EVT_L2MEAS_SEND_REQ:
418 ret = cmUnpkLkwL2MeasSendReq(RlcMiLkwL2MeasSendReq, pst, mBuf);
422 case LKW_EVT_L2MEAS_STOP_REQ:
424 ret = cmUnpkLkwL2MeasStopReq(RlcMiLkwL2MeasStopReq, pst, mBuf);
430 ODU_PUT_MSG_BUF(mBuf);
431 if (pst->dstInst < MAX_RLC_INSTANCES)
433 DU_LOG("\nERROR --> RLC_UL : Received Invalid Event[%d] from SM",
448 case UDX_EVT_BND_CFM: /* Bind request */
450 ret = cmUnpkUdxBndCfm(rlcUlUdxBndCfm, pst, mBuf );
454 case UDX_EVT_CFG_CFM: /* Unbind request */
456 ret = cmUnpkUdxCfgCfm(rlcUlUdxCfgCfm, pst, mBuf );
460 case UDX_EVT_UEIDCHG_CFM: /* Configuration request */
462 ret = cmUnpkUdxUeIdChgCfm(rlcUlUdxUeIdChgCfm, pst, mBuf);
466 case UDX_EVT_STA_PHBT_TMR_START: /* Status Prohibit Timer Start */
468 ret = cmUnpkUdxStaProhTmrStart(rlcUlUdxStaProhTmrStart, pst, mBuf);
475 ODU_PUT_MSG_BUF(mBuf);
476 if (pst->dstInst < MAX_RLC_INSTANCES)
478 DU_LOG("\nERROR --> RLC_UL : Received Invalid Event[%d] from RLC UL",
493 case CKW_EVT_BND_REQ: /* Bind request */
495 ret = cmUnpkCkwBndReq(RlcUiCkwBndReq, pst, mBuf );
499 case CKW_EVT_UBND_REQ: /* Unbind request */
501 ret = cmUnpkCkwUbndReq(RlcUiCkwUbndReq, pst, mBuf );
505 case CKW_EVT_UEIDCHG_REQ: /* Configuration request */
507 ret = cmUnpkCkwUeIdChgReq(RlcUiCkwUeIdChgReq, pst, mBuf);
514 case KWU_EVT_BND_REQ: /* Bind request */
516 ret = cmUnpkKwuBndReq(RlcUiKwuBndReq, pst, mBuf );
520 case KWU_EVT_UBND_REQ: /* Unbind request */
522 ret = cmUnpkKwuUbndReq(RlcUiKwuUbndReq, pst, mBuf );
527 ODU_PUT_MSG_BUF(mBuf);
528 if (pst->dstInst < MAX_RLC_INSTANCES)
530 DU_LOG("\nERROR --> RLC_UL : Received Invalid Event[%d] from RRC",
545 case KWU_EVT_BND_REQ: /* Bind request */
547 ret = cmUnpkKwuBndReq(RlcUiKwuBndReq, pst, mBuf );
551 case KWU_EVT_UBND_REQ: /* Unbind request */
553 ret = cmUnpkKwuUbndReq(RlcUiKwuUbndReq, pst, mBuf );
558 ODU_PUT_MSG_BUF(mBuf);
559 if (pst->dstInst < MAX_RLC_INSTANCES)
561 DU_LOG("\nERROR --> RLC_UL : Received Invalid Event[%d] from PDCP",
576 case EVTRGUBNDCFM: /* Bind request */
578 ret = cmUnpkRguBndCfm(RlcLiRguBndCfm, pst, mBuf );
582 case EVENT_UL_DATA_TO_RLC: /* UL Data request */
584 ret = unpackRlcUlData(RlcProcUlData, pst, mBuf);
591 ODU_PUT_MSG_BUF(mBuf);
592 if (pst->dstInst < MAX_RLC_INSTANCES)
594 DU_LOG("\nERROR --> RLC_UL : Received Invalid Event[%d] from MAC",
602 #if defined(L2_L3_SPLIT) && defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined (MAC_RLC_UL_RBUF)
607 case KWU_EVT_TTI_IND:
610 ODU_PUT_MSG_BUF(mBuf);
616 #endif/* End for TENB_T2K3K_SPECIFIC_CHANGES and L2_L3_SPLIT */
617 #ifndef UL_RLC_NET_CLUSTER
627 tRlcCb = RLC_GET_RLCCB(pst->dstInst);
629 TSL2SendStatsToApp(&(tRlcCb->genCfg.lmPst), 0);
630 ODU_PUT_MSG_BUF(mBuf);
635 DU_LOG("\nERROR --> RLC_UL : Invalid Event[%d] from CL to PDCPUL\n",
637 ODU_PUT_MSG_BUF(mBuf);
647 if (pst->dstInst < MAX_RLC_INSTANCES)
649 DU_LOG("\nERROR --> RLC_UL : Received Invalid Source Entity[%d]",pst->event);
651 ODU_PUT_MSG_BUF(mBuf);
663 /********************************************************************30**
665 **********************************************************************/