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_UL";
32 static int RLOG_MODULE_ID=2048;
33 static int RLOG_FILE_ID=206;
35 /** @file kw_ul_ex_ms.c
36 @brief RLC System Services Interface
40 /* header (.h) include files */
41 #include "envopt.h" /* environment options */
42 #include "envdep.h" /* environment dependent */
43 #include "envind.h" /* environment independent */
45 #include "gen.h" /* general */
46 #include "ssi.h" /* system services */
47 #include "cm5.h" /* common timer defines */
48 #include "cm_tkns.h" /* common tokens defines */
49 #include "cm_mblk.h" /* common memory allocation library defines */
50 #include "cm_llist.h" /* common link list defines */
51 #include "cm_hash.h" /* common hash list defines */
52 #include "cm_lte.h" /* common LTE defines */
53 #include "lkw.h" /* LKW defines */
54 #include "ckw.h" /* CKW defines */
55 #include "kwu.h" /* KWU defines */
56 #include "rgu.h" /* RGU defines */
57 #include "kw_err.h" /* Err defines */
58 #include "kw_env.h" /* RLC environment options */
59 #include "kw.h" /* RLC defines */
63 /* extern (.x) include files */
64 #include "gen.x" /* general */
65 #include "ssi.x" /* system services */
67 #include "cm5.x" /* common timer library */
68 #include "cm_tkns.x" /* common tokens */
69 #include "cm_mblk.x" /* common memory allocation */
70 #include "cm_llist.x" /* common link list */
71 #include "cm_hash.x" /* common hash list */
72 #include "cm_lte.x" /* common LTE includes */
73 #include "cm_lib.x" /* common memory allocation library */
74 #include "lkw.x" /* LKW */
75 #include "ckw.x" /* CKW */
76 #include "kwu.x" /* KWU */
77 #include "rgu.x" /* RGU */
82 #include "l2_tenb_stats.x"
85 PUBLIC S16 kwUlInitExt ARGS (( Void ));
91 * <b> Initialize External </b>
94 * Initializes variables used to interface with Upper/Lower Layer
102 PUBLIC S16 kwUlInitExt
106 PUBLIC S16 kwUlInitExt()
116 /***********************************************************************
117 System Service Interface Functions
118 ***********************************************************************/
123 * <b> Activates Initialization </b>
126 * This function is invoked by system services to initialize the LTE-RLC
127 * layer. This is an entry point used by LTE_RLC layer to initialize its
128 * global variables, before becoming operational.
130 * Allowable values for parameters are specified in ssi.h.
132 * @param[in] ent - Specify the entity id of the LTE-RLC task.
133 * @param[in] inst - Specify the entity id of the LTE-RLC task.
134 * @param[in] region - Specifies the memory region from which
135 * LTE-RLC should allocate structures and buffers.
136 * @param[in] reason - Specifies the reason for calling this
137 * initialization function.
144 PUBLIC S16 kwUlActvInit
146 Ent ent, /* entity */
147 Inst inst, /* instance */
148 Region region, /* region */
149 Reason reason /* reason */
152 PUBLIC S16 kwUlActvInit(ent, inst, region, reason)
153 Ent ent; /* entity */
154 Inst inst; /* instance */
155 Region region; /* region */
156 Reason reason; /* reason */
162 if (inst >= KW_MAX_RLC_INSTANCES)
164 /* intance greater than MAX instances */
168 if (kwCb[inst] != NULLP)
173 if (SGetSBuf(region, 0, (Data **)&tKwCb,
174 (Size)sizeof (KwCb)) != ROK)
179 /* Initialize kwCb */
180 KW_MEM_SET(tKwCb, 0, sizeof(KwCb));
182 /* Initialize task configuration parameters */
183 tKwCb->init.ent = ent; /* entity */
184 tKwCb->init.inst = inst; /* instance */
185 tKwCb->init.region = region; /* static region */
186 tKwCb->init.pool = 0; /* static pool */
187 tKwCb->init.reason = reason; /* reason */
188 tKwCb->init.cfgDone = FALSE; /* configuration done */
189 tKwCb->init.acnt = TRUE; /* enable accounting */
190 tKwCb->init.usta = TRUE; /* enable unsolicited status */
191 tKwCb->init.trc = FALSE; /* enable trace */
192 tKwCb->init.procId = SFndProcId();
196 /* call external function for intialization */
201 TSL2AllocStatsMem(tKwCb->init.region, tKwCb->init.pool);
212 * <b> Activation Task </b>
215 * Processes events received for MLTE-RLC layer via System Services from
218 * @param[in] pst - Pst Structure
219 * @param[in] mBuf - Message Buffer
226 PUBLIC S16 kwUlActvTsk
228 Pst *pst, /* pst structure */
229 Buffer *mBuf /* message buffer */
232 PUBLIC S16 kwUlActvTsk(pst, mBuf)
233 Pst *pst; /* pst structure */
234 Buffer *mBuf; /* message buffer */
248 case LKW_EVT_CFG_REQ:
250 ret = cmUnpkLkwCfgReq(KwMiLkwCfgReq, pst, mBuf);
254 case LKW_EVT_CNTRL_REQ:
256 ret = cmUnpkLkwCntrlReq(KwMiLkwCntrlReq, pst, mBuf);
260 case RLC_EVT_UE_CREATE_REQ: /* UE Create Request */
262 ret = unpackUeCreateReq(RlcDuappProcUeCreateReq, pst, mBuf);
266 case LKW_EVT_STS_REQ:
268 ret = cmUnpkLkwStsReq(KwMiLkwStsReq, pst, mBuf);
272 case LKW_EVT_STA_REQ:
274 ret = cmUnpkLkwStaReq(KwMiLkwStaReq, pst, mBuf);
277 /* kw005.201 added support for L2 Measurement */
279 case LKW_EVT_L2MEAS_REQ:
281 ret = cmUnpkLkwL2MeasReq(KwMiLkwL2MeasReq, pst, mBuf);
284 case LKW_EVT_L2MEAS_SEND_REQ:
287 ret = cmUnpkLkwL2MeasSendReq(KwMiLkwL2MeasSendReq, pst, mBuf);
291 case LKW_EVT_L2MEAS_STOP_REQ:
293 ret = cmUnpkLkwL2MeasStopReq(KwMiLkwL2MeasStopReq, pst, mBuf);
300 if (pst->dstInst < KW_MAX_RLC_INSTANCES)
302 RLOG1(L_FATAL,"Received Invalid Event[%d] from SM",
317 case UDX_EVT_BND_CFM: /* Bind request */
319 ret = cmUnpkUdxBndCfm(KwUlUdxBndCfm, pst, mBuf );
323 case UDX_EVT_CFG_CFM: /* Unbind request */
325 ret = cmUnpkUdxCfgCfm(KwUlUdxCfgCfm, pst, mBuf );
329 case UDX_EVT_UEIDCHG_CFM: /* Configuration request */
331 ret = cmUnpkUdxUeIdChgCfm(KwUlUdxUeIdChgCfm, pst, mBuf);
335 case UDX_EVT_STA_PHBT_TMR_START: /* Status Prohibit Timer Start */
337 ret = cmUnpkUdxStaProhTmrStart(KwUlUdxStaProhTmrStart, pst, mBuf);
345 if (pst->dstInst < KW_MAX_RLC_INSTANCES)
347 RLOG1(L_ERROR,"Received Invalid Event[%d] from RLC UL",
362 case CKW_EVT_BND_REQ: /* Bind request */
364 ret = cmUnpkCkwBndReq(KwUiCkwBndReq, pst, mBuf );
368 case CKW_EVT_UBND_REQ: /* Unbind request */
370 ret = cmUnpkCkwUbndReq(KwUiCkwUbndReq, pst, mBuf );
374 case CKW_EVT_UEIDCHG_REQ: /* Configuration request */
376 ret = cmUnpkCkwUeIdChgReq(KwUiCkwUeIdChgReq, pst, mBuf);
383 case KWU_EVT_BND_REQ: /* Bind request */
385 ret = cmUnpkKwuBndReq(KwUiKwuBndReq, pst, mBuf );
389 case KWU_EVT_UBND_REQ: /* Unbind request */
391 ret = cmUnpkKwuUbndReq(KwUiKwuUbndReq, pst, mBuf );
397 if (pst->dstInst < KW_MAX_RLC_INSTANCES)
399 RLOG1(L_ERROR,"Received Invalid Event[%d] from RRC",
414 case KWU_EVT_BND_REQ: /* Bind request */
416 ret = cmUnpkKwuBndReq(KwUiKwuBndReq, pst, mBuf );
420 case KWU_EVT_UBND_REQ: /* Unbind request */
422 ret = cmUnpkKwuUbndReq(KwUiKwuUbndReq, pst, mBuf );
428 if (pst->dstInst < KW_MAX_RLC_INSTANCES)
430 RLOG1(L_ERROR,"Received Invalid Event[%d] from PDCP",
445 case EVTRGUBNDCFM: /* Bind request */
447 ret = cmUnpkRguBndCfm(KwLiRguBndCfm, pst, mBuf );
451 case EVTRLCULDAT: /* Dedicated Channel Data request */
453 ret = unpackRcvdUlData(RlcMacProcUlData, pst, mBuf);
461 if (pst->dstInst < KW_MAX_RLC_INSTANCES)
463 RLOG1(L_ERROR,"Received Invalid Event[%d] from MAC",
471 #if defined(L2_L3_SPLIT) && defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined (MAC_RLC_UL_RBUF)
476 case KWU_EVT_TTI_IND:
485 #endif/* End for TENB_T2K3K_SPECIFIC_CHANGES and L2_L3_SPLIT */
486 #ifndef UL_RLC_NET_CLUSTER
496 tKwCb = KW_GET_KWCB(pst->dstInst);
498 TSL2SendStatsToApp(&(tKwCb->genCfg.lmPst), 0);
504 printf("\n ERROR Invalid Event[%d] from CL to PDCPUL\n",
516 if (pst->dstInst < KW_MAX_RLC_INSTANCES)
518 RLOG1(L_ERROR, "Received Invalid Source Entity[%d]",pst->event);
532 /********************************************************************30**
534 **********************************************************************/