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 /************************************************************************
21 Name: NR RLC - Layer Manager file
25 Desc: It contains the following common functions for processing
26 the all the external interfaces.
40 ************************************************************************/
41 /** @file rlc_layer_mgr.c
42 @brief RLC Layer Manager Module
46 /* header (.h) include files */
47 #include "common_def.h"
48 #include "lkw.h" /* LKW defines */
49 #include "ckw.h" /* CKW defines */
50 #include "kwu.h" /* KWU defines */
51 #include "rgu.h" /* RGU defines */
52 #include "rlc_err.h" /* Err defines */
53 #include "rlc_env.h" /* RLC environment options */
56 /* extern (.x) include files */
57 #include "lkw.x" /* LKW */
58 #include "ckw.x" /* CKW */
59 #include "kwu.x" /* KWU */
60 #include "rgu.x" /* RGU */
62 #include "rlc_utils.h" /* RLC defines */
63 #include "rlc_dl_ul_inf.h"
67 #define RLC_MODULE RLC_DBGMASK_LMM
71 /*********************************************************************
72 * Forward Declaration of LKW Porting Functions
73 ********************************************************************/
74 RlcCb *rlcCb[MAX_RLC_INSTANCES];
75 S16 rlcActvTmr ARGS ((Ent ent, Inst inst));
77 static Void rlcLmmSendCfm ARGS ((RlcCb *gCb,Pst *pst,RlcMngmt *cfm,uint8_t type,
79 static S16 rlcLmmGenCfg ARGS ((RlcCb *gCb, RlcGenCfg *cfg));
80 static S16 rlcLmmCfgKwuSap ARGS ((RlcCb *gCb,RlcSapCfg *cfg));
81 static S16 rlcLmmCfgUdxSap ARGS ((RlcCb *gCb,RlcSapCfg *cfg));
82 static S16 rlcLmmCfgCkwSap ARGS ((RlcCb *gCb,RlcSapCfg *cfg));
83 static S16 rlcLmmCfgRguSap ARGS ((RlcCb *gCb,RlcSapCfg *cfg));
84 static S16 rlcLmmGenCntrl ARGS ((RlcCb *gCb,RlcMngmt *cntrl));
85 static S16 rlcLmmUdxSapCntrl ARGS ((RlcCb *gCb,RlcMngmt *cntrl));
86 static S16 rlcLmmLSapCntrl ARGS ((RlcCb *gCb,RlcMngmt *cntrl));
87 static S16 rlcLmmGetKwuSapSta ARGS ((RlcCb *gCb,RlcKwuSapSta *sta));
88 static S16 rlcLmmGetRguSapSta ARGS ((RlcCb *gCb,RlcRguSapSta *sta));
89 static S16 rlcLmmGetCkwCntSapSta ARGS ((RlcCb *gCb,RlcCkwCntSapSta *sta));
90 static S16 rlcLmmGetGenSts ARGS ((RlcCb *gCb,RlcGenSts *sts,Action action));
91 static S16 rlcLmmGetSapSts ARGS ((RlcCb *gCb,RlcMngmt *sts,Elmnt elmnt,Action
95 /*********************************************************************
96 * Primitives for RGU interface
97 ********************************************************************/
100 * Stores the general RLC configuration.
102 * It calculates the memory requirement of the Saps
103 * It also initializes the control blocks, the hash lists and registers
104 * the timers. In case of error it rolls back and reports error in the
105 * confirm.If the general configuration is already done it is treated as
106 * reconfiguration, but right now reconfiguration is not supported.
108 * @param[in] gCb RLC Instance Control Block
109 * @param[in] cfm RLC LM general config structure
112 * LCM_REASON_NOT_APPL (SUCCESS)
113 * LCM_REASON_MEM_NOAVAIL
114 * LCM_REASON_REGTMR_FAIL
115 * LCM_REASON_INVALID_PAR_VAL
116 * LCM_REASON_HASHING_FAILED
118 static S16 rlcLmmGenCfg(RlcCb *gCb,RlcGenCfg *cfg)
126 if(cfg->maxUe > RLC_MAX_UE)
128 #if (ERRCLASS & ERRCLS_INT_PAR)
129 DU_LOG("\nERROR --> RLC : Invalid maxUe : Max [%lu] Received [%lu]",
132 #endif /* ERRCLASS & ERRCLS_INT_PAR */
133 return (LCM_REASON_INVALID_PAR_VAL);
136 if(cfg->maxKwuSaps > RLC_MAX_KWUSAPS)
138 #if (ERRCLASS & ERRCLS_INT_PAR)
139 DU_LOG("\nERROR --> RLC : Invalid maxKwuSaps : Max [%lu] Received [%lu]",
142 #endif /* ERRCLASS & ERRCLS_INT_PAR */
143 return (LCM_REASON_INVALID_PAR_VAL);
146 if(cfg->maxUdxSaps > RLC_MAX_UDXSAPS)
148 #if (ERRCLASS & ERRCLS_INT_PAR)
149 DU_LOG("\nERROR --> RLC : Invalid maxUduSaps : Max [%lu] Received [%lu]",
152 #endif /* ERRCLASS & ERRCLS_INT_PAR */
153 return (LCM_REASON_INVALID_PAR_VAL);
156 if((cfg->maxRguSaps == 0) || (cfg->maxRguSaps > RLC_MAX_RGUSAPS))
160 return (LCM_REASON_INVALID_PAR_VAL);
162 if(gCb->init.cfgDone == TRUE)
164 /* reconfiguration not supported */
165 return (LCM_REASON_RECONFIG_FAIL);
170 /* Timer Queue Control point initialization */
171 rlcTqCp = &(gCb->rlcTqCp);
172 rlcTqCp->tmrLen = RLC_TMR_LEN;
175 gCb->rlcThpt.inst = gCb->init.inst;
176 gCb->rlcThpt.ueTputInfo.ueThptTmr.tmrEvnt = TMR_NONE;
177 gCb->rlcThpt.ueTputInfo.numActvUe = 0;
178 memset(gCb->rlcThpt.ueTputInfo.thptPerUe, 0, MAX_NUM_UE * sizeof(RlcThptPerUe));
180 gCb->rlcThpt.snssaiTputInfo.snssaiThptTmr.tmrEvnt = TMR_NONE;
182 if(gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
184 RLC_ALLOC(gCb,gCb->u.dlCb, sizeof (RlcDlCb));
185 if (gCb->u.dlCb == NULLP)
187 DU_LOG("\nERROR --> RLC : Memory Allocation failed");
188 return (LCM_REASON_MEM_NOAVAIL);
191 /* allocate memory to the KWU sap's */
192 rlcSapSize = (Size)((Size) gCb->genCfg.maxKwuSaps *
193 (Size)sizeof(RlcKwuSapCb));
195 RLC_ALLOC(gCb,gCb->u.dlCb->rlcKwuDlSap, rlcSapSize);
197 #if (ERRCLASS & ERRCLS_INT_PAR)
198 if(gCb->u.dlCb->rlcKwuDlSap == NULLP)
200 RLC_FREE(gCb,gCb->u.dlCb, sizeof (RlcDlCb));
201 DU_LOG("\nERROR --> RLC : Memory Allocation failed");
202 return (LCM_REASON_MEM_NOAVAIL);
204 #endif /* ERRCLASS & ERRCLS_INT_PAR */
206 gCb->u.dlCb->numKwuSaps = gCb->genCfg.maxKwuSaps;
208 rlcUdxSapSize = (Size)((Size) gCb->genCfg.maxUdxSaps *
209 (Size)sizeof(RlcUdxDlSapCb));
211 RLC_ALLOC(gCb,gCb->u.dlCb->udxDlSap, rlcUdxSapSize);
212 #if (ERRCLASS & ERRCLS_INT_PAR)
213 if(gCb->u.dlCb->udxDlSap == NULLP)
215 RLC_FREE(gCb,gCb->u.dlCb->rlcKwuDlSap, rlcSapSize);
216 RLC_FREE(gCb,gCb->u.dlCb, sizeof (RlcDlCb));
217 DU_LOG("\nERROR --> RLC : Memory Allocation failed");
218 return (LCM_REASON_MEM_NOAVAIL);
220 #endif /* ERRCLASS & ERRCLS_INT_PAR */
222 rguSapSize = (Size)((Size) gCb->genCfg.maxRguSaps *
223 (Size)sizeof(RlcRguSapCb));
224 RLC_ALLOC(gCb,gCb->u.dlCb->rguDlSap, rguSapSize);
225 #if (ERRCLASS & ERRCLS_INT_PAR)
226 if(gCb->u.dlCb->rguDlSap == NULLP)
228 RLC_FREE(gCb,gCb->u.dlCb->udxDlSap, rlcSapSize);
229 RLC_FREE(gCb,gCb->u.dlCb->rlcKwuDlSap, rlcSapSize);
230 RLC_FREE(gCb,gCb->u.dlCb, sizeof (RlcDlCb));
232 RLCLOGERROR(gCb,ERRCLS_INT_PAR, EKW043, (ErrVal) cfg->maxUe,
233 "rlcLmmGenCfg: SgetSBuf Failed for rguSap...!");
234 return (LCM_REASON_MEM_NOAVAIL);
236 #endif /* ERRCLASS & ERRCLS_INT_PAR */
239 /* Initialize the Ue and Cell hash list */
240 ret = rlcDbmDlInit(gCb);
243 RLC_FREE(gCb,gCb->u.dlCb->udxDlSap, rlcSapSize);
244 RLC_FREE(gCb,gCb->u.dlCb->rlcKwuDlSap, rlcSapSize);
245 RLC_FREE(gCb,gCb->u.dlCb->rguDlSap, rguSapSize);
246 RLC_FREE(gCb,gCb->u.dlCb, sizeof (RlcDlCb));
247 DU_LOG("\nERROR --> RLC_DL : RLC DL Initialization failed");
248 return (LCM_REASON_MEM_NOAVAIL);
251 /* Register the timer */
252 if(ODU_REG_TMR_MT(gCb->init.ent, gCb->init.inst, (uint16_t)cfg->timeRes,
255 RLC_FREE(gCb,gCb->u.dlCb->udxDlSap, rlcUdxSapSize);
256 RLC_FREE(gCb,gCb->u.dlCb->rlcKwuDlSap, rlcSapSize);
257 RLC_FREE(gCb,gCb->u.dlCb->rguDlSap, rguSapSize);
258 RLC_FREE(gCb,gCb->u.dlCb, sizeof (RlcDlCb));
260 return (LCM_REASON_REGTMR_FAIL);
263 /* initializations for background processing of freeing memory */
264 rlcUtlInitToBeFreed(gCb, &(gCb->u.dlCb->toBeFreed));
265 rlcUtlInitializeSelfPst(gCb);
267 if(ODU_GET_MSG_BUF(gCb->init.region, gCb->init.pool, &(gCb->u.dlCb->selfPstMBuf)) != ROK)
269 RLC_FREE(gCb,gCb->u.dlCb->udxDlSap, rlcSapSize);
270 RLC_FREE(gCb,gCb->u.dlCb->rlcKwuDlSap, rlcSapSize);
271 RLC_FREE(gCb,gCb->u.dlCb->rguDlSap, rguSapSize);
272 RLC_FREE(gCb,gCb->u.dlCb, sizeof (RlcDlCb));
274 return (LCM_REASON_MEM_NOAVAIL);
278 rlcUtlL2MeasDlInit(gCb);
281 else if(gCb->genCfg.rlcMode == LKW_RLC_MODE_UL)
283 RLC_ALLOC(gCb,gCb->u.ulCb, sizeof (RlcUlCb));
284 if (gCb->u.ulCb == NULLP)
286 DU_LOG("\nERROR --> RLC : Memory Allocation failed");
287 return (LCM_REASON_MEM_NOAVAIL);
290 /* allocate memory to the KWU sap's */
291 rlcSapSize = (Size)((Size) gCb->genCfg.maxKwuSaps *
292 (Size)sizeof(RlcKwuSapCb));
294 RLC_ALLOC(gCb,gCb->u.ulCb->rlcKwuUlSap, rlcSapSize);
296 #if (ERRCLASS & ERRCLS_INT_PAR)
297 if(gCb->u.ulCb->rlcKwuUlSap == NULLP)
299 RLC_FREE(gCb,gCb->u.ulCb, sizeof (RlcUlCb));
300 DU_LOG("\nERROR --> RLC : Memory Allocation failed");
301 return (LCM_REASON_MEM_NOAVAIL);
303 #endif /* ERRCLASS & ERRCLS_INT_PAR */
305 gCb->u.ulCb->numKwuSaps = gCb->genCfg.maxKwuSaps;
307 /* allocate memory to the KWU sap's */
308 rlcUdxSapSize = (Size)((Size) gCb->genCfg.maxUdxSaps *
309 (Size)sizeof(RlcUdxUlSapCb));
311 RLC_ALLOC(gCb,gCb->u.ulCb->udxUlSap, rlcUdxSapSize);
313 #if (ERRCLASS & ERRCLS_INT_PAR)
314 if(gCb->u.ulCb->rlcKwuUlSap == NULLP)
316 RLC_FREE(gCb,gCb->u.ulCb->rlcKwuUlSap, rlcSapSize);
317 RLC_FREE(gCb,gCb->u.ulCb, sizeof (RlcUlCb));
318 DU_LOG("\nERROR --> RLC : Memory Allocation failed");
319 return (LCM_REASON_MEM_NOAVAIL);
321 #endif /* ERRCLASS & ERRCLS_INT_PAR */
323 rguSapSize = (Size)((Size) gCb->genCfg.maxRguSaps *
324 (Size)sizeof(RlcRguSapCb));
325 RLC_ALLOC(gCb,gCb->u.ulCb->rguUlSap, rguSapSize);
326 #if (ERRCLASS & ERRCLS_INT_PAR)
327 if(gCb->u.ulCb->rguUlSap == NULLP)
329 RLC_FREE(gCb,gCb->u.ulCb->rlcKwuUlSap, rlcSapSize);
330 RLC_FREE(gCb,gCb->u.ulCb->rguUlSap, rlcSapSize);
331 RLC_FREE(gCb,gCb->u.ulCb, sizeof (RlcUlCb));
333 RLCLOGERROR(gCb,ERRCLS_INT_PAR, EKW043, (ErrVal) cfg->maxUe,
334 "rlcLmmGenCfg: SgetSBuf Failed for rguSap...!");
335 return (LCM_REASON_MEM_NOAVAIL);
337 #endif /* ERRCLASS & ERRCLS_INT_PAR */
339 /* Initialize the Ue and Cell hash list */
340 ret = rlcDbmUlInit(gCb);
343 RLC_FREE(gCb,gCb->u.ulCb->udxUlSap, rlcUdxSapSize);
344 RLC_FREE(gCb,gCb->u.ulCb->rlcKwuUlSap, rlcSapSize);
345 RLC_FREE(gCb,gCb->u.ulCb->rguUlSap, rlcSapSize);
346 RLC_FREE(gCb,gCb->u.ulCb, sizeof (RlcUlCb));
347 DU_LOG("\nERROR --> RLC_DL : RLC DL Initialization failed");
350 /* Register the timer */
351 if(ODU_REG_TMR_MT(gCb->init.ent, gCb->init.inst, (uint16_t)cfg->timeRes,
354 RLC_FREE(gCb,gCb->u.ulCb->udxUlSap, rlcUdxSapSize);
355 RLC_FREE(gCb,gCb->u.ulCb->rlcKwuUlSap, rlcSapSize);
356 RLC_FREE(gCb,gCb->u.ulCb->rguUlSap, rlcSapSize);
357 RLC_FREE(gCb,gCb->u.ulCb, sizeof (RlcUlCb));
359 return (LCM_REASON_REGTMR_FAIL);
363 rlcUtlL2MeasUlInit(gCb);
368 #if (ERRCLASS & ERRCLS_INT_PAR)
369 DU_LOG("\nERROR --> RLC : Received Invalid RLC Mode");
370 #endif /* ERRCLASS & ERRCLS_INT_PAR */
372 return (LCM_REASON_INVALID_PAR_VAL);
374 /* Timer Initialization */
375 gCb->rlcTqCp.tmrLen = RLC_TMR_LEN;
377 memset(gCb->rlcTq, NULLP, sizeof(CmTqType) * RLC_TMR_LEN);
379 RLC_MEM_CPY(&(gCb->init.lmPst), &cfg->lmPst, sizeof(Pst));
381 gCb->init.lmPst.srcProcId = gCb->init.procId;
382 gCb->init.lmPst.srcEnt = gCb->init.ent;
383 gCb->init.lmPst.srcInst = gCb->init.inst;
384 gCb->init.lmPst.event = EVTNONE;
386 /* kw002.201 For multi core and multi region,no need to reinitiailize the
387 * region again . This would be done with kwActvInit from SSI */
388 #if !defined(SS_MULTICORE_SUPPORT) && !defined(SS_M_PROTO_REGION)
389 gCb->init.region = cfg->lmPst.region;
390 #endif /* !defined(SS_MULTICORE_SUPPORT) && !defined(SS_M_PROTO_REGION) */
391 gCb->init.pool = cfg->lmPst.pool;
393 gCb->init.cfgDone = TRUE;
395 /* TODO : make this generic for DL and UL after support for UL throughput calculation is added */
396 if(gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
398 /* Starting timer to print throughput */
399 if((rlcChkTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_UE_THROUGHPUT_TMR)) == FALSE)
401 DU_LOG("\nINFO --> RLC_DL : Starting UE Throughput timer");
402 rlcStartTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_UE_THROUGHPUT_TMR);
404 /* Starting timer to print throughput */
405 if((rlcChkTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_SNSSAI_THROUGHPUT_TMR)) == FALSE)
407 DU_LOG("\nINFO --> RLC_DL : Starting SNSSAI Throughput timer");
408 rlcStartTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_SNSSAI_THROUGHPUT_TMR);
413 return (LCM_REASON_NOT_APPL);
418 * Sends confirmation message to LM Called by RlcMiRlcConfigReq function
420 * @param[in] gCb RLC Instance Control Block
421 * @param[in] pst Post structure
422 * @param[in] cfm RLC LM structure
423 * @param[in] type Type of LM message
424 * @param[in] hdr Message header
429 static Void rlcLmmSendCfm
438 Pst rPst; /* Reply post structure */
440 RLC_MEM_SET(&rPst, 0, sizeof(Pst));
442 /* reply post structure for confirmation */
445 rPst.srcEnt = gCb->init.ent;
446 rPst.srcInst = gCb->init.inst;
447 cfm->hdr.entId.ent = gCb->init.ent;
448 cfm->hdr.entId.inst = gCb->init.inst;
452 rPst.srcEnt = pst->dstEnt;
453 rPst.srcInst = pst->dstInst;
454 cfm->hdr.entId.ent = pst->dstEnt;
455 cfm->hdr.entId.inst = pst->dstInst;
457 rPst.srcProcId = SFndProcId();
458 rPst.dstEnt = pst->srcEnt;
459 rPst.dstInst = pst->srcInst;
460 rPst.dstProcId = pst->srcProcId;
461 rPst.selector = hdr->response.selector;
462 rPst.prior = hdr->response.prior;
463 rPst.route = hdr->response.route;
464 rPst.region = hdr->response.mem.region;
465 rPst.pool= hdr->response.mem.pool;
467 /* Fill the reply header */
468 cfm->hdr.elmId.elmnt = hdr->elmId.elmnt;
469 cfm->hdr.transId = hdr->transId;
474 RlcMiRlcConfigCfm(&rPst,cfm);
477 SGetDateTime(&(cfm->t.cntrl.dt));
478 RlcMiLkwCntrlCfm(&rPst,cfm);
481 SGetDateTime(&(cfm->t.sts.dt));
482 RlcMiLkwStsCfm(&rPst,0,cfm);
485 SGetDateTime(&(cfm->t.ssta.dt));
486 RlcMiLkwStaCfm(&rPst,cfm);
489 #if (ERRCLASS & ERRCLS_INT_PAR)
490 DU_LOG("\nERROR --> RLC : Received Invalid Message Type");
495 #endif /* ERRCLASS & ERRCLS_INT_PAR */
505 * This function processes configuration requests received from the layer
509 * The configuration requests can be for general configuration, or
510 * configuration of RGU, KWU, and CKW SAPs. The type of the configuration
511 * request can be determined from the elmId field in the header of the layer
512 * manager message.This function is called by the layer manager to configure
515 * This function implements the following logic:
517 * - if genCfg is not done, send negative Cfm to the layer manager;
519 * - switch (cfg->hdr.elmId.elmnt)
521 * - update the genCfg field in RlCb;
522 * - allocate the maximum static memory required by the RLC product;
523 * - register the timer service by calling SReqTmr;
524 * - set CfgDone for not configuring again;
526 * - if all the parameters are valid, then allocate the KwuSap control
528 * - update the SAP control block with the information provided in the
529 * - configuration request;
530 * - send configuration confirm with the status, success;
532 * - if all the parametes are valid, then allocate the CkwSap control
534 * - update the SAP control block with the information provided in the
535 * configuration request;
536 * - send configuration confirm with the status, success;
538 * - if all the parametes are valid, then allocate the rguSap control
540 * - update the SAP control block with the information provided in the
541 * configuration request;
542 * - send configuration confirm with the status, success;
544 * - if all the parametes are valid, then allocate the udxSap control
546 * - update the SAP control block with the information provided in the
547 * configuration request;
548 * - send configuration confirm with the status, success;
551 * @param[in] pst post structure
552 * @param[in] cfg LM management structure
556 * -# Failure : RFAILED
559 uint8_t RlcMiRlcConfigReq (Pst *pst,RlcMngmt *cfg)
561 Reason reason; /* failure reason */
564 #if (ERRCLASS & ERRCLS_INT_PAR)
565 /* Check if the instance is configured */
566 if (pst->dstInst >= MAX_RLC_INSTANCES)
568 cfg->cfm.status = LCM_PRIM_NOK;
569 cfg->cfm.reason = LCM_REASON_INVALID_INSTANCE;
570 rlcLmmSendCfm(tRlcCb,pst, cfg, TCFG, &cfg->hdr);
575 tRlcCb = RLC_GET_RLCCB(pst->dstInst);
579 cfg->cfm.status = LCM_PRIM_NOK;
580 cfg->cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
581 rlcLmmSendCfm(tRlcCb,pst, cfg, TCFG, &cfg->hdr);
584 /* check configuration is done or not */
585 if ((tRlcCb->init.cfgDone != TRUE) &&
586 (cfg->hdr.elmId.elmnt != STGEN))
589 * if general config is not over then use pst structure
590 * in primitive to communicate to stack manager
593 cfg->cfm.status = LCM_PRIM_NOK;
594 cfg->cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
595 rlcLmmSendCfm(tRlcCb,pst, cfg, TCFG, &cfg->hdr);
599 DU_LOG("\nDEBUG --> RLC : RlcMiRlcConfigReq elmId(%d)", cfg->hdr.elmId.elmnt);
601 switch(cfg->hdr.elmId.elmnt)
605 reason = rlcLmmGenCfg(tRlcCb,&cfg->t.cfg.s.gen);
610 reason = rlcLmmCfgKwuSap(tRlcCb,&cfg->t.cfg.s.sap);
615 reason = rlcLmmCfgCkwSap(tRlcCb,&cfg->t.cfg.s.sap);
620 reason = rlcLmmCfgRguSap(tRlcCb,&cfg->t.cfg.s.sap);
625 reason = rlcLmmCfgUdxSap(tRlcCb,&cfg->t.cfg.s.sap);
630 reason = LCM_REASON_INVALID_ELMNT;
635 if (reason == LCM_REASON_NOT_APPL)
637 cfg->cfm.status = LCM_PRIM_OK;
638 cfg->cfm.reason = LCM_REASON_NOT_APPL;
639 rlcLmmSendCfm(tRlcCb,pst, cfg, TCFG, &cfg->hdr);
644 cfg->cfm.status = LCM_PRIM_NOK;
645 cfg->cfm.reason = reason;
646 rlcLmmSendCfm(tRlcCb,pst, cfg, TCFG, &cfg->hdr);
653 * The layer manager initiates and uses the management-control procedure to
654 * control RLC elements.The RLC control request primitive (RlcMiLkwCntrlReq)
655 * can be called more than once and at any time after the
656 * management-configuration procedure.The control request primitive
657 * is confirmed by a RlcMiLkwCntrlCfm primitive.
660 * This function implements the following logic:
662 * - if(cfgDone = FALSE)
663 * - send negative confirmation to the layer manager;
666 * - switch(cntrl->hdr.elmId.elmnt)
670 * - switch(subAction)
672 * - enable the unsolicited status flag;
673 * - send the control Cfm with success;
675 * - set the debug mask;
676 * - send the control Cfm with success;
678 * - enable the trace flag;
679 * - send the control Cfm with success;
681 * - switch(subAction)
683 * - disable the unsolicited status flag;
684 * - send the control Cfm with success;
686 * - disable the trace flag;
687 * - send the control Cfm with success;
696 * @param[in] pst post structure
697 * @param[in] cntrl LM management structure
703 uint8_t RlcMiLkwCntrlReq(Pst *pst, RlcMngmt *cntrl)
705 Reason reason; /* failure reason */
708 #if (ERRCLASS & ERRCLS_INT_PAR)
709 /* Check if the instance is configured */
710 if (pst->dstInst >= MAX_RLC_INSTANCES)
712 cntrl->cfm.status = LCM_PRIM_NOK;
713 cntrl->cfm.reason = LCM_REASON_INVALID_INSTANCE;
715 rlcLmmSendCfm(tRlcCb,pst, cntrl, TCNTRL, &cntrl->hdr);
720 tRlcCb = RLC_GET_RLCCB(pst->dstInst);
724 cntrl->cfm.status = LCM_PRIM_NOK;
725 cntrl->cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
726 rlcLmmSendCfm(tRlcCb,pst, cntrl, TCNTRL, &cntrl->hdr);
730 if (!(tRlcCb->init.cfgDone))
732 cntrl->cfm.status = LCM_PRIM_NOK;
733 cntrl->cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
734 rlcLmmSendCfm(tRlcCb,pst, cntrl, TCNTRL, &cntrl->hdr);
737 DU_LOG("\nDEBUG --> RLC : RlcMiLkwCntrlReq(elmId(%d))", cntrl->hdr.elmId.elmnt);
739 /* In normal cases, LCM_REASON_NOT_APPL is returned in cfm.
740 * In all error cases appropriate reason is returned
741 * by the functions below
744 switch (cntrl->hdr.elmId.elmnt)
748 /* general control */
749 reason = rlcLmmGenCntrl(tRlcCb,cntrl);
754 /* Lower SAP control */
755 reason = rlcLmmLSapCntrl(tRlcCb,cntrl);
761 reason = rlcLmmUdxSapCntrl(tRlcCb,cntrl);
766 reason = LCM_REASON_INVALID_ELMNT;
771 if (reason == LCM_REASON_NOT_APPL)
773 cntrl->cfm.status = LCM_PRIM_OK;
774 cntrl->cfm.reason = LCM_REASON_NOT_APPL;
778 cntrl->cfm.status = LCM_PRIM_NOK;
779 cntrl->cfm.reason = reason;
782 rlcLmmSendCfm(tRlcCb,pst, cntrl, TCNTRL, &cntrl->hdr);
789 * This function processes solicited status requests received from the layer
790 * manager. The layer manager can request status information regarding the
791 * system ID, RGUSAP,KWUSAP, or CKWSAP.
793 * @param[in] pst post structure
794 * @param[in] sta LM management structure
799 S16 RlcMiLkwStaReq(Pst *pst,RlcMngmt *sta)
801 RlcMngmt rSta; /* Status */
802 Reason reason; /* Failure reason */
805 #if (ERRCLASS & ERRCLS_INT_PAR)
806 /* Check if the instance is configured */
807 if (pst->dstInst >= MAX_RLC_INSTANCES)
809 sta->cfm.status = LCM_PRIM_NOK;
810 sta->cfm.reason = LCM_REASON_INVALID_INSTANCE;
812 rlcLmmSendCfm(tRlcCb,pst, sta, TSSTA, &sta->hdr);
817 tRlcCb = RLC_GET_RLCCB(pst->dstInst);
820 sta->cfm.status = LCM_PRIM_NOK;
821 sta->cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
823 rlcLmmSendCfm(tRlcCb,pst, sta, TSSTA, &sta->hdr);
827 DU_LOG("\nDEBUG --> RLC : Status request for elmId(%d))", sta->hdr.elmId.elmnt);
829 reason = LCM_REASON_NOT_APPL;
831 RLC_MEM_SET(&rSta, 0, sizeof(RlcMngmt));
832 switch (sta->hdr.elmId.elmnt)
836 reason = LCM_REASON_NOT_APPL;
837 rlcGetSId(&rSta.t.ssta.s.sysId);
842 RLC_MEM_CPY (&rSta.t.ssta.s.rlckwuSap,
843 &sta->t.ssta.s.rlckwuSap,
844 sizeof (RlcKwuSapSta));
846 reason = rlcLmmGetKwuSapSta (tRlcCb,&rSta.t.ssta.s.rlckwuSap);
851 RLC_MEM_CPY (&rSta.t.ssta.s.rguSap,
852 &sta->t.ssta.s.rguSap,
853 sizeof (RlcRguSapSta));
855 reason = rlcLmmGetRguSapSta (tRlcCb,&rSta.t.ssta.s.rguSap);
860 RLC_MEM_CPY (&rSta.t.ssta.s.ckwSap,
861 &sta->t.ssta.s.ckwSap,
862 sizeof (RlcCkwCntSapSta));
864 reason = rlcLmmGetCkwCntSapSta (tRlcCb,&rSta.t.ssta.s.ckwSap);
869 reason = LCM_REASON_INVALID_ELMNT;
872 } /* end of switch */
874 if (reason == LCM_REASON_NOT_APPL)
876 rSta.cfm.status = LCM_PRIM_OK;
877 rSta.cfm.reason = LCM_REASON_NOT_APPL;
881 rSta.cfm.status = LCM_PRIM_NOK;
882 rSta.cfm.reason = reason;
884 rlcLmmSendCfm(tRlcCb,pst, &rSta, TSSTA, &sta->hdr);
891 * This function processes statistics requests received from the layer
895 * After collecting the statistics, ir calls the statistics confirm function
896 * to send the statistics to the layer manager.
898 * - switch(sts->hdr.elmId.elmnt)
900 * - get the general statistics from the KW control block;
901 * - if (action = RESET)
902 * - reset the general statistic field in the RlCb;
903 * - call RlcMiLkwStsCfm to send statistics back to layer manager;
907 * - get the SAP specific statistics from KW control block;
908 * - if (action = RESET)
909 * - reset the general statistic field in the RlCb;
910 * - call RlcMiLkwStsCfm to send statistics to the layer manager;
913 * @param[in] pst post structure
914 * @param[in] action action
915 * @param[in] sts LM management structure
921 S16 RlcMiLkwStsReq (Pst *pst, Action action,RlcMngmt *sts)
923 RlcMngmt rSts; /* Statistics */
924 Reason reason; /* Reason for failure */
927 #if (ERRCLASS & ERRCLS_INT_PAR)
928 /* Check if the instance is configured */
929 if (pst->dstInst >= MAX_RLC_INSTANCES)
931 rSts.cfm.status = LCM_PRIM_NOK;
932 rSts.cfm.reason = LCM_REASON_INVALID_INSTANCE;
934 rlcLmmSendCfm(tRlcCb,pst, &rSts, TCNTRL, &sts->hdr);
939 tRlcCb = RLC_GET_RLCCB(pst->dstInst);
942 rSts.cfm.status = LCM_PRIM_NOK;
943 rSts.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
945 rlcLmmSendCfm(tRlcCb,pst, &rSts, TCNTRL, &sts->hdr);
949 DU_LOG("\nDEBUG --> RLC : RlcMiLkwStsReq(elmId(%d),action(%d))",
951 sts->hdr.elmId.elmnt);
953 RLC_MEM_SET(&rSts, 0, sizeof(RlcMngmt));
955 switch (sts->hdr.elmId.elmnt)
959 reason = rlcLmmGetGenSts(tRlcCb,&rSts.t.sts.s.gen, action);
965 if( sts->hdr.elmId.elmnt == STKWUSAP)
967 /* kw005.201, modified the element of rlckwuSap from suId to spId */
968 rSts.t.sts.s.rlckwuSap.spId = sts->t.sts.s.rlckwuSap.spId;
970 reason = rlcLmmGetSapSts(tRlcCb,&rSts, sts->hdr.elmId.elmnt, action);
975 reason = LCM_REASON_INVALID_ELMNT;
980 if (reason == LCM_REASON_NOT_APPL)
982 rSts.cfm.status = LCM_PRIM_OK;
983 rSts.cfm.reason = LCM_REASON_NOT_APPL;
987 rSts.cfm.status = LCM_PRIM_NOK;
988 rSts.cfm.reason = reason;
990 rlcLmmSendCfm(tRlcCb,pst, &rSts, TSTS, &sts->hdr);
995 /* kw005.201 added support for L2 Measurement */
999 This function processes L2 Measurement requests received from the layer manager.
1000 The L2 Measurement is start for a time period and after the timer expiry, the
1001 measurement confirm is sent.
1003 - Accept only one set of measurements.
1004 - Allocate and initialise RlcL2MeasEvtCb.
1005 - Validate if the measurement is already in progress.
1006 - Loop through the existing measEvtCb with matching measType
1007 - Check if measurement is running for any qci present in the measReq
1008 - If present, move the qCi to list of invalid qCIs.
1009 - Set RlcL2MeasEvtCb.measOn to TRUE for QCIs to be measured.
1010 - For the number of measurements requested.
1011 - For all Ues with RBs matching qCI.
1012 - Add RbCb to the RB linked list.
1013 - Set rlcRbCb.measOn to measurement type.
1014 - If Meas type is DL_DELAY
1015 - Update COUNT to startCount.
1018 * @param[in] pst post structure
1019 * @param[in] action action
1020 * @param[in] cfg LM management structure
1023 * -# Failure : RFAILED
1025 S16 RlcMiLkwL2MeasReq(Pst *pst, RlcL2MeasReqEvt *measReqEvt)
1030 RlcL2MeasCfmEvt measCfmEvt;
1034 tRlcCb = RLC_GET_RLCCB(pst->dstInst);
1036 /* Initialize measCfmEvt */
1037 RLC_MEM_ZERO(&measCfmEvt, sizeof(RlcL2MeasCfmEvt));
1038 /* validate the received measReqEvt */
1039 /*LTE_L2_MEAS_PHASE2*/
1040 if(measReqEvt->measPeriod != 0)
1042 /* L2 MEAS AGHOSH */
1043 if((measReqEvt->measReq.measType & LKW_L2MEAS_DL_IP)||
1044 (measReqEvt->measReq.measType & LKW_L2MEAS_UL_IP))
1046 ret = rlcUtlValidateIpThL2Meas(measReqEvt, &measCfmEvt);
1051 #if (ERRCLASS & ERRCLS_ADD_RES)
1052 #endif /* ERRCLASS & ERRCLS_ADD_RES */
1053 rlcUtlSndUlL2MeasNCfm(tRlcCb, measReqEvt, &measCfmEvt);
1054 RLC_FREE(tRlcCb, measReqEvt, sizeof(RlcL2MeasReqEvt))
1059 measType = measReqEvt->measReq.measType;
1061 if((measType != LKW_L2MEAS_DL_IP) &&
1062 (measType != LKW_L2MEAS_ACT_UE) &&
1063 (measType != LKW_L2MEAS_DL_DISC) &&
1064 (measType != LKW_L2MEAS_DL_DELAY) &&
1065 (measType != LKW_L2MEAS_UU_LOSS) &&
1066 (measType != LKW_L2MEAS_UL_IP))/* || (qci > LKW_MAX_QCI)*/
1068 measCfmEvt.transId = measReqEvt->transId;
1069 measCfmEvt.measType = measType;
1070 measCfmEvt.status.status = LCM_PRIM_NOK;
1071 measCfmEvt.status.reason = LKW_CAUSE_INVALID_MEASTYPE;
1072 rlcUtlSndDlL2MeasNCfm(tRlcCb, measReqEvt, &measCfmEvt);
1073 RLC_FREE(tRlcCb, measReqEvt, sizeof(RlcL2MeasReqEvt))
1077 /* for UL IP throughput meas enable for all QCIs */
1078 if(measType & LKW_L2MEAS_UL_IP)
1080 for(cntr = 0; cntr < LKW_MAX_QCI; cntr++)
1082 tRlcCb->u.ulCb->rlcL2Cb.measOn[cntr] |= LKW_L2MEAS_UL_IP;
1087 (LKW_L2MEAS_DL_IP | LKW_L2MEAS_DL_DISC |
1088 LKW_L2MEAS_DL_DELAY | LKW_L2MEAS_UU_LOSS))
1090 RlcL2MeasReqEvt *measEvt;
1093 udxPst = &(RLC_GET_UDX_SAP(tRlcCb)->pst);
1095 RLC_ALLOC_SHRABL_BUF(udxPst->region,
1098 sizeof(RlcL2MeasReqEvt));
1100 #if (ERRCLASS & ERRCLS_ADD_RES) /* KW_FIX */
1101 if(measEvt == NULLP)
1103 DU_LOG("\nERROR --> RLC : Memory Allocation failed");
1107 memcpy(measEvt, measReqEvt, sizeof(RlcL2MeasReqEvt));
1108 /*Redirect the request to DL task */
1109 /* NOTE:As of today, there are no cases where the Req will fail at DL
1110 as long as it reached the DL, so we don't wait for a confirmation from
1111 DL to send the confirmation to LM*/
1112 /* The interface for sending a confirmation back does not exist today;
1113 it needs to be created when the need arises */
1114 rlcUlUdxL2MeasReq(&(RLC_GET_UDX_SAP(tRlcCb)->pst),measEvt);
1117 /* We need to copy the transId for sending back confirms later */
1118 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
1120 RlcL2MeasEvtCb* measEvtCb = &(tRlcCb->u.ulCb->rlcL2Cb.rlcL2EvtCb[cntr]);
1121 if(measEvtCb->measCb.measType & measType)
1123 measEvtCb->transId= measReqEvt->transId;
1126 /*RLC_FREE(tRlcCb, measReqEvt, sizeof(RlcL2MeasReqEvt));*/
1129 } /* RlcMiLkwL2MeasReq */
1133 This function processes L2 Measurement stop request received from the layer manager.
1134 After receving this request, RLC stops L2 Measurement
1135 * @param[in] pst post structure
1136 * @param[in] measType meas Type
1139 * -# Failure : RFAILED
1142 S16 RlcMiLkwL2MeasStopReq(Pst *pst,uint8_t measType)
1145 RlcL2MeasEvtCb *measEvtCb = NULLP;
1148 uint8_t status = ROK;
1151 tRlcCb = RLC_GET_RLCCB(pst->dstInst);
1153 /* reset the counter values for the measurement that is stopped */
1154 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
1156 measEvtCb = &(tRlcCb->u.ulCb->rlcL2Cb.rlcL2EvtCb[cntr]);
1157 if(measEvtCb->measCb.measType & measType)
1159 rlcUtlResetUlL2MeasInRlcRb(tRlcCb, &measEvtCb->measCb, measType);
1164 /* for UL IP throughput meas disable for all QCIs */
1165 if(measType & LKW_L2MEAS_UL_IP)
1167 for(cntr = 0; cntr < LKW_MAX_QCI; cntr++)
1169 tRlcCb->u.ulCb->rlcL2Cb.measOn[cntr] &= ~LKW_L2MEAS_UL_IP;
1173 if((measType & LKW_L2MEAS_DL_IP) || (measType & LKW_L2MEAS_DL_DISC)
1174 || (measType & LKW_L2MEAS_DL_DELAY))
1176 /*Redirect the request to DL task */
1177 rlcUlUdxL2MeasStopReq(&(RLC_GET_UDX_SAP(tRlcCb)->pst),measType);
1180 /*memset(&measCfmEvt, 0, sizeof(RlcL2MeasCfmEvt)); */
1182 status = LCM_PRIM_OK;
1183 RlcMiLkwL2MeasStopCfm(&tRlcCb->genCfg.lmPst, measType,status);
1189 This function processes L2 Measurement Send request received from the layer manager.
1190 After receving this request, RLC sends L2 Measurement
1191 * @param[in] pst post structure
1192 * @param[in] measType meas Type
1195 * -# Failure : RFAILED
1198 S16 RlcMiLkwL2MeasSendReq(Pst *pst,uint8_t measType)
1201 RlcL2MeasEvtCb *measEvtCb = NULLP;
1205 tRlcCb = RLC_GET_RLCCB(pst->dstInst);
1207 /* In case of addition of any new measType here ,appropriate handling
1208 * has to be done in RLC DL (rlcUtlSndDlL2MeasCfm)*/
1210 (LKW_L2MEAS_DL_DISC | LKW_L2MEAS_DL_DELAY
1211 | LKW_L2MEAS_UU_LOSS| LKW_L2MEAS_DL_IP))
1213 /*Redirect the request to DL task */
1214 rlcUlUdxL2MeasSendReq(&(RLC_GET_UDX_SAP(tRlcCb)->pst),measType);
1215 /* L2 MEAS AGHOSH */
1219 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
1221 measEvtCb = &(tRlcCb->u.ulCb->rlcL2Cb.rlcL2EvtCb[cntr]);
1222 /* L2 MEAS AGHOSH */
1223 if(measEvtCb->measCb.measType & measType)
1225 rlcUtlHdlL2TmrExp(tRlcCb, measEvtCb);
1231 #endif /* LTE_L2_MEAS */
1235 * This function configures the RLC data sap
1237 * @param[in] gCb RLC Instance Control Block
1238 * @param[in] cfg RLC LM Sap configuration structure
1241 * -# LCM_REASON_NOT_APPL (SUCCESS)
1242 * -# LCM_REASON_INVALID_SAP
1243 * -# LCM_REASON_MEM_NOAVAIL
1244 * -# LCM_REASON_RECONFIG_FAIL
1246 static S16 rlcLmmCfgKwuSap(RlcCb *gCb,RlcSapCfg *cfg)
1248 RlcKwuSapCb *rlcKwuSapCb;
1250 #if (ERRCLASS & ERRCLS_INT_PAR)
1251 /* Validate the protocol parameters */
1252 if((cfg->sapId >= (S16)gCb->genCfg.maxKwuSaps) || (cfg->sapId < 0))
1254 return (LCM_REASON_INVALID_PAR_VAL);
1256 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1258 rlcKwuSapCb = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL) ?
1259 (RlcKwuSapCb*)(gCb->u.dlCb->rlcKwuDlSap + cfg->sapId):
1260 (RlcKwuSapCb*)(gCb->u.ulCb->rlcKwuUlSap + cfg->sapId);
1262 #if (ERRCLASS & ERRCLS_INT_PAR)
1263 /* Check for reconfiguration */
1264 if (rlcKwuSapCb->state != RLC_SAP_NOT_CFG)
1266 DU_LOG("\nERROR --> RLC : RLC Mode [%d] : Invalid rlckwuSap State [%d]",
1267 gCb->genCfg.rlcMode, rlcKwuSapCb->state);
1268 /* reconfiguration not allowed */
1269 return (LCM_REASON_RECONFIG_FAIL);
1271 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1273 /* Fill the parameters */
1274 RLC_FILL_SAP_HELPER(rlcKwuSapCb, cfg, gCb);
1276 return (LCM_REASON_NOT_APPL);
1281 * This function configures the RLC control sap
1283 * @param[in] gCb RLC Instance Control Block
1284 * @param[in] cfg RLC LM Sap configuration structure
1287 * -# LCM_REASON_NOT_APPL (SUCCESS)
1288 * -# LCM_REASON_INVALID_SAP
1289 * -# LCM_REASON_INVALID_SAP
1290 * -# LCM_REASON_RECONFIG_FAIL
1292 static S16 rlcLmmCfgCkwSap(RlcCb *gCb,RlcSapCfg *cfg)
1294 RlcCkwSapCb *ckwSap;
1296 #if (ERRCLASS & ERRCLS_INT_PAR)
1297 /* Validate config parameters */
1298 if ((cfg->sapId >= RLC_MAX_CKWSAPS) || (cfg->sapId < 0) )
1300 return (LCM_REASON_INVALID_PAR_VAL);
1303 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1305 /* Get Sap control block */
1306 return (LCM_REASON_INVALID_PAR_VAL);
1310 ckwSap = &(gCb->u.ulCb->ckwSap);
1312 #if (ERRCLASS & ERRCLS_INT_PAR)
1313 /* Check for reconfiguration */
1314 if(ckwSap->state != RLC_SAP_NOT_CFG)
1316 DU_LOG("\nERROR --> RLC : Invalid rlckwuSap State [%d]",ckwSap->state);
1317 return (LCM_REASON_RECONFIG_FAIL);
1319 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1321 /* Fill the parameters */
1322 RLC_FILL_SAP_HELPER(ckwSap, cfg, gCb);
1324 return (LCM_REASON_NOT_APPL);
1329 * This function configures the UDX sap
1331 * @param[in] gCb RLC Instance Control Block
1332 * @param[in] cfg RLC LM Sap configuration structure
1335 * -# LCM_REASON_NOT_APPL (SUCCESS)
1336 * -# LCM_REASON_INVALID_SAP
1337 * -# LCM_REASON_INVALID_SAP
1338 * -# LCM_REASON_RECONFIG_FAIL
1340 static S16 rlcLmmCfgUdxSap(RlcCb *gCb,RlcSapCfg *cfg)
1342 RlcUdxDlSapCb *udxDlSap;
1343 RlcUdxUlSapCb *udxUlSap;
1345 #if (ERRCLASS & ERRCLS_INT_PAR)
1346 /* Validate the protocol parameters */
1347 if((cfg->sapId >= RLC_MAX_UDXSAPS) || (cfg->sapId < 0))
1349 return (LCM_REASON_INVALID_PAR_VAL);
1352 /* Get Sap control block */
1353 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1355 udxDlSap = (gCb->u.dlCb->udxDlSap + cfg->sapId);
1356 #if (ERRCLASS & ERRCLS_INT_PAR)
1357 /* Check for reconfiguration */
1358 if(udxDlSap->state != RLC_SAP_NOT_CFG)
1360 DU_LOG("\nERROR --> RLC : Invalid udxDlSap State [%d]",udxDlSap->state);
1361 return (LCM_REASON_RECONFIG_FAIL);
1363 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1365 /* Fill the parameters */
1366 RLC_FILL_SAP_HELPER(udxDlSap, cfg, gCb);
1370 udxUlSap = (gCb->u.ulCb->udxUlSap + cfg->sapId);
1372 #if (ERRCLASS & ERRCLS_INT_PAR)
1373 /* Check for reconfiguration */
1374 if(udxUlSap->state != RLC_SAP_NOT_CFG)
1376 DU_LOG("\nERROR --> RLC : Invalid udxUlSap State [%d]", udxUlSap->state);
1377 return (LCM_REASON_RECONFIG_FAIL);
1379 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1381 /* Fill the parameters */
1382 RLC_FILL_SAP_HELPER(udxUlSap, cfg, gCb);
1384 udxUlSap->bndTmrInt = cfg->bndTmrIntvl;
1385 udxUlSap->retryCnt = 0;
1386 cmInitTimers(&(udxUlSap->bndTmr), 1);
1389 return (LCM_REASON_NOT_APPL);
1394 * This function configures the RGU sap
1396 * @param[in] gCb RLC Instance Control Block
1397 * @param[in] cfg RLC LM Sap configuration structure
1399 * -# LCM_REASON_NOT_APPL (SUCCESS)
1400 * -# LCM_REASON_INVALID_SAP
1401 * -# LCM_REASON_INVALID_SAP
1402 * -# LCM_REASON_RECONFIG_FAIL
1404 static S16 rlcLmmCfgRguSap(RlcCb *gCb,RlcSapCfg *cfg)
1406 RlcRguSapCb *rguSap;
1408 #if (ERRCLASS & ERRCLS_INT_PAR)
1409 /* Validate the protocol parameters */
1410 if((cfg->sapId >= gCb->genCfg.maxRguSaps) || \
1413 RLCLOGERROR(gCb,ERRCLS_INT_PAR, EKW047, (ErrVal)cfg->sapId,
1414 "rlcLmmCfgRguSap: Invalid RGU sapId\n");
1415 return (LCM_REASON_INVALID_PAR_VAL);
1419 rguSap = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL) ?
1420 &(gCb->u.dlCb->rguDlSap[cfg->sapId]): &(gCb->u.ulCb->rguUlSap[cfg->sapId]);
1422 #if (ERRCLASS & ERRCLS_INT_PAR)
1423 /* Check for reconfiguration */
1424 if(rguSap->state != RLC_SAP_NOT_CFG)
1426 DU_LOG("\nERROR --> RLC : RLC Mode [%d]: Invalid rguSap State [%d]",
1427 gCb->genCfg.rlcMode, rguSap->state);
1428 return (LCM_REASON_RECONFIG_FAIL);
1430 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1432 /* Fill the parameters */
1433 RLC_FILL_SAP_HELPER(rguSap, cfg, gCb);
1434 rguSap->suId = cfg->sapId;
1435 rguSap->bndTmrInt = cfg->bndTmrIntvl;
1436 rguSap->retryCnt = 0;
1437 rguSap->state = RLC_SAP_CFG;
1439 cmInitTimers(&(rguSap->bndTmr), 1);
1441 return (LCM_REASON_NOT_APPL);
1446 * Validates the RLC general control parameters
1448 * @param[in] cntrl RLC LM structure
1451 * -# LCM_REASON_NOT_APPL (SUCCESS)
1452 * -# LCM_REASON_INVALID_SUBACTION
1453 * -# LCM_REASON_INVALID_ACTION
1455 static S16 rlcLmmValidateGenCntrl(RlcMngmt *cntrl)
1457 S16 reason; /* reason for failure */
1458 uint8_t sAction; /* subaction field */
1460 reason = LCM_REASON_NOT_APPL;
1461 sAction = cntrl->t.cntrl.subAction;
1463 switch (cntrl->t.cntrl.action)
1467 if ((sAction != SAUSTA) &&
1468 (sAction != SADBG) &&
1471 reason = LCM_REASON_INVALID_SUBACTION;
1477 reason = LCM_REASON_INVALID_ACTION;
1486 * it deregisters the timers and deregisters the rlckwuSap Control blocks
1488 * @param[in] gCb RLC Instance Control Block
1492 static Void rlcLmmCleanGblRsrcs(RlcCb *gCb)
1497 if (gCb->init.cfgDone)
1499 /* Deregister the timers */
1500 /*Pradeep: changing the SDeregTmrMt() to SDeregTmr*/
1501 (Void) SDeregTmrMt(gCb->init.ent, gCb->init.inst,
1502 (S16)gCb->genCfg.timeRes, rlcActvTmr);
1503 /*(Void) SDeregTmr(gCb->init.ent, gCb->init.inst,
1504 (S16)gCb->genCfg.timeRes, rlcActvTmr);*/
1506 rlcSapSize = (Size)(gCb->genCfg.maxKwuSaps * sizeof(RlcKwuSapCb));
1508 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1510 rlcUdxSapSize = (Size)(gCb->genCfg.maxUdxSaps * sizeof(RlcUdxDlSapCb));
1513 gCb->u.dlCb->shutdownReceived = TRUE;
1514 rlcUtlFreeDlMemory(gCb);
1515 if (gCb->u.dlCb->rlcKwuDlSap != NULLP)
1517 RLC_FREE(gCb,gCb->u.dlCb->rlcKwuDlSap, rlcSapSize);
1520 if(gCb->u.dlCb->udxDlSap != NULLP)
1522 RLC_FREE(gCb,gCb->u.dlCb->udxDlSap, rlcUdxSapSize);
1525 if(gCb->u.dlCb->rguDlSap != NULLP)
1527 RLC_FREE(gCb,gCb->u.dlCb->rguDlSap, gCb->genCfg.maxRguSaps);
1528 gCb->genCfg.maxRguSaps = 0;
1530 if (gCb->u.dlCb->shutdownReceived)
1532 if (gCb->u.dlCb->selfPstMBuf != NULL)
1534 ODU_PUT_MSG_BUF(gCb->u.dlCb->selfPstMBuf);
1536 RLC_FREE(gCb,gCb->u.dlCb, sizeof (RlcDlCb));
1543 rlcUdxSapSize = (Size)(gCb->genCfg.maxUdxSaps * sizeof(RlcUdxUlSapCb));
1546 if (gCb->u.ulCb->rlcKwuUlSap != NULLP)
1548 RLC_FREE(gCb,gCb->u.ulCb->rlcKwuUlSap, rlcSapSize);
1551 if(gCb->u.ulCb->udxUlSap != NULLP)
1553 RLC_FREE(gCb,gCb->u.ulCb->udxUlSap, rlcUdxSapSize);
1556 if(gCb->u.ulCb->rguUlSap != NULLP)
1558 RLC_FREE(gCb,gCb->u.ulCb->rguUlSap, gCb->genCfg.maxRguSaps);
1559 gCb->genCfg.maxRguSaps = 0;
1562 RLC_FREE(gCb,gCb->u.ulCb, sizeof (RlcUlCb));
1566 gCb->init.cfgDone = FALSE;
1567 gCb->init.acnt = FALSE;
1568 gCb->init.trc = FALSE;
1570 gCb->init.usta = FALSE;
1578 * Delete all SAPs and Control Blocks
1581 * Shutdown of RLC happens at modules level, tm, um and am modules will be
1582 * shutdown using utility functin and dbm shutdown will clean up the SAPs,
1583 * control blocks and lists.
1585 * @params[in] gCb RLC instance control block
1588 * -# LCM_REASON_NOT_APPL (SUCCESS)
1589 * -# LCM_REASON_HASHING_FAILED
1591 static S16 rlcLmmShutdown(RlcCb *gCb)
1593 RlcRguSapCb *rguSap;
1596 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1598 for (idx = 0; idx < gCb->genCfg.maxRguSaps; idx++)
1600 rguSap = &(gCb->u.dlCb->rguDlSap[idx]);
1601 if ((rguSap->state == RLC_SAP_BND) || (rguSap->state == RLC_SAP_BINDING))
1603 RlcLiRguUbndReq(&(rguSap->pst), rguSap->spId, 0);
1609 for (idx = 0; idx < gCb->genCfg.maxRguSaps; idx++)
1611 rguSap = &(gCb->u.ulCb->rguUlSap[idx]);
1612 if ((rguSap->state == RLC_SAP_BND) || (rguSap->state == RLC_SAP_BINDING))
1614 RlcLiRguUbndReq(&(rguSap->pst), rguSap->spId, 0);
1619 if(gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1621 rlcDbmDlShutdown(gCb);
1625 rlcDbmUlShutdown(gCb);
1628 rlcDelTputSnssaiList(gCb);
1629 rlcLmmCleanGblRsrcs(gCb);
1631 RLC_MEM_SET (&(gCb->genSts), 0, sizeof (RlcGenSts));
1633 return (LCM_REASON_NOT_APPL);
1638 * Function processes the general control request
1640 * @param[in] gCb RLC instance control block
1641 * @param[in] cntrl RLC LM structure
1644 * -# LCM_REASON_NOT_APPL (SUCCESS)
1645 * -# LCM_REASON_INVALID_SUBACTION
1646 * -# LCM_REASON_INVALID_ACTION
1648 static S16 rlcLmmGenCntrl(RlcCb *gCb,RlcMngmt *cntrl)
1650 RlcTrcCntrl *trcCntrl; /* trace */
1652 RlcDbgCntrl *dbgCntrl; /* debug */
1654 S16 reason; /* reason for failure */
1656 /* Validate control parameters */
1657 reason = rlcLmmValidateGenCntrl (cntrl);
1659 if (reason != LCM_REASON_NOT_APPL)
1664 switch(cntrl->t.cntrl.action)
1668 switch(cntrl->t.cntrl.subAction)
1672 RLC_SET_USTA_FLAG(gCb, TRUE);
1678 dbgCntrl = &cntrl->t.cntrl.s.dbgCntrl;
1679 RLC_GET_DBG_MASK(gCb) |= dbgCntrl->dbgMask;
1685 trcCntrl = &cntrl->t.cntrl.s.trcCntrl;
1686 gCb->init.trc = TRUE;
1687 gCb->trcLen = trcCntrl->trcLen;
1688 (gCb->trcMask) |= trcCntrl->trcMask;
1696 switch(cntrl->t.cntrl.subAction)
1700 gCb->init.usta = FALSE;
1706 dbgCntrl = &cntrl->t.cntrl.s.dbgCntrl;
1707 RLC_GET_DBG_MASK(gCb) &= ~(dbgCntrl->dbgMask);
1713 trcCntrl = &cntrl->t.cntrl.s.trcCntrl;
1714 gCb->init.trc = FALSE;
1715 gCb->trcMask &= ~(trcCntrl->trcMask);
1723 reason = rlcLmmShutdown(gCb);
1732 * Bind/Unbind RLC UDX sap
1734 * @param[in] gCb RLC Instance Control Block
1735 * @param[in] cntrl RLC LM structure
1738 * -# LCM_REASON_NOT_/PPL (SUCCESS)
1739 * -# LCM_REASON_INVALID_SAP
1740 * -# LCM_REASON_INVALID_STATE
1741 * -# LCM_REASON_INVALID_ACTION
1743 static S16 rlcLmmUdxSapCntrl(RlcCb *gCb,RlcMngmt *cntrl)
1746 #if (ERRCLASS & ERRCLS_INT_PAR)
1747 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1749 return (LCM_REASON_INVALID_SAP);
1752 if((cntrl->t.cntrl.s.sapCntrl.suId < 0) ||
1753 (cntrl->t.cntrl.s.sapCntrl.suId >= RLC_MAX_UDXSAPS))
1755 return (LCM_REASON_INVALID_SAP);
1757 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1759 #define UDX_SAP gCb->u.ulCb->udxUlSap[cntrl->t.cntrl.s.sapCntrl.suId]
1760 #if (ERRCLASS & ERRCLS_INT_PAR)
1762 if(UDX_SAP.state == RLC_SAP_NOT_CFG)
1764 DU_LOG("\nERROR --> RLC : udxUlSap not configured yet");
1765 return (LCM_REASON_INVALID_STATE);
1767 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1769 switch(cntrl->t.cntrl.action)
1773 if(UDX_SAP.state != RLC_SAP_BND)
1775 /* start timer to wait for bind confirm */
1776 rlcStartTmr(gCb,(PTR)(&UDX_SAP), EVENT_RLC_WAIT_BNDCFM);
1777 UDX_SAP.state = RLC_SAP_BINDING;
1778 rlcUlUdxBndReq(&(UDX_SAP.pst), UDX_SAP.suId, UDX_SAP.spId);
1782 /* control request received for an already bound SAP */
1783 return (LCM_REASON_INVALID_STATE);
1789 /* make the state of UDXSAP configured but not bound */
1790 UDX_SAP.state = RLC_SAP_CFG;
1791 rlcUlUdxUbndReq(&(UDX_SAP.pst), UDX_SAP.spId, 0);
1795 return (LCM_REASON_INVALID_ACTION);
1797 } /* end of switch */
1799 return (LCM_REASON_NOT_APPL);
1804 * Bind/Unbind RLC lower sap
1806 * @param[in] gCb RLC Instance Control Block
1807 * @param[in] cntrl RLC LM structure
1809 * -# LCM_REASON_NOT_APPL (SUCCESS)
1810 * -# LCM_REASON_INVALID_SAP
1811 * -# LCM_REASON_INVALID_STATE
1812 * -# LCM_REASON_INVALID_ACTION
1814 static S16 rlcLmmLSapCntrl(RlcCb *gCb,RlcMngmt *cntrl)
1816 RlcRguSapCb *rguSap; /* rgu sap pointer */
1818 #if (ERRCLASS & ERRCLS_INT_PAR)
1820 if((cntrl->t.cntrl.s.sapCntrl.suId < 0) ||
1821 (cntrl->t.cntrl.s.sapCntrl.suId >= gCb->genCfg.maxRguSaps))
1823 RLCLOGERROR(gCb,ERRCLS_INT_PAR, EKW047, (ErrVal)cntrl->t.cntrl.s.sapCntrl.suId,
1824 "rlcLmmLSapCntrl: Invalid RGU suId\n");
1825 return (LCM_REASON_INVALID_SAP);
1827 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1828 rguSap = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL) ?
1829 &(gCb->u.dlCb->rguDlSap[cntrl->t.cntrl.s.sapCntrl.suId]): \
1830 &(gCb->u.ulCb->rguUlSap[cntrl->t.cntrl.s.sapCntrl.suId]);
1832 #if (ERRCLASS & ERRCLS_INT_PAR)
1834 if(rguSap->state == RLC_SAP_NOT_CFG)
1836 DU_LOG("\nERROR --> RLC : RLC Mode [%d]:rguSap not configured yet", gCb->genCfg.rlcMode);
1837 return (LCM_REASON_INVALID_STATE);
1839 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1841 switch(cntrl->t.cntrl.action)
1845 if(rguSap->state != RLC_SAP_BND)
1847 /* start timer to wait for bind confirm */
1848 rlcStartTmr(gCb,(PTR)(rguSap), EVENT_RLC_WAIT_BNDCFM);
1849 rguSap->state = RLC_SAP_BINDING;
1850 rguSap->spId = cntrl->t.cntrl.s.sapCntrl.spId;
1851 rguSap->suId = cntrl->t.cntrl.s.sapCntrl.suId;
1852 RlcLiRguBndReq(&(rguSap->pst), rguSap->suId, rguSap->spId);
1856 /* control request received for an already bound SAP */
1857 return (LCM_REASON_INVALID_STATE);
1863 /* make the state of RGUSAP is configure but not bound */
1864 rguSap->state = RLC_SAP_CFG;
1865 RlcLiRguUbndReq(&(rguSap->pst), rguSap->spId, 0);
1869 return (LCM_REASON_INVALID_ACTION);
1871 } /* end of switch */
1873 return (LCM_REASON_NOT_APPL);
1878 * Function gather the general KWU SAP status
1880 * @param[in] gCb RLC Instance Control Block
1881 * @param[in] sta LM KWU Sap Status structure
1884 * -# LCM_REASON_NOT_APPL (SUCCESS)
1885 * -# LCM_REASON_INVALID_PAR_VAL(FAILURE)
1887 static S16 rlcLmmGetKwuSapSta (RlcCb *gCb,RlcKwuSapSta *sta)
1889 RlcKwuSapCb *rlcKwSapCb;
1891 #if (ERRCLASS & ERRCLS_INT_PAR)
1892 /* Validate the protocol parameters */
1893 if ((sta->spId >= (S16)gCb->genCfg.maxKwuSaps)||
1896 return (LCM_REASON_INVALID_PAR_VAL);
1900 /* Get Sap control block */
1901 rlcKwSapCb = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)?
1902 (RlcKwuSapCb*)(gCb->u.dlCb->rlcKwuDlSap + sta->spId):
1903 (RlcKwuSapCb*)(gCb->u.ulCb->rlcKwuUlSap + sta->spId);
1905 sta->state = rlcKwSapCb->state;
1907 return (LCM_REASON_NOT_APPL);
1912 * Function gather the general RGU SAP status
1914 * @param[in] gCb RLC Instance Control Block
1915 * @param[in] sta LM RGU Sap Status structure
1917 * -# LCM_REASON_NOT_APPL (SUCCESS)
1918 * -# LCM_REASON_INVALID_PAR_VAL(FAILURE)
1920 static S16 rlcLmmGetRguSapSta(RlcCb *gCb,RlcRguSapSta *sta)
1923 #if (ERRCLASS & ERRCLS_INT_PAR)
1924 /* Validate the protocol parameters */
1925 if((sta->suId >= RLC_MAX_RGUSAPS) || (sta->suId < 0))
1927 return (LCM_REASON_INVALID_PAR_VAL);
1931 sta->state = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL) ?
1932 gCb->u.dlCb->rguDlSap[sta->suId].state :
1933 gCb->u.ulCb->rguUlSap[sta->suId].state ;
1935 return (LCM_REASON_NOT_APPL);
1940 * Function gather the general CKW SAP status
1942 * @param[in] gCb RLC Instance Control Block
1943 * @param[in] sta LM CKW Sap Status structure
1945 * -# LCM_REASON_NOT_APPL (SUCCESS)
1946 * -# LCM_REASON_INVALID_PAR_VAL(FAILURE)
1948 static S16 rlcLmmGetCkwCntSapSta(RlcCb *gCb,RlcCkwCntSapSta *sta)
1951 #if (ERRCLASS & ERRCLS_INT_PAR)
1952 /* Validate config parameters */
1953 if ((sta->spId >= RLC_MAX_CKWSAPS ) ||
1955 (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL))
1957 return (LCM_REASON_INVALID_PAR_VAL);
1960 sta->state = gCb->u.ulCb->ckwSap.state;
1962 return (LCM_REASON_NOT_APPL);
1968 * Gather the general statistics
1970 * @param[in] gCb RLC Instance Control Block
1971 * @param[in] sts LM general statistics structure
1972 * @param[in] action action
1974 * -# LCM_REASON_NOT_APPL (SUCCESS)
1975 * -# LCM_REASON_INVALID_PAR_VAL(FAILURE)
1977 static S16 rlcLmmGetGenSts(RlcCb *gCb,RlcGenSts *sts,Action action)
1980 #if (ERRCLASS & ERRCLS_INT_PAR)
1981 /* Validate protocol parameters */
1982 if ((action != LKW_ZEROSTS) && (action != LKW_NOZEROSTS))
1984 return (LCM_REASON_INVALID_PAR_VAL);
1990 if(action == LKW_ZEROSTS)
1992 RLC_MEM_SET (&(gCb->genSts), 0, sizeof (RlcGenSts));
1995 return (LCM_REASON_NOT_APPL);
2000 * Gather the SAP statistics
2002 * @param[in] gCb RLC Instance Control Block
2003 * @param[in] sts LM general statistics structure
2004 * @param[in] elmnt element
2005 * @param[in] action action
2008 * -# LCM_REASON_NOT_APPL (SUCCESS)
2009 * -# LCM_REASON_INVALID_PAR_VAL (FAIL)
2011 static S16 rlcLmmGetSapSts(RlcCb *gCb,RlcMngmt *sts,Elmnt elmnt, Action action)
2014 /* Validate protocol parameters */
2015 if (action != LKW_ZEROSTS && action != LKW_NOZEROSTS)
2017 return (LCM_REASON_INVALID_PAR_VAL);
2023 RlcKwuSapSts *rlckwuSap;
2024 RlcKwuSapCb *rlcKwuSapCb;
2025 rlckwuSap = &sts->t.sts.s.rlckwuSap;
2027 /* Get Sap control block */
2028 /* kw005.201, modified the element of rlckwuSap from suId to spId */
2029 rlcKwuSapCb = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)?
2030 (RlcKwuSapCb*)(gCb->u.dlCb->rlcKwuDlSap + rlckwuSap->spId):
2031 (RlcKwuSapCb*)(gCb->u.ulCb->rlcKwuUlSap + rlckwuSap->spId);
2034 *rlckwuSap = rlcKwuSapCb->sts;
2036 if (action == LKW_ZEROSTS)
2038 RLC_MEM_SET (&rlcKwuSapCb->sts, 0, sizeof (RlcKwuSapSts));
2042 /* kw005.201 removed RGUSAP statistics support */
2045 RlcCkwCntSts *ckwSap;
2046 ckwSap = &sts->t.sts.s.ckwSap;
2047 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
2049 return (LCM_REASON_INVALID_PAR_VAL);
2052 ckwSap->statMsgs = gCb->u.ulCb->ckwSap.sts.statMsgs;
2054 if (action == LKW_ZEROSTS)
2056 RLC_MEM_SET (&(gCb->u.ulCb->ckwSap.sts), 0, sizeof (RlcCkwCntSts));
2061 return (LCM_REASON_INVALID_ELMNT);
2064 SGetDateTime(&sts->t.sts.dt);
2066 return (LCM_REASON_NOT_APPL);
2071 * This function sends Unsolicited Status Indication to the Layer Management
2074 * @param[in] gCb RLC Instance Control Block
2075 * @param[in] category Category
2076 * @param[in] event event
2077 * @param[in] cause cause
2078 * @param[in] UeId ueId
2079 * @param[in] Qci qci
2084 Void rlcLmmSendAlarm
2094 #else /* LTE_L2_MEAS */
2095 Void rlcLmmSendAlarm
2104 #endif /* LTE_L2_MEAS */
2106 RlcMngmt usta; /* Rlc Management Structure */
2108 if(gCb->init.usta == FALSE)
2113 usta.hdr.elmId.elmnt = STGEN;
2114 usta.hdr.entId.ent = gCb->init.ent;
2115 usta.hdr.entId.inst = gCb->init.inst;
2117 /* fill in the event and category */
2118 usta.t.usta.alarm.category = category;
2119 usta.t.usta.alarm.event = event;
2120 usta.t.usta.alarm.cause = cause;
2122 /* set the suId and ueId */
2123 usta.t.usta.ueId = ueId;
2124 usta.t.usta.suId = suId;
2125 /* kw005.201 added support for L2 Measurement */
2127 if(event == LKW_EVT_MEAS_HALT)
2129 usta.t.usta.qci = qci;
2131 #endif /* LTE_L2_MEAS */
2132 /* update the date and time */
2133 (Void) SGetDateTime(&usta.t.usta.alarm.dt);
2135 RlcMiLkwStaInd(&(gCb->init.lmPst), &usta);
2143 * This function sends trace indication to LM
2145 * @param[in] gCb RLC Instance Control Block
2146 * @param[in] event event
2147 * @param[in] mBuf meessage buffer
2153 S16 rlcLmmSendTrc(RlcCb *gCb,Event event,Buffer *mBuf)
2155 RlcMngmt trc; /* RLC management control block */
2162 DU_LOG("\nDEBUG --> RLC : rlcLmmSendTrc(): Trace for event=%d, gCb->trcLen=%d",
2166 memset(&trc, 0, sizeof(RlcMngmt));
2168 pst = gCb->init.lmPst;
2170 trc.t.trc.event = event;
2171 SGetDateTime(&trc.t.trc.dt);
2172 trc.cfm.status = LCM_PRIM_OK;
2173 trc.cfm.reason = LCM_REASON_NOT_APPL;
2177 /* Check if the whole buffer is to be sent in Trace indication */
2178 if(gCb->trcLen == LKW_FULL_TRACE)
2180 if (SCpyMsgMsg(mBuf, pst.region, pst.pool, &dstMbuf)
2183 /* rg005.201 removed SPutSBuf on error */
2184 DU_LOG("\nERROR --> RLC : SCpyMsgMsg Failed");
2187 /* Send Trace Indication to Layer manager */
2188 RlcMiLkwTrcInd(&pst, &trc, dstMbuf);
2190 /* check if only a specified number of bytes are to be sent */
2191 else if(gCb->trcLen > 0)
2193 /* Get the length of the recvd message buffer */
2194 if (SFndLenMsg(mBuf, &bufLen) != ROK)
2196 DU_LOG("\nERROR --> RLC : SFndLenMsg Failed");
2199 /* Check if the recvd buffer size is less than request trace len */
2200 if(bufLen < gCb->trcLen)
2202 /* Copy the whole of the recvd buffer in trace indication */
2204 if (SCpyMsgMsg(mBuf, pst.region, pst.pool, &dstMbuf)
2207 DU_LOG("\nERROR --> RLC : SCpyMsgMsg Failed");
2211 /* Send Trace Indication to Layer manager */
2212 RlcMiLkwTrcInd(&pst, &trc, dstMbuf);
2216 /* if the recvd buffer size is greater than request trace len */
2217 /* Get a temporary buffer to store the msg */
2218 RLC_ALLOC(gCb,tempBuf, gCb->trcLen);
2220 #if (ERRCLASS & ERRCLS_INT_PAR)
2221 if(tempBuf == NULLP)
2223 (Void) SPutSMem(RLC_GET_MEM_REGION(gCb), RLC_GET_MEM_POOL(gCb));
2225 DU_LOG("\nERROR --> RLC : Memory Allocation failed");
2226 return (LCM_REASON_MEM_NOAVAIL);
2228 #endif /* ERRCLASS & ERRCLS_INT_PAR */
2230 /* Copy trcLen nos of bytes from the recvd message */
2231 if (SCpyMsgFix(mBuf,0,gCb->trcLen,tempBuf,&tempCnt) != ROK)
2233 DU_LOG("\nERROR --> RLC : SCpyMsgFix Failed");
2237 if (ODU_GET_MSG_BUF(pst.region, pst.pool, &dstMbuf) != ROK)
2239 DU_LOG("\nERROR --> RLC : Memory Allocation failed");
2242 /* Copy the tempBuf data to dst mBuf */
2243 if (SCpyFixMsg(tempBuf,dstMbuf,0,gCb->trcLen,&tempCnt) != ROK)
2245 DU_LOG("\nERROR --> RLC : SCpyMsgFix Failed");
2249 /* Free the memory allocated for tempBuf */
2250 RLC_FREE(gCb,tempBuf, gCb->trcLen);
2251 /* Send Trace Indication to Layer manager */
2252 RlcMiLkwTrcInd(&pst, &trc, dstMbuf);
2258 RlcMiLkwTrcInd(&pst, &trc, mBuf);
2267 * Activate Task - timer
2270 * Invoked by system services to activate a task with a timer tick.
2272 * @param[in] ent entity
2273 * @param[in] inst instance
2281 S16 rlcActvTmr(Ent ent,Inst inst)
2285 if (inst >= MAX_RLC_INSTANCES)
2289 gCb = RLC_GET_RLCCB(inst);
2290 cmPrcTmr(&(gCb->rlcTqCp), gCb->rlcTq, (PFV) rlcTmrExpiry);
2293 } /* end of rlcActvTmr */
2296 /********************************************************************30**
2299 **********************************************************************/