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 Manager file
25 Desc: It contains the following common functions for processing
26 the all the external interfaces.
40 *********************************************************************21*/
41 static const char* RLOG_MODULE_NAME="LMM";
42 static int RLOG_MODULE_ID=2048;
43 static int RLOG_FILE_ID=197;
45 @brief RLC Layer Manager Module
49 /* header (.h) include files */
50 #include "envopt.h" /* environment options */
51 #include "envdep.h" /* environment dependent */
52 #include "envind.h" /* environment independent */
54 #include "gen.h" /* general */
55 #include "ssi.h" /* system services */
56 #include "cm5.h" /* common timer defines */
57 #include "cm_tkns.h" /* common tokens defines */
58 #include "cm_mblk.h" /* common memory allocation library defines */
59 #include "cm_llist.h" /* common link list defines */
60 #include "cm_hash.h" /* common hash list defines */
61 #include "cm_lte.h" /* common LTE defines */
62 #include "lkw.h" /* LKW defines */
63 #include "ckw.h" /* CKW defines */
64 #include "kwu.h" /* KWU defines */
65 #include "rgu.h" /* RGU defines */
66 #include "kw_err.h" /* Err defines */
67 #include "kw_env.h" /* RLC environment options */
69 #include "kw.h" /* RLC defines */
74 /* extern (.x) include files */
75 #include "gen.x" /* general */
76 #include "ssi.x" /* system services */
78 #include "cm5.x" /* common timer library */
79 #include "cm_tkns.x" /* common tokens */
80 #include "cm_mblk.x" /* common memory allocation */
81 #include "cm_llist.x" /* common link list */
82 #include "cm_hash.x" /* common hash list */
83 #include "cm_lte.x" /* common LTE includes */
84 #include "cm_lib.x" /* common memory allocation library */
85 #include "lkw.x" /* LKW */
86 #include "ckw.x" /* CKW */
87 #include "kwu.x" /* KWU */
88 #include "rgu.x" /* RGU */
95 #define KW_MODULE KW_DBGMASK_LMM
99 /*********************************************************************
100 * Forward Declaration of LKW Porting Functions
101 ********************************************************************/
102 PUBLIC KwCb *kwCb[KW_MAX_RLC_INSTANCES];
103 EXTERN S16 kwActvTmr ARGS ((Ent ent, Inst inst));
105 PRIVATE Void kwLmmSendCfm ARGS ((KwCb *gCb,Pst *pst,KwMngmt *cfm,U8 type,
107 PRIVATE S16 kwLmmGenCfg ARGS ((KwCb *gCb, KwGenCfg *cfg));
108 PRIVATE S16 kwLmmCfgKwuSap ARGS ((KwCb *gCb,KwSapCfg *cfg));
109 PRIVATE S16 kwLmmCfgUdxSap ARGS ((KwCb *gCb,KwSapCfg *cfg));
110 PRIVATE S16 kwLmmCfgCkwSap ARGS ((KwCb *gCb,KwSapCfg *cfg));
111 PRIVATE S16 kwLmmCfgRguSap ARGS ((KwCb *gCb,KwSapCfg *cfg));
112 PRIVATE S16 kwLmmGenCntrl ARGS ((KwCb *gCb,KwMngmt *cntrl));
113 PRIVATE S16 kwLmmUdxSapCntrl ARGS ((KwCb *gCb,KwMngmt *cntrl));
114 PRIVATE S16 kwLmmLSapCntrl ARGS ((KwCb *gCb,KwMngmt *cntrl));
115 PRIVATE S16 kwLmmGetKwuSapSta ARGS ((KwCb *gCb,KwKwuSapSta *sta));
116 PRIVATE S16 kwLmmGetRguSapSta ARGS ((KwCb *gCb,KwRguSapSta *sta));
117 PRIVATE S16 kwLmmGetCkwCntSapSta ARGS ((KwCb *gCb,KwCkwCntSapSta *sta));
118 PRIVATE S16 kwLmmGetGenSts ARGS ((KwCb *gCb,KwGenSts *sts,Action action));
119 PRIVATE S16 kwLmmGetSapSts ARGS ((KwCb *gCb,KwMngmt *sts,Elmnt elmnt,Action
123 /*********************************************************************
124 * Primitives for RGU interface
125 ********************************************************************/
128 * Stores the general RLC configuration.
130 * It calculates the memory requirement of the Saps
131 * It also initializes the control blocks, the hash lists and registers
132 * the timers. In case of error it rolls back and reports error in the
133 * confirm.If the general configuration is already done it is treated as
134 * reconfiguration, but right now reconfiguration is not supported.
136 * @param[in] gCb RLC Instance Control Block
137 * @param[in] cfm RLC LM general config structure
140 * LCM_REASON_NOT_APPL (SUCCESS)
141 * LCM_REASON_MEM_NOAVAIL
142 * LCM_REASON_REGTMR_FAIL
143 * LCM_REASON_INVALID_PAR_VAL
144 * LCM_REASON_HASHING_FAILED
147 PRIVATE S16 kwLmmGenCfg
153 PRIVATE S16 kwLmmGenCfg(gCB,cfg)
166 if(cfg->maxUe > KW_MAX_UE)
168 #if (ERRCLASS & ERRCLS_INT_PAR)
169 RLOG2(L_ERROR, "Invalid maxUe : Max [%lu] Received [%lu]",
172 #endif /* ERRCLASS & ERRCLS_INT_PAR */
173 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
176 if(cfg->maxKwuSaps > KW_MAX_KWUSAPS)
178 #if (ERRCLASS & ERRCLS_INT_PAR)
179 RLOG2(L_ERROR, "Invalid maxKwuSaps : Max [%lu] Received [%lu]",
182 #endif /* ERRCLASS & ERRCLS_INT_PAR */
183 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
186 if(cfg->maxUdxSaps > KW_MAX_UDXSAPS)
188 #if (ERRCLASS & ERRCLS_INT_PAR)
189 RLOG2(L_ERROR, "Invalid maxUduSaps : Max [%lu] Received [%lu]",
192 #endif /* ERRCLASS & ERRCLS_INT_PAR */
193 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
196 if((cfg->maxRguSaps == 0) || (cfg->maxRguSaps > KW_MAX_RGUSAPS))
200 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
202 if(gCb->init.cfgDone == TRUE)
204 /* reconfiguration not supported */
205 RETVALUE(LCM_REASON_RECONFIG_FAIL);
210 /* Timer Queue Control point initialization */
211 kwTqCp = &(gCb->kwTqCp);
212 kwTqCp->tmrLen = KW_TMR_LEN;
215 if(gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
217 KW_ALLOC(gCb,gCb->u.dlCb, sizeof (KwDlCb));
218 if (gCb->u.dlCb == NULLP)
220 RLOG0(L_FATAL,"Memory Allocation failed");
221 RETVALUE(LCM_REASON_MEM_NOAVAIL);
224 /* allocate memory to the KWU sap's */
225 kwSapSize = (Size)((Size) gCb->genCfg.maxKwuSaps *
226 (Size)sizeof(KwKwuSapCb));
228 KW_ALLOC(gCb,gCb->u.dlCb->kwuDlSap, kwSapSize);
230 #if (ERRCLASS & ERRCLS_INT_PAR)
231 if(gCb->u.dlCb->kwuDlSap == NULLP)
233 KW_FREE(gCb,gCb->u.dlCb, sizeof (KwDlCb));
234 RLOG0(L_FATAL,"Memory Allocation failed");
235 RETVALUE(LCM_REASON_MEM_NOAVAIL);
237 #endif /* ERRCLASS & ERRCLS_INT_PAR */
239 gCb->u.dlCb->numKwuSaps = gCb->genCfg.maxKwuSaps;
241 kwUdxSapSize = (Size)((Size) gCb->genCfg.maxUdxSaps *
242 (Size)sizeof(KwUdxDlSapCb));
244 KW_ALLOC(gCb,gCb->u.dlCb->udxDlSap, kwUdxSapSize);
245 #if (ERRCLASS & ERRCLS_INT_PAR)
246 if(gCb->u.dlCb->udxDlSap == NULLP)
248 KW_FREE(gCb,gCb->u.dlCb->kwuDlSap, kwSapSize);
249 KW_FREE(gCb,gCb->u.dlCb, sizeof (KwDlCb));
250 RLOG0(L_FATAL,"Memory Allocation failed");
251 RETVALUE(LCM_REASON_MEM_NOAVAIL);
253 #endif /* ERRCLASS & ERRCLS_INT_PAR */
255 rguSapSize = (Size)((Size) gCb->genCfg.maxRguSaps *
256 (Size)sizeof(KwRguSapCb));
257 KW_ALLOC(gCb,gCb->u.dlCb->rguDlSap, rguSapSize);
258 #if (ERRCLASS & ERRCLS_INT_PAR)
259 if(gCb->u.dlCb->rguDlSap == NULLP)
261 KW_FREE(gCb,gCb->u.dlCb->udxDlSap, kwSapSize);
262 KW_FREE(gCb,gCb->u.dlCb->kwuDlSap, kwSapSize);
263 KW_FREE(gCb,gCb->u.dlCb, sizeof (KwDlCb));
265 KWLOGERROR(gCb,ERRCLS_INT_PAR, EKW043, (ErrVal) cfg->maxUe,
266 "kwLmmGenCfg: SgetSBuf Failed for rguSap...!");
267 RETVALUE(LCM_REASON_MEM_NOAVAIL);
269 #endif /* ERRCLASS & ERRCLS_INT_PAR */
272 /* Initialize the Ue and Cell hash list */
273 ret = kwDbmDlInit(gCb);
276 KW_FREE(gCb,gCb->u.dlCb->udxDlSap, kwSapSize);
277 KW_FREE(gCb,gCb->u.dlCb->kwuDlSap, kwSapSize);
278 KW_FREE(gCb,gCb->u.dlCb->rguDlSap, rguSapSize);
279 KW_FREE(gCb,gCb->u.dlCb, sizeof (KwDlCb));
280 RLOG0(L_FATAL,"RLC DL Initialization failed");
281 RETVALUE(LCM_REASON_MEM_NOAVAIL);
283 /* Register the timer */
284 /*Pradeep: changing the SRegTmrMt() to SRegTmr()*/
285 if(SRegTmrMt(gCb->init.ent, gCb->init.inst, (U16)cfg->timeRes,
288 KW_FREE(gCb,gCb->u.dlCb->udxDlSap, kwUdxSapSize);
289 KW_FREE(gCb,gCb->u.dlCb->kwuDlSap, kwSapSize);
290 KW_FREE(gCb,gCb->u.dlCb->rguDlSap, rguSapSize);
291 KW_FREE(gCb,gCb->u.dlCb, sizeof (KwDlCb));
293 RETVALUE(LCM_REASON_REGTMR_FAIL);
296 /* initializations for background processing of freeing memory */
297 kwUtlInitToBeFreed(gCb, &(gCb->u.dlCb->toBeFreed));
298 kwUtlInitializeSelfPst(gCb);
300 if(SGetMsg(gCb->init.region,
302 &(gCb->u.dlCb->selfPstMBuf)) != ROK)
304 KW_FREE(gCb,gCb->u.dlCb->udxDlSap, kwSapSize);
305 KW_FREE(gCb,gCb->u.dlCb->kwuDlSap, kwSapSize);
306 KW_FREE(gCb,gCb->u.dlCb->rguDlSap, rguSapSize);
307 KW_FREE(gCb,gCb->u.dlCb, sizeof (KwDlCb));
309 RETVALUE(LCM_REASON_MEM_NOAVAIL);
313 kwUtlL2MeasDlInit(gCb);
316 else if(gCb->genCfg.rlcMode == LKW_RLC_MODE_UL)
318 KW_ALLOC(gCb,gCb->u.ulCb, sizeof (KwUlCb));
319 if (gCb->u.ulCb == NULLP)
321 RLOG0(L_FATAL,"Memory Allocation failed");
322 RETVALUE(LCM_REASON_MEM_NOAVAIL);
325 /* allocate memory to the KWU sap's */
326 kwSapSize = (Size)((Size) gCb->genCfg.maxKwuSaps *
327 (Size)sizeof(KwKwuSapCb));
329 KW_ALLOC(gCb,gCb->u.ulCb->kwuUlSap, kwSapSize);
331 #if (ERRCLASS & ERRCLS_INT_PAR)
332 if(gCb->u.ulCb->kwuUlSap == NULLP)
334 KW_FREE(gCb,gCb->u.ulCb, sizeof (KwUlCb));
335 RLOG0(L_FATAL,"Memory Allocation failed");
336 RETVALUE(LCM_REASON_MEM_NOAVAIL);
338 #endif /* ERRCLASS & ERRCLS_INT_PAR */
340 gCb->u.ulCb->numKwuSaps = gCb->genCfg.maxKwuSaps;
342 /* allocate memory to the KWU sap's */
343 kwUdxSapSize = (Size)((Size) gCb->genCfg.maxUdxSaps *
344 (Size)sizeof(KwUdxUlSapCb));
346 KW_ALLOC(gCb,gCb->u.ulCb->udxUlSap, kwUdxSapSize);
348 #if (ERRCLASS & ERRCLS_INT_PAR)
349 if(gCb->u.ulCb->kwuUlSap == NULLP)
351 KW_FREE(gCb,gCb->u.ulCb->kwuUlSap, kwSapSize);
352 KW_FREE(gCb,gCb->u.ulCb, sizeof (KwUlCb));
353 RLOG0(L_FATAL,"Memory Allocation failed");
354 RETVALUE(LCM_REASON_MEM_NOAVAIL);
356 #endif /* ERRCLASS & ERRCLS_INT_PAR */
358 rguSapSize = (Size)((Size) gCb->genCfg.maxRguSaps *
359 (Size)sizeof(KwRguSapCb));
360 KW_ALLOC(gCb,gCb->u.ulCb->rguUlSap, rguSapSize);
361 #if (ERRCLASS & ERRCLS_INT_PAR)
362 if(gCb->u.ulCb->rguUlSap == NULLP)
364 KW_FREE(gCb,gCb->u.ulCb->kwuUlSap, kwSapSize);
365 KW_FREE(gCb,gCb->u.ulCb->rguUlSap, kwSapSize);
366 KW_FREE(gCb,gCb->u.ulCb, sizeof (KwUlCb));
368 KWLOGERROR(gCb,ERRCLS_INT_PAR, EKW043, (ErrVal) cfg->maxUe,
369 "kwLmmGenCfg: SgetSBuf Failed for rguSap...!");
370 RETVALUE(LCM_REASON_MEM_NOAVAIL);
372 #endif /* ERRCLASS & ERRCLS_INT_PAR */
374 /* Initialize the Ue and Cell hash list */
375 ret = kwDbmUlInit(gCb);
378 KW_FREE(gCb,gCb->u.ulCb->udxUlSap, kwUdxSapSize);
379 KW_FREE(gCb,gCb->u.ulCb->kwuUlSap, kwSapSize);
380 KW_FREE(gCb,gCb->u.ulCb->rguUlSap, kwSapSize);
381 KW_FREE(gCb,gCb->u.ulCb, sizeof (KwUlCb));
382 RLOG0(L_FATAL,"RLC DL Initialization failed");
385 /* Register the timer */
387 if(SRegTmrMt(gCb->init.ent, gCb->init.inst, (U16)cfg->timeRes,
390 KW_FREE(gCb,gCb->u.ulCb->udxUlSap, kwUdxSapSize);
391 KW_FREE(gCb,gCb->u.ulCb->kwuUlSap, kwSapSize);
392 KW_FREE(gCb,gCb->u.ulCb->rguUlSap, kwSapSize);
393 KW_FREE(gCb,gCb->u.ulCb, sizeof (KwUlCb));
395 RETVALUE(LCM_REASON_REGTMR_FAIL);
398 kwUtlL2MeasUlInit(gCb);
403 #if (ERRCLASS & ERRCLS_INT_PAR)
404 RLOG0(L_ERROR, "Received Invalid RLC Mode");
405 #endif /* ERRCLASS & ERRCLS_INT_PAR */
407 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
409 /* Timer Initialization */
410 gCb->kwTqCp.tmrLen = KW_TMR_LEN;
412 cmMemset((U8*)gCb->kwTq, NULLP, sizeof(CmTqType) * KW_TMR_LEN);
414 KW_MEM_CPY(&(gCb->init.lmPst), &cfg->lmPst, sizeof(Pst));
416 gCb->init.lmPst.srcProcId = gCb->init.procId;
417 gCb->init.lmPst.srcEnt = gCb->init.ent;
418 gCb->init.lmPst.srcInst = gCb->init.inst;
419 gCb->init.lmPst.event = EVTNONE;
421 /* kw002.201 For multi core and multi region,no need to reinitiailize the
422 * region again . This would be done with kwActvInit from SSI */
423 #if !defined(SS_MULTICORE_SUPPORT) && !defined(SS_M_PROTO_REGION)
424 gCb->init.region = cfg->lmPst.region;
425 #endif /* !defined(SS_MULTICORE_SUPPORT) && !defined(SS_M_PROTO_REGION) */
426 gCb->init.pool = cfg->lmPst.pool;
428 gCb->init.cfgDone = TRUE;
430 RETVALUE(LCM_REASON_NOT_APPL);
435 * Sends confirmation message to LM Called by KwMiLkwCfgReq function
437 * @param[in] gCb RLC Instance Control Block
438 * @param[in] pst Post structure
439 * @param[in] cfm RLC LM structure
440 * @param[in] type Type of LM message
441 * @param[in] hdr Message header
447 PRIVATE Void kwLmmSendCfm
456 PRIVATE Void kwLmmSendCfm(gCb,pst, cfm, type, hdr)
464 Pst rPst; /* Reply post structure */
468 KW_MEM_SET(&rPst, 0, sizeof(Pst));
470 /* reply post structure for confirmation */
473 rPst.srcEnt = gCb->init.ent;
474 rPst.srcInst = gCb->init.inst;
475 cfm->hdr.entId.ent = gCb->init.ent;
476 cfm->hdr.entId.inst = gCb->init.inst;
480 rPst.srcEnt = pst->dstEnt;
481 rPst.srcInst = pst->dstInst;
482 cfm->hdr.entId.ent = pst->dstEnt;
483 cfm->hdr.entId.inst = pst->dstInst;
485 rPst.srcProcId = SFndProcId();
486 rPst.dstEnt = pst->srcEnt;
487 rPst.dstInst = pst->srcInst;
488 rPst.dstProcId = pst->srcProcId;
489 rPst.selector = hdr->response.selector;
490 rPst.prior = hdr->response.prior;
491 rPst.route = hdr->response.route;
492 rPst.region = hdr->response.mem.region;
493 rPst.pool= hdr->response.mem.pool;
495 /* Fill the reply header */
496 cfm->hdr.elmId.elmnt = hdr->elmId.elmnt;
497 cfm->hdr.transId = hdr->transId;
502 KwMiLkwCfgCfm(&rPst,cfm);
505 SGetDateTime(&(cfm->t.cntrl.dt));
506 KwMiLkwCntrlCfm(&rPst,cfm);
509 SGetDateTime(&(cfm->t.sts.dt));
510 KwMiLkwStsCfm(&rPst,0,cfm);
513 SGetDateTime(&(cfm->t.ssta.dt));
514 KwMiLkwStaCfm(&rPst,cfm);
517 #if (ERRCLASS & ERRCLS_INT_PAR)
518 RLOG0(L_ERROR, "Received Invalid Message Type");
523 #endif /* ERRCLASS & ERRCLS_INT_PAR */
533 * This function processes configuration requests received from the layer
537 * The configuration requests can be for general configuration, or
538 * configuration of RGU, KWU, and CKW SAPs. The type of the configuration
539 * request can be determined from the elmId field in the header of the layer
540 * manager message.This function is called by the layer manager to configure
543 * This function implements the following logic:
545 * - if genCfg is not done, send negative Cfm to the layer manager;
547 * - switch (cfg->hdr.elmId.elmnt)
549 * - update the genCfg field in RlCb;
550 * - allocate the maximum static memory required by the RLC product;
551 * - register the timer service by calling SReqTmr;
552 * - set CfgDone for not configuring again;
554 * - if all the parameters are valid, then allocate the KwuSap control
556 * - update the SAP control block with the information provided in the
557 * - configuration request;
558 * - send configuration confirm with the status, success;
560 * - if all the parametes are valid, then allocate the CkwSap control
562 * - update the SAP control block with the information provided in the
563 * configuration request;
564 * - send configuration confirm with the status, success;
566 * - if all the parametes are valid, then allocate the rguSap control
568 * - update the SAP control block with the information provided in the
569 * configuration request;
570 * - send configuration confirm with the status, success;
572 * - if all the parametes are valid, then allocate the udxSap control
574 * - update the SAP control block with the information provided in the
575 * configuration request;
576 * - send configuration confirm with the status, success;
579 * @param[in] pst post structure
580 * @param[in] cfg LM management structure
584 * -# Failure : RFAILED
588 PUBLIC S16 KwMiLkwCfgReq
594 PUBLIC S16 KwMiLkwCfgReq (pst, cfg)
599 Reason reason; /* failure reason */
604 #if (ERRCLASS & ERRCLS_INT_PAR)
605 /* Check if the instance is configured */
606 if (pst->dstInst >= KW_MAX_RLC_INSTANCES)
608 cfg->cfm.status = LCM_PRIM_NOK;
609 cfg->cfm.reason = LCM_REASON_INVALID_INSTANCE;
610 kwLmmSendCfm(tKwCb,pst, cfg, TCFG, &cfg->hdr);
615 tKwCb = KW_GET_KWCB(pst->dstInst);
619 cfg->cfm.status = LCM_PRIM_NOK;
620 cfg->cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
621 kwLmmSendCfm(tKwCb,pst, cfg, TCFG, &cfg->hdr);
624 /* check configuration is done or not */
625 if ((tKwCb->init.cfgDone != TRUE) &&
626 (cfg->hdr.elmId.elmnt != STGEN))
629 * if general config is not over then use pst structure
630 * in primitive to communicate to stack manager
633 cfg->cfm.status = LCM_PRIM_NOK;
634 cfg->cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
635 kwLmmSendCfm(tKwCb,pst, cfg, TCFG, &cfg->hdr);
639 RLOG1(L_DEBUG, "KwMiLkwCfgReq elmId(%d)", cfg->hdr.elmId.elmnt);
641 switch(cfg->hdr.elmId.elmnt)
645 reason = kwLmmGenCfg(tKwCb,&cfg->t.cfg.s.gen);
650 reason = kwLmmCfgKwuSap(tKwCb,&cfg->t.cfg.s.sap);
655 reason = kwLmmCfgCkwSap(tKwCb,&cfg->t.cfg.s.sap);
660 reason = kwLmmCfgRguSap(tKwCb,&cfg->t.cfg.s.sap);
665 reason = kwLmmCfgUdxSap(tKwCb,&cfg->t.cfg.s.sap);
670 reason = LCM_REASON_INVALID_ELMNT;
675 if (reason == LCM_REASON_NOT_APPL)
677 cfg->cfm.status = LCM_PRIM_OK;
678 cfg->cfm.reason = LCM_REASON_NOT_APPL;
679 kwLmmSendCfm(tKwCb,pst, cfg, TCFG, &cfg->hdr);
684 cfg->cfm.status = LCM_PRIM_NOK;
685 cfg->cfm.reason = reason;
686 kwLmmSendCfm(tKwCb,pst, cfg, TCFG, &cfg->hdr);
693 * The layer manager initiates and uses the management-control procedure to
694 * control RLC elements.The RLC control request primitive (KwMiLkwCntrlReq)
695 * can be called more than once and at any time after the
696 * management-configuration procedure.The control request primitive
697 * is confirmed by a KwMiLkwCntrlCfm primitive.
700 * This function implements the following logic:
702 * - if(cfgDone = FALSE)
703 * - send negative confirmation to the layer manager;
706 * - switch(cntrl->hdr.elmId.elmnt)
710 * - switch(subAction)
712 * - enable the unsolicited status flag;
713 * - send the control Cfm with success;
715 * - set the debug mask;
716 * - send the control Cfm with success;
718 * - enable the trace flag;
719 * - send the control Cfm with success;
721 * - switch(subAction)
723 * - disable the unsolicited status flag;
724 * - send the control Cfm with success;
726 * - disable the trace flag;
727 * - send the control Cfm with success;
736 * @param[in] pst post structure
737 * @param[in] cntrl LM management structure
744 PUBLIC S16 KwMiLkwCntrlReq
750 PUBLIC S16 KwMiLkwCntrlReq(pst, cntrl)
755 Reason reason; /* failure reason */
758 TRC3(KwMiLkwCntrlReq)
760 #if (ERRCLASS & ERRCLS_INT_PAR)
761 /* Check if the instance is configured */
762 if (pst->dstInst >= KW_MAX_RLC_INSTANCES)
764 cntrl->cfm.status = LCM_PRIM_NOK;
765 cntrl->cfm.reason = LCM_REASON_INVALID_INSTANCE;
767 kwLmmSendCfm(tKwCb,pst, cntrl, TCNTRL, &cntrl->hdr);
772 tKwCb = KW_GET_KWCB(pst->dstInst);
776 cntrl->cfm.status = LCM_PRIM_NOK;
777 cntrl->cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
778 kwLmmSendCfm(tKwCb,pst, cntrl, TCNTRL, &cntrl->hdr);
782 if (!(tKwCb->init.cfgDone))
784 cntrl->cfm.status = LCM_PRIM_NOK;
785 cntrl->cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
786 kwLmmSendCfm(tKwCb,pst, cntrl, TCNTRL, &cntrl->hdr);
789 RLOG1(L_DEBUG, "KwMiLkwCntrlReq(elmId(%d))", cntrl->hdr.elmId.elmnt);
791 /* In normal cases, LCM_REASON_NOT_APPL is returned in cfm.
792 * In all error cases appropriate reason is returned
793 * by the functions below
796 switch (cntrl->hdr.elmId.elmnt)
800 /* general control */
801 reason = kwLmmGenCntrl(tKwCb,cntrl);
806 /* Lower SAP control */
807 reason = kwLmmLSapCntrl(tKwCb,cntrl);
813 reason = kwLmmUdxSapCntrl(tKwCb,cntrl);
818 reason = LCM_REASON_INVALID_ELMNT;
823 if (reason == LCM_REASON_NOT_APPL)
825 cntrl->cfm.status = LCM_PRIM_OK;
826 cntrl->cfm.reason = LCM_REASON_NOT_APPL;
830 cntrl->cfm.status = LCM_PRIM_NOK;
831 cntrl->cfm.reason = reason;
834 kwLmmSendCfm(tKwCb,pst, cntrl, TCNTRL, &cntrl->hdr);
841 * This function processes solicited status requests received from the layer
842 * manager. The layer manager can request status information regarding the
843 * system ID, RGUSAP,KWUSAP, or CKWSAP.
845 * @param[in] pst post structure
846 * @param[in] sta LM management structure
852 PUBLIC S16 KwMiLkwStaReq
858 PUBLIC S16 KwMiLkwStaReq(pst, sta)
863 KwMngmt rSta; /* Status */
864 Reason reason; /* Failure reason */
869 #if (ERRCLASS & ERRCLS_INT_PAR)
870 /* Check if the instance is configured */
871 if (pst->dstInst >= KW_MAX_RLC_INSTANCES)
873 sta->cfm.status = LCM_PRIM_NOK;
874 sta->cfm.reason = LCM_REASON_INVALID_INSTANCE;
876 kwLmmSendCfm(tKwCb,pst, sta, TSSTA, &sta->hdr);
881 tKwCb = KW_GET_KWCB(pst->dstInst);
884 sta->cfm.status = LCM_PRIM_NOK;
885 sta->cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
887 kwLmmSendCfm(tKwCb,pst, sta, TSSTA, &sta->hdr);
891 RLOG1(L_DEBUG, "Status request for elmId(%d))", sta->hdr.elmId.elmnt);
893 reason = LCM_REASON_NOT_APPL;
895 KW_MEM_SET(&rSta, 0, sizeof(KwMngmt));
896 switch (sta->hdr.elmId.elmnt)
900 reason = LCM_REASON_NOT_APPL;
901 kwGetSId(&rSta.t.ssta.s.sysId);
906 KW_MEM_CPY (&rSta.t.ssta.s.kwuSap,
907 &sta->t.ssta.s.kwuSap,
908 sizeof (KwKwuSapSta));
910 reason = kwLmmGetKwuSapSta (tKwCb,&rSta.t.ssta.s.kwuSap);
915 KW_MEM_CPY (&rSta.t.ssta.s.rguSap,
916 &sta->t.ssta.s.rguSap,
917 sizeof (KwRguSapSta));
919 reason = kwLmmGetRguSapSta (tKwCb,&rSta.t.ssta.s.rguSap);
924 KW_MEM_CPY (&rSta.t.ssta.s.ckwSap,
925 &sta->t.ssta.s.ckwSap,
926 sizeof (KwCkwCntSapSta));
928 reason = kwLmmGetCkwCntSapSta (tKwCb,&rSta.t.ssta.s.ckwSap);
933 reason = LCM_REASON_INVALID_ELMNT;
936 } /* end of switch */
938 if (reason == LCM_REASON_NOT_APPL)
940 rSta.cfm.status = LCM_PRIM_OK;
941 rSta.cfm.reason = LCM_REASON_NOT_APPL;
945 rSta.cfm.status = LCM_PRIM_NOK;
946 rSta.cfm.reason = reason;
948 kwLmmSendCfm(tKwCb,pst, &rSta, TSSTA, &sta->hdr);
955 * This function processes statistics requests received from the layer
959 * After collecting the statistics, ir calls the statistics confirm function
960 * to send the statistics to the layer manager.
962 * - switch(sts->hdr.elmId.elmnt)
964 * - get the general statistics from the KW control block;
965 * - if (action = RESET)
966 * - reset the general statistic field in the RlCb;
967 * - call KwMiLkwStsCfm to send statistics back to layer manager;
971 * - get the SAP specific statistics from KW control block;
972 * - if (action = RESET)
973 * - reset the general statistic field in the RlCb;
974 * - call KwMiLkwStsCfm to send statistics to the layer manager;
977 * @param[in] pst post structure
978 * @param[in] action action
979 * @param[in] sts LM management structure
986 PUBLIC S16 KwMiLkwStsReq
993 PUBLIC S16 KwMiLkwStsReq (pst, action, sts)
999 KwMngmt rSts; /* Statistics */
1000 Reason reason; /* Reason for failure */
1003 TRC3(KwMiLkwStsReq);
1005 #if (ERRCLASS & ERRCLS_INT_PAR)
1006 /* Check if the instance is configured */
1007 if (pst->dstInst >= KW_MAX_RLC_INSTANCES)
1009 rSts.cfm.status = LCM_PRIM_NOK;
1010 rSts.cfm.reason = LCM_REASON_INVALID_INSTANCE;
1012 kwLmmSendCfm(tKwCb,pst, &rSts, TCNTRL, &sts->hdr);
1017 tKwCb = KW_GET_KWCB(pst->dstInst);
1020 rSts.cfm.status = LCM_PRIM_NOK;
1021 rSts.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
1023 kwLmmSendCfm(tKwCb,pst, &rSts, TCNTRL, &sts->hdr);
1027 RLOG2(L_DEBUG, "KwMiLkwStsReq(elmId(%d),action(%d))",
1029 sts->hdr.elmId.elmnt);
1031 KW_MEM_SET(&rSts, 0, sizeof(KwMngmt));
1033 switch (sts->hdr.elmId.elmnt)
1037 reason = kwLmmGetGenSts(tKwCb,&rSts.t.sts.s.gen, action);
1043 if( sts->hdr.elmId.elmnt == STKWUSAP)
1045 /* kw005.201, modified the element of kwuSap from suId to spId */
1046 rSts.t.sts.s.kwuSap.spId = sts->t.sts.s.kwuSap.spId;
1048 reason = kwLmmGetSapSts(tKwCb,&rSts, sts->hdr.elmId.elmnt, action);
1053 reason = LCM_REASON_INVALID_ELMNT;
1058 if (reason == LCM_REASON_NOT_APPL)
1060 rSts.cfm.status = LCM_PRIM_OK;
1061 rSts.cfm.reason = LCM_REASON_NOT_APPL;
1065 rSts.cfm.status = LCM_PRIM_NOK;
1066 rSts.cfm.reason = reason;
1068 kwLmmSendCfm(tKwCb,pst, &rSts, TSTS, &sts->hdr);
1073 /* kw005.201 added support for L2 Measurement */
1077 This function processes L2 Measurement requests received from the layer manager.
1078 The L2 Measurement is start for a time period and after the timer expiry, the
1079 measurement confirm is sent.
1081 - Accept only one set of measurements.
1082 - Allocate and initialise KwL2MeasEvtCb.
1083 - Validate if the measurement is already in progress.
1084 - Loop through the existing measEvtCb with matching measType
1085 - Check if measurement is running for any qci present in the measReq
1086 - If present, move the qCi to list of invalid qCIs.
1087 - Set KwL2MeasEvtCb.measOn to TRUE for QCIs to be measured.
1088 - For the number of measurements requested.
1089 - For all Ues with RBs matching qCI.
1090 - Add RbCb to the RB linked list.
1091 - Set kwRbCb.measOn to measurement type.
1092 - If Meas type is DL_DELAY
1093 - Update COUNT to startCount.
1096 * @param[in] pst post structure
1097 * @param[in] action action
1098 * @param[in] cfg LM management structure
1101 * -# Failure : RFAILED
1104 PUBLIC S16 KwMiLkwL2MeasReq
1107 KwL2MeasReqEvt *measReqEvt
1110 PUBLIC S16 KwMiLkwL2MeasReq (pst, measReqEvt)
1112 KwL2MeasReqEvt *measReqEvt;
1118 KwL2MeasCfmEvt measCfmEvt;
1122 TRC3(KwMiLkwL2MeasReq);
1124 tKwCb = KW_GET_KWCB(pst->dstInst);
1126 /* Initialize measCfmEvt */
1127 KW_MEM_ZERO(&measCfmEvt, sizeof(KwL2MeasCfmEvt));
1128 /* validate the received measReqEvt */
1129 /*LTE_L2_MEAS_PHASE2*/
1130 if(measReqEvt->measPeriod != 0)
1132 /* L2 MEAS AGHOSH */
1133 if((measReqEvt->measReq.measType & LKW_L2MEAS_DL_IP)||
1134 (measReqEvt->measReq.measType & LKW_L2MEAS_UL_IP))
1136 ret = kwUtlValidateIpThL2Meas(measReqEvt, &measCfmEvt);
1141 #if (ERRCLASS & ERRCLS_ADD_RES)
1142 #endif /* ERRCLASS & ERRCLS_ADD_RES */
1143 kwUtlSndUlL2MeasNCfm(tKwCb, measReqEvt, &measCfmEvt);
1144 KW_FREE(tKwCb, measReqEvt, sizeof(KwL2MeasReqEvt))
1149 measType = measReqEvt->measReq.measType;
1151 if((measType != LKW_L2MEAS_DL_IP) &&
1152 (measType != LKW_L2MEAS_ACT_UE) &&
1153 (measType != LKW_L2MEAS_DL_DISC) &&
1154 (measType != LKW_L2MEAS_DL_DELAY) &&
1155 (measType != LKW_L2MEAS_UU_LOSS) &&
1156 (measType != LKW_L2MEAS_UL_IP))/* || (qci > LKW_MAX_QCI)*/
1158 measCfmEvt.transId = measReqEvt->transId;
1159 measCfmEvt.measType = measType;
1160 measCfmEvt.status.status = LCM_PRIM_NOK;
1161 measCfmEvt.status.reason = LKW_CAUSE_INVALID_MEASTYPE;
1162 kwUtlSndDlL2MeasNCfm(tKwCb, measReqEvt, &measCfmEvt);
1163 KW_FREE(tKwCb, measReqEvt, sizeof(KwL2MeasReqEvt))
1167 /* for UL IP throughput meas enable for all QCIs */
1168 if(measType & LKW_L2MEAS_UL_IP)
1170 for(cntr = 0; cntr < LKW_MAX_QCI; cntr++)
1172 tKwCb->u.ulCb->kwL2Cb.measOn[cntr] |= LKW_L2MEAS_UL_IP;
1177 (LKW_L2MEAS_DL_IP | LKW_L2MEAS_DL_DISC |
1178 LKW_L2MEAS_DL_DELAY | LKW_L2MEAS_UU_LOSS))
1180 KwL2MeasReqEvt *measEvt;
1183 udxPst = &(KW_GET_UDX_SAP(tKwCb)->pst);
1185 KW_ALLOC_SHRABL_BUF(udxPst->region,
1188 sizeof(KwL2MeasReqEvt));
1190 #if (ERRCLASS & ERRCLS_ADD_RES) /* KW_FIX */
1191 if(measEvt == NULLP)
1193 RLOG0(L_FATAL,"Memory Allocation failed");
1197 cmMemcpy((Void*)measEvt, (Void*)measReqEvt, sizeof(KwL2MeasReqEvt));
1198 /*Redirect the request to DL task */
1199 /* NOTE:As of today, there are no cases where the Req will fail at DL
1200 as long as it reached the DL, so we don't wait for a confirmation from
1201 DL to send the confirmation to LM*/
1202 /* The interface for sending a confirmation back does not exist today;
1203 it needs to be created when the need arises */
1204 KwUlUdxL2MeasReq(&(KW_GET_UDX_SAP(tKwCb)->pst),measEvt);
1207 /* We need to copy the transId for sending back confirms later */
1208 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
1210 KwL2MeasEvtCb* measEvtCb = &(tKwCb->u.ulCb->kwL2Cb.kwL2EvtCb[cntr]);
1211 if(measEvtCb->measCb.measType & measType)
1213 measEvtCb->transId= measReqEvt->transId;
1216 /*KW_FREE(tKwCb, measReqEvt, sizeof(KwL2MeasReqEvt));*/
1219 } /* KwMiLkwL2MeasReq */
1223 This function processes L2 Measurement stop request received from the layer manager.
1224 After receving this request, RLC stops L2 Measurement
1225 * @param[in] pst post structure
1226 * @param[in] measType meas Type
1229 * -# Failure : RFAILED
1233 PUBLIC S16 KwMiLkwL2MeasStopReq
1239 PUBLIC S16 KwMiLkwL2MeasStopReq (pst, measType)
1245 KwL2MeasEvtCb *measEvtCb = NULLP;
1251 TRC3(KwMiLkwL2MeasStopReq);
1253 tKwCb = KW_GET_KWCB(pst->dstInst);
1255 /* reset the counter values for the measurement that is stopped */
1256 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
1258 measEvtCb = &(tKwCb->u.ulCb->kwL2Cb.kwL2EvtCb[cntr]);
1259 if(measEvtCb->measCb.measType & measType)
1261 kwUtlResetUlL2MeasInKwRb(tKwCb, &measEvtCb->measCb, measType);
1266 /* for UL IP throughput meas disable for all QCIs */
1267 if(measType & LKW_L2MEAS_UL_IP)
1269 for(cntr = 0; cntr < LKW_MAX_QCI; cntr++)
1271 tKwCb->u.ulCb->kwL2Cb.measOn[cntr] &= ~LKW_L2MEAS_UL_IP;
1275 if((measType & LKW_L2MEAS_DL_IP) || (measType & LKW_L2MEAS_DL_DISC)
1276 || (measType & LKW_L2MEAS_DL_DELAY))
1278 /*Redirect the request to DL task */
1279 KwUlUdxL2MeasStopReq(&(KW_GET_UDX_SAP(tKwCb)->pst),measType);
1282 /*cmMemset((U8*)&measCfmEvt, 0, sizeof(KwL2MeasCfmEvt)); */
1284 status = LCM_PRIM_OK;
1285 KwMiLkwL2MeasStopCfm(&tKwCb->genCfg.lmPst, measType,status);
1291 This function processes L2 Measurement Send request received from the layer manager.
1292 After receving this request, RLC sends L2 Measurement
1293 * @param[in] pst post structure
1294 * @param[in] measType meas Type
1297 * -# Failure : RFAILED
1301 PUBLIC S16 KwMiLkwL2MeasSendReq
1307 PUBLIC S16 KwMiLkwL2MeasSendReq (pst, measType)
1313 KwL2MeasEvtCb *measEvtCb = NULLP;
1316 TRC3(KwMiLkwL2MeasSendReq);
1318 tKwCb = KW_GET_KWCB(pst->dstInst);
1320 /* In case of addition of any new measType here ,appropriate handling
1321 * has to be done in RLC DL (kwUtlSndDlL2MeasCfm)*/
1323 (LKW_L2MEAS_DL_DISC | LKW_L2MEAS_DL_DELAY
1324 | LKW_L2MEAS_UU_LOSS| LKW_L2MEAS_DL_IP))
1326 /*Redirect the request to DL task */
1327 KwUlUdxL2MeasSendReq(&(KW_GET_UDX_SAP(tKwCb)->pst),measType);
1328 /* L2 MEAS AGHOSH */
1332 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
1334 measEvtCb = &(tKwCb->u.ulCb->kwL2Cb.kwL2EvtCb[cntr]);
1335 /* L2 MEAS AGHOSH */
1336 if(measEvtCb->measCb.measType & measType)
1338 kwUtlHdlL2TmrExp(tKwCb, measEvtCb);
1344 #endif /* LTE_L2_MEAS */
1348 * This function configures the RLC data sap
1350 * @param[in] gCb RLC Instance Control Block
1351 * @param[in] cfg RLC LM Sap configuration structure
1354 * -# LCM_REASON_NOT_APPL (SUCCESS)
1355 * -# LCM_REASON_INVALID_SAP
1356 * -# LCM_REASON_MEM_NOAVAIL
1357 * -# LCM_REASON_RECONFIG_FAIL
1360 PRIVATE S16 kwLmmCfgKwuSap
1366 PRIVATE S16 kwLmmCfgKwuSap(gCb,cfg)
1371 KwKwuSapCb *kwuSapCb;
1372 TRC2(kwLmmCfgKwuSap)
1374 #if (ERRCLASS & ERRCLS_INT_PAR)
1375 /* Validate the protocol parameters */
1376 if((cfg->sapId >= (S16)gCb->genCfg.maxKwuSaps) || (cfg->sapId < 0))
1378 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
1380 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1382 kwuSapCb = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL) ?
1383 (KwKwuSapCb*)(gCb->u.dlCb->kwuDlSap + cfg->sapId):
1384 (KwKwuSapCb*)(gCb->u.ulCb->kwuUlSap + cfg->sapId);
1386 #if (ERRCLASS & ERRCLS_INT_PAR)
1387 /* Check for reconfiguration */
1388 if (kwuSapCb->state != KW_SAP_NOT_CFG)
1390 RLOG2(L_ERROR,"RLC Mode [%d] : Invalid kwuSap State [%d]",
1391 gCb->genCfg.rlcMode, kwuSapCb->state);
1392 /* reconfiguration not allowed */
1393 RETVALUE(LCM_REASON_RECONFIG_FAIL);
1395 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1397 /* Fill the parameters */
1398 KW_FILL_SAP_HELPER(kwuSapCb, cfg, gCb);
1400 RETVALUE(LCM_REASON_NOT_APPL);
1405 * This function configures the RLC control sap
1407 * @param[in] gCb RLC Instance Control Block
1408 * @param[in] cfg RLC LM Sap configuration structure
1411 * -# LCM_REASON_NOT_APPL (SUCCESS)
1412 * -# LCM_REASON_INVALID_SAP
1413 * -# LCM_REASON_INVALID_SAP
1414 * -# LCM_REASON_RECONFIG_FAIL
1417 PRIVATE S16 kwLmmCfgCkwSap
1423 PRIVATE S16 kwLmmCfgCkwSap(gCb,cfg)
1430 TRC2(kwLmmCfgCkwSap)
1432 #if (ERRCLASS & ERRCLS_INT_PAR)
1433 /* Validate config parameters */
1434 if ((cfg->sapId >= KW_MAX_CKWSAPS) || (cfg->sapId < 0) )
1436 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
1439 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1441 /* Get Sap control block */
1442 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
1446 ckwSap = &(gCb->u.ulCb->ckwSap);
1448 #if (ERRCLASS & ERRCLS_INT_PAR)
1449 /* Check for reconfiguration */
1450 if(ckwSap->state != KW_SAP_NOT_CFG)
1452 RLOG1(L_ERROR,"Invalid kwuSap State [%d]",ckwSap->state);
1453 RETVALUE(LCM_REASON_RECONFIG_FAIL);
1455 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1457 /* Fill the parameters */
1458 KW_FILL_SAP_HELPER(ckwSap, cfg, gCb);
1460 RETVALUE(LCM_REASON_NOT_APPL);
1465 * This function configures the UDX sap
1467 * @param[in] gCb RLC Instance Control Block
1468 * @param[in] cfg RLC LM Sap configuration structure
1471 * -# LCM_REASON_NOT_APPL (SUCCESS)
1472 * -# LCM_REASON_INVALID_SAP
1473 * -# LCM_REASON_INVALID_SAP
1474 * -# LCM_REASON_RECONFIG_FAIL
1477 PRIVATE S16 kwLmmCfgUdxSap
1483 PRIVATE S16 kwLmmCfgUdxSap(gCb,cfg)
1488 KwUdxDlSapCb *udxDlSap;
1489 KwUdxUlSapCb *udxUlSap;
1491 TRC2(kwLmmCfgUdxSap);
1493 #if (ERRCLASS & ERRCLS_INT_PAR)
1494 /* Validate the protocol parameters */
1495 if((cfg->sapId >= KW_MAX_UDXSAPS) || (cfg->sapId < 0))
1497 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
1500 /* Get Sap control block */
1501 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1503 udxDlSap = (gCb->u.dlCb->udxDlSap + cfg->sapId);
1504 #if (ERRCLASS & ERRCLS_INT_PAR)
1505 /* Check for reconfiguration */
1506 if(udxDlSap->state != KW_SAP_NOT_CFG)
1508 RLOG1(L_ERROR,"Invalid udxDlSap State [%d]",udxDlSap->state);
1509 RETVALUE(LCM_REASON_RECONFIG_FAIL);
1511 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1513 /* Fill the parameters */
1514 KW_FILL_SAP_HELPER(udxDlSap, cfg, gCb);
1518 udxUlSap = (gCb->u.ulCb->udxUlSap + cfg->sapId);
1520 #if (ERRCLASS & ERRCLS_INT_PAR)
1521 /* Check for reconfiguration */
1522 if(udxUlSap->state != KW_SAP_NOT_CFG)
1524 RLOG1(L_ERROR,"Invalid udxUlSap State [%d]", udxUlSap->state);
1525 RETVALUE(LCM_REASON_RECONFIG_FAIL);
1527 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1529 /* Fill the parameters */
1530 KW_FILL_SAP_HELPER(udxUlSap, cfg, gCb);
1532 udxUlSap->bndTmrInt = cfg->bndTmrIntvl;
1533 udxUlSap->retryCnt = 0;
1534 cmInitTimers(&(udxUlSap->bndTmr), 1);
1537 RETVALUE(LCM_REASON_NOT_APPL);
1542 * This function configures the RGU sap
1544 * @param[in] gCb RLC Instance Control Block
1545 * @param[in] cfg RLC LM Sap configuration structure
1547 * -# LCM_REASON_NOT_APPL (SUCCESS)
1548 * -# LCM_REASON_INVALID_SAP
1549 * -# LCM_REASON_INVALID_SAP
1550 * -# LCM_REASON_RECONFIG_FAIL
1553 PRIVATE S16 kwLmmCfgRguSap
1559 PRIVATE S16 kwLmmCfgRguSap(gCb,cfg)
1566 TRC2(kwLmmCfgRguSap);
1568 #if (ERRCLASS & ERRCLS_INT_PAR)
1569 /* Validate the protocol parameters */
1570 if((cfg->sapId >= gCb->genCfg.maxRguSaps) || \
1573 KWLOGERROR(gCb,ERRCLS_INT_PAR, EKW047, (ErrVal)cfg->sapId,
1574 "kwLmmCfgRguSap: Invalid RGU sapId\n");
1575 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
1579 rguSap = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL) ?
1580 &(gCb->u.dlCb->rguDlSap[cfg->sapId]): &(gCb->u.ulCb->rguUlSap[cfg->sapId]);
1582 #if (ERRCLASS & ERRCLS_INT_PAR)
1583 /* Check for reconfiguration */
1584 if(rguSap->state != KW_SAP_NOT_CFG)
1586 RLOG2(L_ERROR,"RLC Mode [%d]: Invalid rguSap State [%d]",
1587 gCb->genCfg.rlcMode, rguSap->state);
1588 RETVALUE(LCM_REASON_RECONFIG_FAIL);
1590 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1592 /* Fill the parameters */
1593 KW_FILL_SAP_HELPER(rguSap, cfg, gCb);
1594 rguSap->suId = cfg->sapId;
1595 rguSap->bndTmrInt = cfg->bndTmrIntvl;
1596 rguSap->retryCnt = 0;
1597 rguSap->state = KW_SAP_CFG;
1599 cmInitTimers(&(rguSap->bndTmr), 1);
1601 RETVALUE(LCM_REASON_NOT_APPL);
1606 * Validates the RLC general control parameters
1608 * @param[in] cntrl RLC LM structure
1611 * -# LCM_REASON_NOT_APPL (SUCCESS)
1612 * -# LCM_REASON_INVALID_SUBACTION
1613 * -# LCM_REASON_INVALID_ACTION
1616 PRIVATE S16 kwLmmValidateGenCntrl
1621 PRIVATE S16 kwLmmValidateGenCntrl(cntrl)
1625 S16 reason; /* reason for failure */
1626 U8 sAction; /* subaction field */
1628 TRC2(kwLmmValidateGenCntrl);
1630 reason = LCM_REASON_NOT_APPL;
1631 sAction = cntrl->t.cntrl.subAction;
1633 switch (cntrl->t.cntrl.action)
1637 if ((sAction != SAUSTA) &&
1638 (sAction != SADBG) &&
1641 reason = LCM_REASON_INVALID_SUBACTION;
1647 reason = LCM_REASON_INVALID_ACTION;
1656 * it deregisters the timers and deregisters the kwuSap Control blocks
1658 * @param[in] gCb RLC Instance Control Block
1663 PRIVATE Void kwLmmCleanGblRsrcs
1668 PRIVATE Void kwLmmCleanGblRsrcs(gCb)
1675 TRC2(kwLmmCleanGblRsrcs)
1677 if (gCb->init.cfgDone)
1679 /* Deregister the timers */
1680 /*Pradeep: changing the SDeregTmrMt() to SDeregTmr*/
1681 (Void) SDeregTmrMt(gCb->init.ent, gCb->init.inst,
1682 (S16)gCb->genCfg.timeRes, kwActvTmr);
1683 /*(Void) SDeregTmr(gCb->init.ent, gCb->init.inst,
1684 (S16)gCb->genCfg.timeRes, kwActvTmr);*/
1686 kwSapSize = (Size)(gCb->genCfg.maxKwuSaps * sizeof(KwKwuSapCb));
1688 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1690 kwUdxSapSize = (Size)(gCb->genCfg.maxUdxSaps * sizeof(KwUdxDlSapCb));
1693 gCb->u.dlCb->shutdownReceived = TRUE;
1694 kwUtlFreeDlMemory(gCb);
1695 if (gCb->u.dlCb->kwuDlSap != NULLP)
1697 KW_FREE(gCb,gCb->u.dlCb->kwuDlSap, kwSapSize);
1700 if(gCb->u.dlCb->udxDlSap != NULLP)
1702 KW_FREE(gCb,gCb->u.dlCb->udxDlSap, kwUdxSapSize);
1705 if(gCb->u.dlCb->rguDlSap != NULLP)
1707 KW_FREE(gCb,gCb->u.dlCb->rguDlSap, gCb->genCfg.maxRguSaps);
1708 gCb->genCfg.maxRguSaps = 0;
1710 if (gCb->u.dlCb->shutdownReceived)
1712 if (gCb->u.dlCb->selfPstMBuf != NULL)
1714 SPutMsg(gCb->u.dlCb->selfPstMBuf);
1716 KW_FREE(gCb,gCb->u.dlCb, sizeof (KwDlCb));
1723 kwUdxSapSize = (Size)(gCb->genCfg.maxUdxSaps * sizeof(KwUdxUlSapCb));
1726 if (gCb->u.ulCb->kwuUlSap != NULLP)
1728 KW_FREE(gCb,gCb->u.ulCb->kwuUlSap, kwSapSize);
1731 if(gCb->u.ulCb->udxUlSap != NULLP)
1733 KW_FREE(gCb,gCb->u.ulCb->udxUlSap, kwUdxSapSize);
1736 if(gCb->u.ulCb->rguUlSap != NULLP)
1738 KW_FREE(gCb,gCb->u.ulCb->rguUlSap, gCb->genCfg.maxRguSaps);
1739 gCb->genCfg.maxRguSaps = 0;
1742 KW_FREE(gCb,gCb->u.ulCb, sizeof (KwUlCb));
1746 gCb->init.cfgDone = FALSE;
1747 gCb->init.acnt = FALSE;
1748 gCb->init.trc = FALSE;
1750 gCb->init.usta = FALSE;
1758 * Delete all SAPs and Control Blocks
1761 * Shutdown of RLC happens at modules level, tm, um and am modules will be
1762 * shutdown using utility functin and dbm shutdown will clean up the SAPs,
1763 * control blocks and lists.
1765 * @params[in] gCb RLC instance control block
1768 * -# LCM_REASON_NOT_APPL (SUCCESS)
1769 * -# LCM_REASON_HASHING_FAILED
1772 PRIVATE S16 kwLmmShutdown
1777 PRIVATE S16 kwLmmShutdown(gCb)
1786 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1788 for (idx = 0; idx < gCb->genCfg.maxRguSaps; idx++)
1790 rguSap = &(gCb->u.dlCb->rguDlSap[idx]);
1791 if ((rguSap->state == KW_SAP_BND) || (rguSap->state == KW_SAP_BINDING))
1793 KwLiRguUbndReq(&(rguSap->pst), rguSap->spId, 0);
1799 for (idx = 0; idx < gCb->genCfg.maxRguSaps; idx++)
1801 rguSap = &(gCb->u.ulCb->rguUlSap[idx]);
1802 if ((rguSap->state == KW_SAP_BND) || (rguSap->state == KW_SAP_BINDING))
1804 KwLiRguUbndReq(&(rguSap->pst), rguSap->spId, 0);
1809 if(gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1811 kwDbmDlShutdown(gCb);
1815 kwDbmUlShutdown(gCb);
1818 kwLmmCleanGblRsrcs(gCb);
1820 KW_MEM_SET (&(gCb->genSts), 0, sizeof (KwGenSts));
1822 RETVALUE(LCM_REASON_NOT_APPL);
1827 * Function processes the general control request
1829 * @param[in] gCb RLC instance control block
1830 * @param[in] cntrl RLC LM structure
1833 * -# LCM_REASON_NOT_APPL (SUCCESS)
1834 * -# LCM_REASON_INVALID_SUBACTION
1835 * -# LCM_REASON_INVALID_ACTION
1838 PRIVATE S16 kwLmmGenCntrl
1844 PRIVATE S16 kwLmmGenCntrl(gCb,cntrl)
1849 KwTrcCntrl *trcCntrl; /* trace */
1851 KwDbgCntrl *dbgCntrl; /* debug */
1853 S16 reason; /* reason for failure */
1855 TRC2(kwLmmGenCntrl);
1857 /* Validate control parameters */
1858 reason = kwLmmValidateGenCntrl (cntrl);
1860 if (reason != LCM_REASON_NOT_APPL)
1865 switch(cntrl->t.cntrl.action)
1869 switch(cntrl->t.cntrl.subAction)
1873 KW_SET_USTA_FLAG(gCb, TRUE);
1879 dbgCntrl = &cntrl->t.cntrl.s.dbgCntrl;
1880 KW_GET_DBG_MASK(gCb) |= dbgCntrl->dbgMask;
1886 trcCntrl = &cntrl->t.cntrl.s.trcCntrl;
1887 gCb->init.trc = TRUE;
1888 gCb->trcLen = trcCntrl->trcLen;
1889 (gCb->trcMask) |= trcCntrl->trcMask;
1897 switch(cntrl->t.cntrl.subAction)
1901 gCb->init.usta = FALSE;
1907 dbgCntrl = &cntrl->t.cntrl.s.dbgCntrl;
1908 KW_GET_DBG_MASK(gCb) &= ~(dbgCntrl->dbgMask);
1914 trcCntrl = &cntrl->t.cntrl.s.trcCntrl;
1915 gCb->init.trc = FALSE;
1916 gCb->trcMask &= ~(trcCntrl->trcMask);
1924 reason = kwLmmShutdown(gCb);
1933 * Bind/Unbind RLC UDX sap
1935 * @param[in] gCb RLC Instance Control Block
1936 * @param[in] cntrl RLC LM structure
1939 * -# LCM_REASON_NOT_/PPL (SUCCESS)
1940 * -# LCM_REASON_INVALID_SAP
1941 * -# LCM_REASON_INVALID_STATE
1942 * -# LCM_REASON_INVALID_ACTION
1945 PRIVATE S16 kwLmmUdxSapCntrl
1951 PRIVATE S16 kwLmmUdxSapCntrl(gCb,cntrl)
1956 TRC2(kwLmmUdxSapCntrl)
1958 #if (ERRCLASS & ERRCLS_INT_PAR)
1959 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1961 RETVALUE(LCM_REASON_INVALID_SAP);
1964 if((cntrl->t.cntrl.s.sapCntrl.suId < 0) ||
1965 (cntrl->t.cntrl.s.sapCntrl.suId >= KW_MAX_UDXSAPS))
1967 RETVALUE(LCM_REASON_INVALID_SAP);
1969 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1971 #define UDX_SAP gCb->u.ulCb->udxUlSap[cntrl->t.cntrl.s.sapCntrl.suId]
1972 #if (ERRCLASS & ERRCLS_INT_PAR)
1974 if(UDX_SAP.state == KW_SAP_NOT_CFG)
1976 RLOG0(L_ERROR,"udxUlSap not configured yet");
1977 RETVALUE(LCM_REASON_INVALID_STATE);
1979 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1981 switch(cntrl->t.cntrl.action)
1985 if(UDX_SAP.state != KW_SAP_BND)
1987 /* start timer to wait for bind confirm */
1988 kwStartTmr(gCb,(PTR)(&UDX_SAP), KW_EVT_WAIT_BNDCFM);
1989 UDX_SAP.state = KW_SAP_BINDING;
1990 KwUlUdxBndReq(&(UDX_SAP.pst), UDX_SAP.suId, UDX_SAP.spId);
1994 /* control request received for an already bound SAP */
1995 RETVALUE(LCM_REASON_INVALID_STATE);
2001 /* make the state of UDXSAP configured but not bound */
2002 UDX_SAP.state = KW_SAP_CFG;
2003 KwUlUdxUbndReq(&(UDX_SAP.pst), UDX_SAP.spId, 0);
2007 RETVALUE(LCM_REASON_INVALID_ACTION);
2009 } /* end of switch */
2011 RETVALUE(LCM_REASON_NOT_APPL);
2016 * Bind/Unbind RLC lower sap
2018 * @param[in] gCb RLC Instance Control Block
2019 * @param[in] cntrl RLC LM structure
2021 * -# LCM_REASON_NOT_APPL (SUCCESS)
2022 * -# LCM_REASON_INVALID_SAP
2023 * -# LCM_REASON_INVALID_STATE
2024 * -# LCM_REASON_INVALID_ACTION
2027 PRIVATE S16 kwLmmLSapCntrl
2033 PRIVATE S16 kwLmmLSapCntrl(gCb,cntrl)
2038 KwRguSapCb *rguSap; /* rgu sap pointer */
2040 TRC2(kwLmmLSapCntrl)
2042 #if (ERRCLASS & ERRCLS_INT_PAR)
2044 if((cntrl->t.cntrl.s.sapCntrl.suId < 0) ||
2045 (cntrl->t.cntrl.s.sapCntrl.suId >= gCb->genCfg.maxRguSaps))
2047 KWLOGERROR(gCb,ERRCLS_INT_PAR, EKW047, (ErrVal)cntrl->t.cntrl.s.sapCntrl.suId,
2048 "kwLmmLSapCntrl: Invalid RGU suId\n");
2049 RETVALUE(LCM_REASON_INVALID_SAP);
2051 #endif /* ERRCLASS & ERRCLS_INT_PAR */
2052 rguSap = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL) ?
2053 &(gCb->u.dlCb->rguDlSap[cntrl->t.cntrl.s.sapCntrl.suId]): \
2054 &(gCb->u.ulCb->rguUlSap[cntrl->t.cntrl.s.sapCntrl.suId]);
2056 #if (ERRCLASS & ERRCLS_INT_PAR)
2058 if(rguSap->state == KW_SAP_NOT_CFG)
2060 RLOG1(L_ERROR,"RLC Mode [%d]:rguSap not configured yet", gCb->genCfg.rlcMode);
2061 RETVALUE(LCM_REASON_INVALID_STATE);
2063 #endif /* ERRCLASS & ERRCLS_INT_PAR */
2065 switch(cntrl->t.cntrl.action)
2069 if(rguSap->state != KW_SAP_BND)
2071 /* start timer to wait for bind confirm */
2072 kwStartTmr(gCb,(PTR)(rguSap), KW_EVT_WAIT_BNDCFM);
2073 rguSap->state = KW_SAP_BINDING;
2074 rguSap->spId = cntrl->t.cntrl.s.sapCntrl.spId;
2075 rguSap->suId = cntrl->t.cntrl.s.sapCntrl.suId;
2076 KwLiRguBndReq(&(rguSap->pst), rguSap->suId, rguSap->spId);
2080 /* control request received for an already bound SAP */
2081 RETVALUE(LCM_REASON_INVALID_STATE);
2087 /* make the state of RGUSAP is configure but not bound */
2088 rguSap->state = KW_SAP_CFG;
2089 KwLiRguUbndReq(&(rguSap->pst), rguSap->spId, 0);
2093 RETVALUE(LCM_REASON_INVALID_ACTION);
2095 } /* end of switch */
2097 RETVALUE(LCM_REASON_NOT_APPL);
2102 * Function gather the general KWU SAP status
2104 * @param[in] gCb RLC Instance Control Block
2105 * @param[in] sta LM KWU Sap Status structure
2108 * -# LCM_REASON_NOT_APPL (SUCCESS)
2109 * -# LCM_REASON_INVALID_PAR_VAL(FAILURE)
2112 PRIVATE S16 kwLmmGetKwuSapSta
2118 PRIVATE S16 kwLmmGetKwuSapSta(gCb,sta)
2123 KwKwuSapCb *kwSapCb;
2125 TRC2(kwLmmGetKwuSapSta);
2127 #if (ERRCLASS & ERRCLS_INT_PAR)
2128 /* Validate the protocol parameters */
2129 if ((sta->spId >= (S16)gCb->genCfg.maxKwuSaps)||
2132 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2136 /* Get Sap control block */
2137 kwSapCb = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)?
2138 (KwKwuSapCb*)(gCb->u.dlCb->kwuDlSap + sta->spId):
2139 (KwKwuSapCb*)(gCb->u.ulCb->kwuUlSap + sta->spId);
2141 sta->state = kwSapCb->state;
2143 RETVALUE(LCM_REASON_NOT_APPL);
2148 * Function gather the general RGU SAP status
2150 * @param[in] gCb RLC Instance Control Block
2151 * @param[in] sta LM RGU Sap Status structure
2153 * -# LCM_REASON_NOT_APPL (SUCCESS)
2154 * -# LCM_REASON_INVALID_PAR_VAL(FAILURE)
2157 PRIVATE S16 kwLmmGetRguSapSta
2163 PRIVATE S16 kwLmmGetRguSapSta(gCb,sta)
2168 TRC2(kwLmmGetRguSapSta);
2170 #if (ERRCLASS & ERRCLS_INT_PAR)
2171 /* Validate the protocol parameters */
2172 if((sta->suId >= KW_MAX_RGUSAPS) || (sta->suId < 0))
2174 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2178 sta->state = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL) ?
2179 gCb->u.dlCb->rguDlSap[sta->suId].state :
2180 gCb->u.ulCb->rguUlSap[sta->suId].state ;
2182 RETVALUE(LCM_REASON_NOT_APPL);
2187 * Function gather the general CKW SAP status
2189 * @param[in] gCb RLC Instance Control Block
2190 * @param[in] sta LM CKW Sap Status structure
2192 * -# LCM_REASON_NOT_APPL (SUCCESS)
2193 * -# LCM_REASON_INVALID_PAR_VAL(FAILURE)
2196 PRIVATE S16 kwLmmGetCkwCntSapSta
2202 PRIVATE S16 kwLmmGetCkwCntSapSta(gCb,sta)
2204 KwCkwCntSapSta *sta;
2207 TRC2(kwLmmGetCkwCntSapSta);
2209 #if (ERRCLASS & ERRCLS_INT_PAR)
2210 /* Validate config parameters */
2211 if ((sta->spId >= KW_MAX_CKWSAPS ) ||
2213 (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL))
2215 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2218 sta->state = gCb->u.ulCb->ckwSap.state;
2220 RETVALUE(LCM_REASON_NOT_APPL);
2226 * Gather the general statistics
2228 * @param[in] gCb RLC Instance Control Block
2229 * @param[in] sts LM general statistics structure
2230 * @param[in] action action
2232 * -# LCM_REASON_NOT_APPL (SUCCESS)
2233 * -# LCM_REASON_INVALID_PAR_VAL(FAILURE)
2236 PRIVATE S16 kwLmmGetGenSts
2243 PRIVATE S16 kwLmmGetGenSts(gCb,sts, action)
2249 TRC2(kwLmmGetGenSts);
2251 #if (ERRCLASS & ERRCLS_INT_PAR)
2252 /* Validate protocol parameters */
2253 if ((action != LKW_ZEROSTS) && (action != LKW_NOZEROSTS))
2255 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2261 if(action == LKW_ZEROSTS)
2263 KW_MEM_SET (&(gCb->genSts), 0, sizeof (KwGenSts));
2266 RETVALUE(LCM_REASON_NOT_APPL);
2271 * Gather the SAP statistics
2273 * @param[in] gCb RLC Instance Control Block
2274 * @param[in] sts LM general statistics structure
2275 * @param[in] elmnt element
2276 * @param[in] action action
2279 * -# LCM_REASON_NOT_APPL (SUCCESS)
2280 * -# LCM_REASON_INVALID_PAR_VAL (FAIL)
2283 PRIVATE S16 kwLmmGetSapSts
2291 PRIVATE S16 kwLmmGetSapSts(sts, elmnt, action)
2298 TRC2(kwLmmGetSapSts);
2300 /* Validate protocol parameters */
2301 if (action != LKW_ZEROSTS && action != LKW_NOZEROSTS)
2303 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2309 KwKwuSapSts *kwuSap;
2310 KwKwuSapCb *kwuSapCb;
2311 kwuSap = &sts->t.sts.s.kwuSap;
2313 /* Get Sap control block */
2314 /* kw005.201, modified the element of kwuSap from suId to spId */
2315 kwuSapCb = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)?
2316 (KwKwuSapCb*)(gCb->u.dlCb->kwuDlSap + kwuSap->spId):
2317 (KwKwuSapCb*)(gCb->u.ulCb->kwuUlSap + kwuSap->spId);
2320 *kwuSap = kwuSapCb->sts;
2322 if (action == LKW_ZEROSTS)
2324 KW_MEM_SET (&kwuSapCb->sts, 0, sizeof (KwKwuSapSts));
2328 /* kw005.201 removed RGUSAP statistics support */
2331 KwCkwCntSts *ckwSap;
2332 ckwSap = &sts->t.sts.s.ckwSap;
2333 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
2335 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2338 ckwSap->statMsgs = gCb->u.ulCb->ckwSap.sts.statMsgs;
2340 if (action == LKW_ZEROSTS)
2342 KW_MEM_SET (&(gCb->u.ulCb->ckwSap.sts), 0, sizeof (KwCkwCntSts));
2347 RETVALUE(LCM_REASON_INVALID_ELMNT);
2350 SGetDateTime(&sts->t.sts.dt);
2352 RETVALUE(LCM_REASON_NOT_APPL);
2357 * This function sends Unsolicited Status Indication to the Layer Management
2360 * @param[in] gCb RLC Instance Control Block
2361 * @param[in] category Category
2362 * @param[in] event event
2363 * @param[in] cause cause
2364 * @param[in] UeId ueId
2365 * @param[in] Qci qci
2371 PUBLIC Void kwLmmSendAlarm
2382 PUBLIC Void kwLmmSendAlarm(category, event, cause, suId, ueId, qci)
2391 #else /* LTE_L2_MEAS */
2393 PUBLIC Void kwLmmSendAlarm
2403 PUBLIC Void kwLmmSendAlarm(category, event, cause, suId, ueId)
2411 #endif /* LTE_L2_MEAS */
2413 KwMngmt usta; /* Rlc Management Structure */
2415 TRC2(kwLmmSendAlarm);
2417 if(gCb->init.usta == FALSE)
2422 usta.hdr.elmId.elmnt = STGEN;
2423 usta.hdr.entId.ent = gCb->init.ent;
2424 usta.hdr.entId.inst = gCb->init.inst;
2426 /* fill in the event and category */
2427 usta.t.usta.alarm.category = category;
2428 usta.t.usta.alarm.event = event;
2429 usta.t.usta.alarm.cause = cause;
2431 /* set the suId and ueId */
2432 usta.t.usta.ueId = ueId;
2433 usta.t.usta.suId = suId;
2434 /* kw005.201 added support for L2 Measurement */
2436 if(event == LKW_EVT_MEAS_HALT)
2438 usta.t.usta.qci = qci;
2440 #endif /* LTE_L2_MEAS */
2441 /* update the date and time */
2442 (Void) SGetDateTime(&usta.t.usta.alarm.dt);
2444 KwMiLkwStaInd(&(gCb->init.lmPst), &usta);
2452 * This function sends trace indication to LM
2454 * @param[in] gCb RLC Instance Control Block
2455 * @param[in] event event
2456 * @param[in] mBuf meessage buffer
2463 PUBLIC S16 kwLmmSendTrc
2470 PUBLIC S16 kwLmmSendTrc(gCb,event, mBuf)
2476 KwMngmt trc; /* RLC management control block */
2485 RLOG2(L_DEBUG, "kwLmmSendTrc(): Trace for event=%d, gCb->trcLen=%d",
2489 cmMemset((U8 *)&trc, 0, sizeof(KwMngmt));
2491 pst = gCb->init.lmPst;
2493 trc.t.trc.event = event;
2494 SGetDateTime(&trc.t.trc.dt);
2495 trc.cfm.status = LCM_PRIM_OK;
2496 trc.cfm.reason = LCM_REASON_NOT_APPL;
2500 /* Check if the whole buffer is to be sent in Trace indication */
2501 if(gCb->trcLen == LKW_FULL_TRACE)
2503 if (SCpyMsgMsg(mBuf, pst.region, pst.pool, &dstMbuf)
2506 /* rg005.201 removed SPutSBuf on error */
2507 RLOG0(L_ERROR,"SCpyMsgMsg Failed");
2510 /* Send Trace Indication to Layer manager */
2511 KwMiLkwTrcInd(&pst, &trc, dstMbuf);
2513 /* check if only a specified number of bytes are to be sent */
2514 else if(gCb->trcLen > 0)
2516 /* Get the length of the recvd message buffer */
2517 if (SFndLenMsg(mBuf, &bufLen) != ROK)
2519 RLOG0(L_ERROR,"SFndLenMsg Failed");
2522 /* Check if the recvd buffer size is less than request trace len */
2523 if(bufLen < gCb->trcLen)
2525 /* Copy the whole of the recvd buffer in trace indication */
2527 if (SCpyMsgMsg(mBuf, pst.region, pst.pool, &dstMbuf)
2530 RLOG0(L_ERROR,"SCpyMsgMsg Failed");
2534 /* Send Trace Indication to Layer manager */
2535 KwMiLkwTrcInd(&pst, &trc, dstMbuf);
2539 /* if the recvd buffer size is greater than request trace len */
2540 /* Get a temporary buffer to store the msg */
2541 KW_ALLOC(gCb,tempBuf, gCb->trcLen);
2543 #if (ERRCLASS & ERRCLS_INT_PAR)
2544 if(tempBuf == NULLP)
2546 (Void) SPutSMem(KW_GET_MEM_REGION(gCb), KW_GET_MEM_POOL(gCb));
2548 RLOG0(L_FATAL,"Memory Allocation failed");
2549 RETVALUE(LCM_REASON_MEM_NOAVAIL);
2551 #endif /* ERRCLASS & ERRCLS_INT_PAR */
2553 /* Copy trcLen nos of bytes from the recvd message */
2554 if (SCpyMsgFix(mBuf,0,gCb->trcLen,tempBuf,&tempCnt) != ROK)
2556 RLOG0(L_ERROR,"SCpyMsgFix Failed");
2560 if (SGetMsg(pst.region, pst.pool, &dstMbuf) != ROK)
2562 RLOG0(L_FATAL,"Memory Allocation failed");
2565 /* Copy the tempBuf data to dst mBuf */
2566 if (SCpyFixMsg(tempBuf,dstMbuf,0,gCb->trcLen,&tempCnt) != ROK)
2568 RLOG0(L_ERROR,"SCpyMsgFix Failed");
2572 /* Free the memory allocated for tempBuf */
2573 KW_FREE(gCb,tempBuf, gCb->trcLen);
2574 /* Send Trace Indication to Layer manager */
2575 KwMiLkwTrcInd(&pst, &trc, dstMbuf);
2581 KwMiLkwTrcInd(&pst, &trc, mBuf);
2590 * Activate Task - timer
2593 * Invoked by system services to activate a task with a timer tick.
2595 * @param[in] ent entity
2596 * @param[in] inst instance
2605 PUBLIC S16 kwActvTmr
2611 PUBLIC S16 kwActvTmr(ent,inst)
2619 if (inst >= KW_MAX_RLC_INSTANCES)
2623 gCb = KW_GET_KWCB(inst);
2624 cmPrcTmr(&(gCb->kwTqCp), gCb->kwTq, (PFV) kwTmrExpiry);
2627 } /* end of kwActvTmr */
2630 /********************************************************************30**
2633 **********************************************************************/