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);
284 /* Register the timer */
285 /*Pradeep: changing the SRegTmrMt() to SRegTmr()*/
286 if(SRegTmrMt(gCb->init.ent, gCb->init.inst, (U16)cfg->timeRes,
289 KW_FREE(gCb,gCb->u.dlCb->udxDlSap, kwUdxSapSize);
290 KW_FREE(gCb,gCb->u.dlCb->kwuDlSap, kwSapSize);
291 KW_FREE(gCb,gCb->u.dlCb->rguDlSap, rguSapSize);
292 KW_FREE(gCb,gCb->u.dlCb, sizeof (KwDlCb));
294 RETVALUE(LCM_REASON_REGTMR_FAIL);
297 /* initializations for background processing of freeing memory */
298 kwUtlInitToBeFreed(gCb, &(gCb->u.dlCb->toBeFreed));
299 kwUtlInitializeSelfPst(gCb);
301 if(SGetMsg(gCb->init.region,
303 &(gCb->u.dlCb->selfPstMBuf)) != ROK)
305 KW_FREE(gCb,gCb->u.dlCb->udxDlSap, kwSapSize);
306 KW_FREE(gCb,gCb->u.dlCb->kwuDlSap, kwSapSize);
307 KW_FREE(gCb,gCb->u.dlCb->rguDlSap, rguSapSize);
308 KW_FREE(gCb,gCb->u.dlCb, sizeof (KwDlCb));
310 RETVALUE(LCM_REASON_MEM_NOAVAIL);
314 kwUtlL2MeasDlInit(gCb);
317 else if(gCb->genCfg.rlcMode == LKW_RLC_MODE_UL)
319 KW_ALLOC(gCb,gCb->u.ulCb, sizeof (KwUlCb));
320 if (gCb->u.ulCb == NULLP)
322 RLOG0(L_FATAL,"Memory Allocation failed");
323 RETVALUE(LCM_REASON_MEM_NOAVAIL);
326 /* allocate memory to the KWU sap's */
327 kwSapSize = (Size)((Size) gCb->genCfg.maxKwuSaps *
328 (Size)sizeof(KwKwuSapCb));
330 KW_ALLOC(gCb,gCb->u.ulCb->kwuUlSap, kwSapSize);
332 #if (ERRCLASS & ERRCLS_INT_PAR)
333 if(gCb->u.ulCb->kwuUlSap == NULLP)
335 KW_FREE(gCb,gCb->u.ulCb, sizeof (KwUlCb));
336 RLOG0(L_FATAL,"Memory Allocation failed");
337 RETVALUE(LCM_REASON_MEM_NOAVAIL);
339 #endif /* ERRCLASS & ERRCLS_INT_PAR */
341 gCb->u.ulCb->numKwuSaps = gCb->genCfg.maxKwuSaps;
343 /* allocate memory to the KWU sap's */
344 kwUdxSapSize = (Size)((Size) gCb->genCfg.maxUdxSaps *
345 (Size)sizeof(KwUdxUlSapCb));
347 KW_ALLOC(gCb,gCb->u.ulCb->udxUlSap, kwUdxSapSize);
349 #if (ERRCLASS & ERRCLS_INT_PAR)
350 if(gCb->u.ulCb->kwuUlSap == NULLP)
352 KW_FREE(gCb,gCb->u.ulCb->kwuUlSap, kwSapSize);
353 KW_FREE(gCb,gCb->u.ulCb, sizeof (KwUlCb));
354 RLOG0(L_FATAL,"Memory Allocation failed");
355 RETVALUE(LCM_REASON_MEM_NOAVAIL);
357 #endif /* ERRCLASS & ERRCLS_INT_PAR */
359 rguSapSize = (Size)((Size) gCb->genCfg.maxRguSaps *
360 (Size)sizeof(KwRguSapCb));
361 KW_ALLOC(gCb,gCb->u.ulCb->rguUlSap, rguSapSize);
362 #if (ERRCLASS & ERRCLS_INT_PAR)
363 if(gCb->u.ulCb->rguUlSap == NULLP)
365 KW_FREE(gCb,gCb->u.ulCb->kwuUlSap, kwSapSize);
366 KW_FREE(gCb,gCb->u.ulCb->rguUlSap, kwSapSize);
367 KW_FREE(gCb,gCb->u.ulCb, sizeof (KwUlCb));
369 KWLOGERROR(gCb,ERRCLS_INT_PAR, EKW043, (ErrVal) cfg->maxUe,
370 "kwLmmGenCfg: SgetSBuf Failed for rguSap...!");
371 RETVALUE(LCM_REASON_MEM_NOAVAIL);
373 #endif /* ERRCLASS & ERRCLS_INT_PAR */
375 /* Initialize the Ue and Cell hash list */
376 ret = kwDbmUlInit(gCb);
379 KW_FREE(gCb,gCb->u.ulCb->udxUlSap, kwUdxSapSize);
380 KW_FREE(gCb,gCb->u.ulCb->kwuUlSap, kwSapSize);
381 KW_FREE(gCb,gCb->u.ulCb->rguUlSap, kwSapSize);
382 KW_FREE(gCb,gCb->u.ulCb, sizeof (KwUlCb));
383 RLOG0(L_FATAL,"RLC DL Initialization failed");
386 /* Register the timer */
388 if(SRegTmrMt(gCb->init.ent, gCb->init.inst, (U16)cfg->timeRes,
391 KW_FREE(gCb,gCb->u.ulCb->udxUlSap, kwUdxSapSize);
392 KW_FREE(gCb,gCb->u.ulCb->kwuUlSap, kwSapSize);
393 KW_FREE(gCb,gCb->u.ulCb->rguUlSap, kwSapSize);
394 KW_FREE(gCb,gCb->u.ulCb, sizeof (KwUlCb));
396 RETVALUE(LCM_REASON_REGTMR_FAIL);
400 kwUtlL2MeasUlInit(gCb);
405 #if (ERRCLASS & ERRCLS_INT_PAR)
406 RLOG0(L_ERROR, "Received Invalid RLC Mode");
407 #endif /* ERRCLASS & ERRCLS_INT_PAR */
409 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
411 /* Timer Initialization */
412 gCb->kwTqCp.tmrLen = KW_TMR_LEN;
414 cmMemset((U8*)gCb->kwTq, NULLP, sizeof(CmTqType) * KW_TMR_LEN);
416 KW_MEM_CPY(&(gCb->init.lmPst), &cfg->lmPst, sizeof(Pst));
418 gCb->init.lmPst.srcProcId = gCb->init.procId;
419 gCb->init.lmPst.srcEnt = gCb->init.ent;
420 gCb->init.lmPst.srcInst = gCb->init.inst;
421 gCb->init.lmPst.event = EVTNONE;
423 /* kw002.201 For multi core and multi region,no need to reinitiailize the
424 * region again . This would be done with kwActvInit from SSI */
425 #if !defined(SS_MULTICORE_SUPPORT) && !defined(SS_M_PROTO_REGION)
426 gCb->init.region = cfg->lmPst.region;
427 #endif /* !defined(SS_MULTICORE_SUPPORT) && !defined(SS_M_PROTO_REGION) */
428 gCb->init.pool = cfg->lmPst.pool;
430 gCb->init.cfgDone = TRUE;
432 RETVALUE(LCM_REASON_NOT_APPL);
437 * Sends confirmation message to LM Called by KwMiLkwCfgReq function
439 * @param[in] gCb RLC Instance Control Block
440 * @param[in] pst Post structure
441 * @param[in] cfm RLC LM structure
442 * @param[in] type Type of LM message
443 * @param[in] hdr Message header
449 PRIVATE Void kwLmmSendCfm
458 PRIVATE Void kwLmmSendCfm(gCb,pst, cfm, type, hdr)
466 Pst rPst; /* Reply post structure */
470 KW_MEM_SET(&rPst, 0, sizeof(Pst));
472 /* reply post structure for confirmation */
475 rPst.srcEnt = gCb->init.ent;
476 rPst.srcInst = gCb->init.inst;
477 cfm->hdr.entId.ent = gCb->init.ent;
478 cfm->hdr.entId.inst = gCb->init.inst;
482 rPst.srcEnt = pst->dstEnt;
483 rPst.srcInst = pst->dstInst;
484 cfm->hdr.entId.ent = pst->dstEnt;
485 cfm->hdr.entId.inst = pst->dstInst;
487 rPst.srcProcId = SFndProcId();
488 rPst.dstEnt = pst->srcEnt;
489 rPst.dstInst = pst->srcInst;
490 rPst.dstProcId = pst->srcProcId;
491 rPst.selector = hdr->response.selector;
492 rPst.prior = hdr->response.prior;
493 rPst.route = hdr->response.route;
494 rPst.region = hdr->response.mem.region;
495 rPst.pool= hdr->response.mem.pool;
497 /* Fill the reply header */
498 cfm->hdr.elmId.elmnt = hdr->elmId.elmnt;
499 cfm->hdr.transId = hdr->transId;
504 KwMiLkwCfgCfm(&rPst,cfm);
507 SGetDateTime(&(cfm->t.cntrl.dt));
508 KwMiLkwCntrlCfm(&rPst,cfm);
511 SGetDateTime(&(cfm->t.sts.dt));
512 KwMiLkwStsCfm(&rPst,0,cfm);
515 SGetDateTime(&(cfm->t.ssta.dt));
516 KwMiLkwStaCfm(&rPst,cfm);
519 #if (ERRCLASS & ERRCLS_INT_PAR)
520 RLOG0(L_ERROR, "Received Invalid Message Type");
525 #endif /* ERRCLASS & ERRCLS_INT_PAR */
535 * This function processes configuration requests received from the layer
539 * The configuration requests can be for general configuration, or
540 * configuration of RGU, KWU, and CKW SAPs. The type of the configuration
541 * request can be determined from the elmId field in the header of the layer
542 * manager message.This function is called by the layer manager to configure
545 * This function implements the following logic:
547 * - if genCfg is not done, send negative Cfm to the layer manager;
549 * - switch (cfg->hdr.elmId.elmnt)
551 * - update the genCfg field in RlCb;
552 * - allocate the maximum static memory required by the RLC product;
553 * - register the timer service by calling SReqTmr;
554 * - set CfgDone for not configuring again;
556 * - if all the parameters are valid, then allocate the KwuSap control
558 * - update the SAP control block with the information provided in the
559 * - configuration request;
560 * - send configuration confirm with the status, success;
562 * - if all the parametes are valid, then allocate the CkwSap control
564 * - update the SAP control block with the information provided in the
565 * configuration request;
566 * - send configuration confirm with the status, success;
568 * - if all the parametes are valid, then allocate the rguSap control
570 * - update the SAP control block with the information provided in the
571 * configuration request;
572 * - send configuration confirm with the status, success;
574 * - if all the parametes are valid, then allocate the udxSap control
576 * - update the SAP control block with the information provided in the
577 * configuration request;
578 * - send configuration confirm with the status, success;
581 * @param[in] pst post structure
582 * @param[in] cfg LM management structure
586 * -# Failure : RFAILED
590 PUBLIC S16 KwMiLkwCfgReq
596 PUBLIC S16 KwMiLkwCfgReq (pst, cfg)
601 Reason reason; /* failure reason */
606 #if (ERRCLASS & ERRCLS_INT_PAR)
607 /* Check if the instance is configured */
608 if (pst->dstInst >= KW_MAX_RLC_INSTANCES)
610 cfg->cfm.status = LCM_PRIM_NOK;
611 cfg->cfm.reason = LCM_REASON_INVALID_INSTANCE;
612 kwLmmSendCfm(tKwCb,pst, cfg, TCFG, &cfg->hdr);
617 tKwCb = KW_GET_KWCB(pst->dstInst);
621 cfg->cfm.status = LCM_PRIM_NOK;
622 cfg->cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
623 kwLmmSendCfm(tKwCb,pst, cfg, TCFG, &cfg->hdr);
626 /* check configuration is done or not */
627 if ((tKwCb->init.cfgDone != TRUE) &&
628 (cfg->hdr.elmId.elmnt != STGEN))
631 * if general config is not over then use pst structure
632 * in primitive to communicate to stack manager
635 cfg->cfm.status = LCM_PRIM_NOK;
636 cfg->cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
637 kwLmmSendCfm(tKwCb,pst, cfg, TCFG, &cfg->hdr);
641 RLOG1(L_DEBUG, "KwMiLkwCfgReq elmId(%d)", cfg->hdr.elmId.elmnt);
643 switch(cfg->hdr.elmId.elmnt)
647 reason = kwLmmGenCfg(tKwCb,&cfg->t.cfg.s.gen);
652 reason = kwLmmCfgKwuSap(tKwCb,&cfg->t.cfg.s.sap);
657 reason = kwLmmCfgCkwSap(tKwCb,&cfg->t.cfg.s.sap);
662 reason = kwLmmCfgRguSap(tKwCb,&cfg->t.cfg.s.sap);
667 reason = kwLmmCfgUdxSap(tKwCb,&cfg->t.cfg.s.sap);
672 reason = LCM_REASON_INVALID_ELMNT;
677 if (reason == LCM_REASON_NOT_APPL)
679 cfg->cfm.status = LCM_PRIM_OK;
680 cfg->cfm.reason = LCM_REASON_NOT_APPL;
681 kwLmmSendCfm(tKwCb,pst, cfg, TCFG, &cfg->hdr);
686 cfg->cfm.status = LCM_PRIM_NOK;
687 cfg->cfm.reason = reason;
688 kwLmmSendCfm(tKwCb,pst, cfg, TCFG, &cfg->hdr);
695 * The layer manager initiates and uses the management-control procedure to
696 * control RLC elements.The RLC control request primitive (KwMiLkwCntrlReq)
697 * can be called more than once and at any time after the
698 * management-configuration procedure.The control request primitive
699 * is confirmed by a KwMiLkwCntrlCfm primitive.
702 * This function implements the following logic:
704 * - if(cfgDone = FALSE)
705 * - send negative confirmation to the layer manager;
708 * - switch(cntrl->hdr.elmId.elmnt)
712 * - switch(subAction)
714 * - enable the unsolicited status flag;
715 * - send the control Cfm with success;
717 * - set the debug mask;
718 * - send the control Cfm with success;
720 * - enable the trace flag;
721 * - send the control Cfm with success;
723 * - switch(subAction)
725 * - disable the unsolicited status flag;
726 * - send the control Cfm with success;
728 * - disable the trace flag;
729 * - send the control Cfm with success;
738 * @param[in] pst post structure
739 * @param[in] cntrl LM management structure
746 PUBLIC S16 KwMiLkwCntrlReq
752 PUBLIC S16 KwMiLkwCntrlReq(pst, cntrl)
757 Reason reason; /* failure reason */
760 TRC3(KwMiLkwCntrlReq)
762 #if (ERRCLASS & ERRCLS_INT_PAR)
763 /* Check if the instance is configured */
764 if (pst->dstInst >= KW_MAX_RLC_INSTANCES)
766 cntrl->cfm.status = LCM_PRIM_NOK;
767 cntrl->cfm.reason = LCM_REASON_INVALID_INSTANCE;
769 kwLmmSendCfm(tKwCb,pst, cntrl, TCNTRL, &cntrl->hdr);
774 tKwCb = KW_GET_KWCB(pst->dstInst);
778 cntrl->cfm.status = LCM_PRIM_NOK;
779 cntrl->cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
780 kwLmmSendCfm(tKwCb,pst, cntrl, TCNTRL, &cntrl->hdr);
784 if (!(tKwCb->init.cfgDone))
786 cntrl->cfm.status = LCM_PRIM_NOK;
787 cntrl->cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
788 kwLmmSendCfm(tKwCb,pst, cntrl, TCNTRL, &cntrl->hdr);
791 RLOG1(L_DEBUG, "KwMiLkwCntrlReq(elmId(%d))", cntrl->hdr.elmId.elmnt);
793 /* In normal cases, LCM_REASON_NOT_APPL is returned in cfm.
794 * In all error cases appropriate reason is returned
795 * by the functions below
798 switch (cntrl->hdr.elmId.elmnt)
802 /* general control */
803 reason = kwLmmGenCntrl(tKwCb,cntrl);
808 /* Lower SAP control */
809 reason = kwLmmLSapCntrl(tKwCb,cntrl);
815 reason = kwLmmUdxSapCntrl(tKwCb,cntrl);
820 reason = LCM_REASON_INVALID_ELMNT;
825 if (reason == LCM_REASON_NOT_APPL)
827 cntrl->cfm.status = LCM_PRIM_OK;
828 cntrl->cfm.reason = LCM_REASON_NOT_APPL;
832 cntrl->cfm.status = LCM_PRIM_NOK;
833 cntrl->cfm.reason = reason;
836 kwLmmSendCfm(tKwCb,pst, cntrl, TCNTRL, &cntrl->hdr);
843 * This function processes solicited status requests received from the layer
844 * manager. The layer manager can request status information regarding the
845 * system ID, RGUSAP,KWUSAP, or CKWSAP.
847 * @param[in] pst post structure
848 * @param[in] sta LM management structure
854 PUBLIC S16 KwMiLkwStaReq
860 PUBLIC S16 KwMiLkwStaReq(pst, sta)
865 KwMngmt rSta; /* Status */
866 Reason reason; /* Failure reason */
871 #if (ERRCLASS & ERRCLS_INT_PAR)
872 /* Check if the instance is configured */
873 if (pst->dstInst >= KW_MAX_RLC_INSTANCES)
875 sta->cfm.status = LCM_PRIM_NOK;
876 sta->cfm.reason = LCM_REASON_INVALID_INSTANCE;
878 kwLmmSendCfm(tKwCb,pst, sta, TSSTA, &sta->hdr);
883 tKwCb = KW_GET_KWCB(pst->dstInst);
886 sta->cfm.status = LCM_PRIM_NOK;
887 sta->cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
889 kwLmmSendCfm(tKwCb,pst, sta, TSSTA, &sta->hdr);
893 RLOG1(L_DEBUG, "Status request for elmId(%d))", sta->hdr.elmId.elmnt);
895 reason = LCM_REASON_NOT_APPL;
897 KW_MEM_SET(&rSta, 0, sizeof(KwMngmt));
898 switch (sta->hdr.elmId.elmnt)
902 reason = LCM_REASON_NOT_APPL;
903 kwGetSId(&rSta.t.ssta.s.sysId);
908 KW_MEM_CPY (&rSta.t.ssta.s.kwuSap,
909 &sta->t.ssta.s.kwuSap,
910 sizeof (KwKwuSapSta));
912 reason = kwLmmGetKwuSapSta (tKwCb,&rSta.t.ssta.s.kwuSap);
917 KW_MEM_CPY (&rSta.t.ssta.s.rguSap,
918 &sta->t.ssta.s.rguSap,
919 sizeof (KwRguSapSta));
921 reason = kwLmmGetRguSapSta (tKwCb,&rSta.t.ssta.s.rguSap);
926 KW_MEM_CPY (&rSta.t.ssta.s.ckwSap,
927 &sta->t.ssta.s.ckwSap,
928 sizeof (KwCkwCntSapSta));
930 reason = kwLmmGetCkwCntSapSta (tKwCb,&rSta.t.ssta.s.ckwSap);
935 reason = LCM_REASON_INVALID_ELMNT;
938 } /* end of switch */
940 if (reason == LCM_REASON_NOT_APPL)
942 rSta.cfm.status = LCM_PRIM_OK;
943 rSta.cfm.reason = LCM_REASON_NOT_APPL;
947 rSta.cfm.status = LCM_PRIM_NOK;
948 rSta.cfm.reason = reason;
950 kwLmmSendCfm(tKwCb,pst, &rSta, TSSTA, &sta->hdr);
957 * This function processes statistics requests received from the layer
961 * After collecting the statistics, ir calls the statistics confirm function
962 * to send the statistics to the layer manager.
964 * - switch(sts->hdr.elmId.elmnt)
966 * - get the general statistics from the KW control block;
967 * - if (action = RESET)
968 * - reset the general statistic field in the RlCb;
969 * - call KwMiLkwStsCfm to send statistics back to layer manager;
973 * - get the SAP specific statistics from KW control block;
974 * - if (action = RESET)
975 * - reset the general statistic field in the RlCb;
976 * - call KwMiLkwStsCfm to send statistics to the layer manager;
979 * @param[in] pst post structure
980 * @param[in] action action
981 * @param[in] sts LM management structure
988 PUBLIC S16 KwMiLkwStsReq
995 PUBLIC S16 KwMiLkwStsReq (pst, action, sts)
1001 KwMngmt rSts; /* Statistics */
1002 Reason reason; /* Reason for failure */
1005 TRC3(KwMiLkwStsReq);
1007 #if (ERRCLASS & ERRCLS_INT_PAR)
1008 /* Check if the instance is configured */
1009 if (pst->dstInst >= KW_MAX_RLC_INSTANCES)
1011 rSts.cfm.status = LCM_PRIM_NOK;
1012 rSts.cfm.reason = LCM_REASON_INVALID_INSTANCE;
1014 kwLmmSendCfm(tKwCb,pst, &rSts, TCNTRL, &sts->hdr);
1019 tKwCb = KW_GET_KWCB(pst->dstInst);
1022 rSts.cfm.status = LCM_PRIM_NOK;
1023 rSts.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
1025 kwLmmSendCfm(tKwCb,pst, &rSts, TCNTRL, &sts->hdr);
1029 RLOG2(L_DEBUG, "KwMiLkwStsReq(elmId(%d),action(%d))",
1031 sts->hdr.elmId.elmnt);
1033 KW_MEM_SET(&rSts, 0, sizeof(KwMngmt));
1035 switch (sts->hdr.elmId.elmnt)
1039 reason = kwLmmGetGenSts(tKwCb,&rSts.t.sts.s.gen, action);
1045 if( sts->hdr.elmId.elmnt == STKWUSAP)
1047 /* kw005.201, modified the element of kwuSap from suId to spId */
1048 rSts.t.sts.s.kwuSap.spId = sts->t.sts.s.kwuSap.spId;
1050 reason = kwLmmGetSapSts(tKwCb,&rSts, sts->hdr.elmId.elmnt, action);
1055 reason = LCM_REASON_INVALID_ELMNT;
1060 if (reason == LCM_REASON_NOT_APPL)
1062 rSts.cfm.status = LCM_PRIM_OK;
1063 rSts.cfm.reason = LCM_REASON_NOT_APPL;
1067 rSts.cfm.status = LCM_PRIM_NOK;
1068 rSts.cfm.reason = reason;
1070 kwLmmSendCfm(tKwCb,pst, &rSts, TSTS, &sts->hdr);
1075 /* kw005.201 added support for L2 Measurement */
1079 This function processes L2 Measurement requests received from the layer manager.
1080 The L2 Measurement is start for a time period and after the timer expiry, the
1081 measurement confirm is sent.
1083 - Accept only one set of measurements.
1084 - Allocate and initialise KwL2MeasEvtCb.
1085 - Validate if the measurement is already in progress.
1086 - Loop through the existing measEvtCb with matching measType
1087 - Check if measurement is running for any qci present in the measReq
1088 - If present, move the qCi to list of invalid qCIs.
1089 - Set KwL2MeasEvtCb.measOn to TRUE for QCIs to be measured.
1090 - For the number of measurements requested.
1091 - For all Ues with RBs matching qCI.
1092 - Add RbCb to the RB linked list.
1093 - Set kwRbCb.measOn to measurement type.
1094 - If Meas type is DL_DELAY
1095 - Update COUNT to startCount.
1098 * @param[in] pst post structure
1099 * @param[in] action action
1100 * @param[in] cfg LM management structure
1103 * -# Failure : RFAILED
1106 PUBLIC S16 KwMiLkwL2MeasReq
1109 KwL2MeasReqEvt *measReqEvt
1112 PUBLIC S16 KwMiLkwL2MeasReq (pst, measReqEvt)
1114 KwL2MeasReqEvt *measReqEvt;
1120 KwL2MeasCfmEvt measCfmEvt;
1124 TRC3(KwMiLkwL2MeasReq);
1126 tKwCb = KW_GET_KWCB(pst->dstInst);
1128 /* Initialize measCfmEvt */
1129 KW_MEM_ZERO(&measCfmEvt, sizeof(KwL2MeasCfmEvt));
1130 /* validate the received measReqEvt */
1131 /*LTE_L2_MEAS_PHASE2*/
1132 if(measReqEvt->measPeriod != 0)
1134 /* L2 MEAS AGHOSH */
1135 if((measReqEvt->measReq.measType & LKW_L2MEAS_DL_IP)||
1136 (measReqEvt->measReq.measType & LKW_L2MEAS_UL_IP))
1138 ret = kwUtlValidateIpThL2Meas(measReqEvt, &measCfmEvt);
1143 #if (ERRCLASS & ERRCLS_ADD_RES)
1144 #endif /* ERRCLASS & ERRCLS_ADD_RES */
1145 kwUtlSndUlL2MeasNCfm(tKwCb, measReqEvt, &measCfmEvt);
1146 KW_FREE(tKwCb, measReqEvt, sizeof(KwL2MeasReqEvt))
1151 measType = measReqEvt->measReq.measType;
1153 if((measType != LKW_L2MEAS_DL_IP) &&
1154 (measType != LKW_L2MEAS_ACT_UE) &&
1155 (measType != LKW_L2MEAS_DL_DISC) &&
1156 (measType != LKW_L2MEAS_DL_DELAY) &&
1157 (measType != LKW_L2MEAS_UU_LOSS) &&
1158 (measType != LKW_L2MEAS_UL_IP))/* || (qci > LKW_MAX_QCI)*/
1160 measCfmEvt.transId = measReqEvt->transId;
1161 measCfmEvt.measType = measType;
1162 measCfmEvt.status.status = LCM_PRIM_NOK;
1163 measCfmEvt.status.reason = LKW_CAUSE_INVALID_MEASTYPE;
1164 kwUtlSndDlL2MeasNCfm(tKwCb, measReqEvt, &measCfmEvt);
1165 KW_FREE(tKwCb, measReqEvt, sizeof(KwL2MeasReqEvt))
1169 /* for UL IP throughput meas enable for all QCIs */
1170 if(measType & LKW_L2MEAS_UL_IP)
1172 for(cntr = 0; cntr < LKW_MAX_QCI; cntr++)
1174 tKwCb->u.ulCb->kwL2Cb.measOn[cntr] |= LKW_L2MEAS_UL_IP;
1179 (LKW_L2MEAS_DL_IP | LKW_L2MEAS_DL_DISC |
1180 LKW_L2MEAS_DL_DELAY | LKW_L2MEAS_UU_LOSS))
1182 KwL2MeasReqEvt *measEvt;
1185 udxPst = &(KW_GET_UDX_SAP(tKwCb)->pst);
1187 KW_ALLOC_SHRABL_BUF(udxPst->region,
1190 sizeof(KwL2MeasReqEvt));
1192 #if (ERRCLASS & ERRCLS_ADD_RES) /* KW_FIX */
1193 if(measEvt == NULLP)
1195 RLOG0(L_FATAL,"Memory Allocation failed");
1199 cmMemcpy((Void*)measEvt, (Void*)measReqEvt, sizeof(KwL2MeasReqEvt));
1200 /*Redirect the request to DL task */
1201 /* NOTE:As of today, there are no cases where the Req will fail at DL
1202 as long as it reached the DL, so we don't wait for a confirmation from
1203 DL to send the confirmation to LM*/
1204 /* The interface for sending a confirmation back does not exist today;
1205 it needs to be created when the need arises */
1206 KwUlUdxL2MeasReq(&(KW_GET_UDX_SAP(tKwCb)->pst),measEvt);
1209 /* We need to copy the transId for sending back confirms later */
1210 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
1212 KwL2MeasEvtCb* measEvtCb = &(tKwCb->u.ulCb->kwL2Cb.kwL2EvtCb[cntr]);
1213 if(measEvtCb->measCb.measType & measType)
1215 measEvtCb->transId= measReqEvt->transId;
1218 /*KW_FREE(tKwCb, measReqEvt, sizeof(KwL2MeasReqEvt));*/
1221 } /* KwMiLkwL2MeasReq */
1225 This function processes L2 Measurement stop request received from the layer manager.
1226 After receving this request, RLC stops L2 Measurement
1227 * @param[in] pst post structure
1228 * @param[in] measType meas Type
1231 * -# Failure : RFAILED
1235 PUBLIC S16 KwMiLkwL2MeasStopReq
1241 PUBLIC S16 KwMiLkwL2MeasStopReq (pst, measType)
1247 KwL2MeasEvtCb *measEvtCb = NULLP;
1253 TRC3(KwMiLkwL2MeasStopReq);
1255 tKwCb = KW_GET_KWCB(pst->dstInst);
1257 /* reset the counter values for the measurement that is stopped */
1258 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
1260 measEvtCb = &(tKwCb->u.ulCb->kwL2Cb.kwL2EvtCb[cntr]);
1261 if(measEvtCb->measCb.measType & measType)
1263 kwUtlResetUlL2MeasInKwRb(tKwCb, &measEvtCb->measCb, measType);
1268 /* for UL IP throughput meas disable for all QCIs */
1269 if(measType & LKW_L2MEAS_UL_IP)
1271 for(cntr = 0; cntr < LKW_MAX_QCI; cntr++)
1273 tKwCb->u.ulCb->kwL2Cb.measOn[cntr] &= ~LKW_L2MEAS_UL_IP;
1277 if((measType & LKW_L2MEAS_DL_IP) || (measType & LKW_L2MEAS_DL_DISC)
1278 || (measType & LKW_L2MEAS_DL_DELAY))
1280 /*Redirect the request to DL task */
1281 KwUlUdxL2MeasStopReq(&(KW_GET_UDX_SAP(tKwCb)->pst),measType);
1284 /*cmMemset((U8*)&measCfmEvt, 0, sizeof(KwL2MeasCfmEvt)); */
1286 status = LCM_PRIM_OK;
1287 KwMiLkwL2MeasStopCfm(&tKwCb->genCfg.lmPst, measType,status);
1293 This function processes L2 Measurement Send request received from the layer manager.
1294 After receving this request, RLC sends L2 Measurement
1295 * @param[in] pst post structure
1296 * @param[in] measType meas Type
1299 * -# Failure : RFAILED
1303 PUBLIC S16 KwMiLkwL2MeasSendReq
1309 PUBLIC S16 KwMiLkwL2MeasSendReq (pst, measType)
1315 KwL2MeasEvtCb *measEvtCb = NULLP;
1318 TRC3(KwMiLkwL2MeasSendReq);
1320 tKwCb = KW_GET_KWCB(pst->dstInst);
1322 /* In case of addition of any new measType here ,appropriate handling
1323 * has to be done in RLC DL (kwUtlSndDlL2MeasCfm)*/
1325 (LKW_L2MEAS_DL_DISC | LKW_L2MEAS_DL_DELAY
1326 | LKW_L2MEAS_UU_LOSS| LKW_L2MEAS_DL_IP))
1328 /*Redirect the request to DL task */
1329 KwUlUdxL2MeasSendReq(&(KW_GET_UDX_SAP(tKwCb)->pst),measType);
1330 /* L2 MEAS AGHOSH */
1334 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
1336 measEvtCb = &(tKwCb->u.ulCb->kwL2Cb.kwL2EvtCb[cntr]);
1337 /* L2 MEAS AGHOSH */
1338 if(measEvtCb->measCb.measType & measType)
1340 kwUtlHdlL2TmrExp(tKwCb, measEvtCb);
1346 #endif /* LTE_L2_MEAS */
1350 * This function configures the RLC data sap
1352 * @param[in] gCb RLC Instance Control Block
1353 * @param[in] cfg RLC LM Sap configuration structure
1356 * -# LCM_REASON_NOT_APPL (SUCCESS)
1357 * -# LCM_REASON_INVALID_SAP
1358 * -# LCM_REASON_MEM_NOAVAIL
1359 * -# LCM_REASON_RECONFIG_FAIL
1362 PRIVATE S16 kwLmmCfgKwuSap
1368 PRIVATE S16 kwLmmCfgKwuSap(gCb,cfg)
1373 KwKwuSapCb *kwuSapCb;
1374 TRC2(kwLmmCfgKwuSap)
1376 #if (ERRCLASS & ERRCLS_INT_PAR)
1377 /* Validate the protocol parameters */
1378 if((cfg->sapId >= (S16)gCb->genCfg.maxKwuSaps) || (cfg->sapId < 0))
1380 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
1382 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1384 kwuSapCb = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL) ?
1385 (KwKwuSapCb*)(gCb->u.dlCb->kwuDlSap + cfg->sapId):
1386 (KwKwuSapCb*)(gCb->u.ulCb->kwuUlSap + cfg->sapId);
1388 #if (ERRCLASS & ERRCLS_INT_PAR)
1389 /* Check for reconfiguration */
1390 if (kwuSapCb->state != KW_SAP_NOT_CFG)
1392 RLOG2(L_ERROR,"RLC Mode [%d] : Invalid kwuSap State [%d]",
1393 gCb->genCfg.rlcMode, kwuSapCb->state);
1394 /* reconfiguration not allowed */
1395 RETVALUE(LCM_REASON_RECONFIG_FAIL);
1397 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1399 /* Fill the parameters */
1400 KW_FILL_SAP_HELPER(kwuSapCb, cfg, gCb);
1402 RETVALUE(LCM_REASON_NOT_APPL);
1407 * This function configures the RLC control sap
1409 * @param[in] gCb RLC Instance Control Block
1410 * @param[in] cfg RLC LM Sap configuration structure
1413 * -# LCM_REASON_NOT_APPL (SUCCESS)
1414 * -# LCM_REASON_INVALID_SAP
1415 * -# LCM_REASON_INVALID_SAP
1416 * -# LCM_REASON_RECONFIG_FAIL
1419 PRIVATE S16 kwLmmCfgCkwSap
1425 PRIVATE S16 kwLmmCfgCkwSap(gCb,cfg)
1432 TRC2(kwLmmCfgCkwSap)
1434 #if (ERRCLASS & ERRCLS_INT_PAR)
1435 /* Validate config parameters */
1436 if ((cfg->sapId >= KW_MAX_CKWSAPS) || (cfg->sapId < 0) )
1438 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
1441 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1443 /* Get Sap control block */
1444 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
1448 ckwSap = &(gCb->u.ulCb->ckwSap);
1450 #if (ERRCLASS & ERRCLS_INT_PAR)
1451 /* Check for reconfiguration */
1452 if(ckwSap->state != KW_SAP_NOT_CFG)
1454 RLOG1(L_ERROR,"Invalid kwuSap State [%d]",ckwSap->state);
1455 RETVALUE(LCM_REASON_RECONFIG_FAIL);
1457 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1459 /* Fill the parameters */
1460 KW_FILL_SAP_HELPER(ckwSap, cfg, gCb);
1462 RETVALUE(LCM_REASON_NOT_APPL);
1467 * This function configures the UDX sap
1469 * @param[in] gCb RLC Instance Control Block
1470 * @param[in] cfg RLC LM Sap configuration structure
1473 * -# LCM_REASON_NOT_APPL (SUCCESS)
1474 * -# LCM_REASON_INVALID_SAP
1475 * -# LCM_REASON_INVALID_SAP
1476 * -# LCM_REASON_RECONFIG_FAIL
1479 PRIVATE S16 kwLmmCfgUdxSap
1485 PRIVATE S16 kwLmmCfgUdxSap(gCb,cfg)
1490 KwUdxDlSapCb *udxDlSap;
1491 KwUdxUlSapCb *udxUlSap;
1493 TRC2(kwLmmCfgUdxSap);
1495 #if (ERRCLASS & ERRCLS_INT_PAR)
1496 /* Validate the protocol parameters */
1497 if((cfg->sapId >= KW_MAX_UDXSAPS) || (cfg->sapId < 0))
1499 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
1502 /* Get Sap control block */
1503 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1505 udxDlSap = (gCb->u.dlCb->udxDlSap + cfg->sapId);
1506 #if (ERRCLASS & ERRCLS_INT_PAR)
1507 /* Check for reconfiguration */
1508 if(udxDlSap->state != KW_SAP_NOT_CFG)
1510 RLOG1(L_ERROR,"Invalid udxDlSap State [%d]",udxDlSap->state);
1511 RETVALUE(LCM_REASON_RECONFIG_FAIL);
1513 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1515 /* Fill the parameters */
1516 KW_FILL_SAP_HELPER(udxDlSap, cfg, gCb);
1520 udxUlSap = (gCb->u.ulCb->udxUlSap + cfg->sapId);
1522 #if (ERRCLASS & ERRCLS_INT_PAR)
1523 /* Check for reconfiguration */
1524 if(udxUlSap->state != KW_SAP_NOT_CFG)
1526 RLOG1(L_ERROR,"Invalid udxUlSap State [%d]", udxUlSap->state);
1527 RETVALUE(LCM_REASON_RECONFIG_FAIL);
1529 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1531 /* Fill the parameters */
1532 KW_FILL_SAP_HELPER(udxUlSap, cfg, gCb);
1534 udxUlSap->bndTmrInt = cfg->bndTmrIntvl;
1535 udxUlSap->retryCnt = 0;
1536 cmInitTimers(&(udxUlSap->bndTmr), 1);
1539 RETVALUE(LCM_REASON_NOT_APPL);
1544 * This function configures the RGU sap
1546 * @param[in] gCb RLC Instance Control Block
1547 * @param[in] cfg RLC LM Sap configuration structure
1549 * -# LCM_REASON_NOT_APPL (SUCCESS)
1550 * -# LCM_REASON_INVALID_SAP
1551 * -# LCM_REASON_INVALID_SAP
1552 * -# LCM_REASON_RECONFIG_FAIL
1555 PRIVATE S16 kwLmmCfgRguSap
1561 PRIVATE S16 kwLmmCfgRguSap(gCb,cfg)
1568 TRC2(kwLmmCfgRguSap);
1570 #if (ERRCLASS & ERRCLS_INT_PAR)
1571 /* Validate the protocol parameters */
1572 if((cfg->sapId >= gCb->genCfg.maxRguSaps) || \
1575 KWLOGERROR(gCb,ERRCLS_INT_PAR, EKW047, (ErrVal)cfg->sapId,
1576 "kwLmmCfgRguSap: Invalid RGU sapId\n");
1577 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
1581 rguSap = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL) ?
1582 &(gCb->u.dlCb->rguDlSap[cfg->sapId]): &(gCb->u.ulCb->rguUlSap[cfg->sapId]);
1584 #if (ERRCLASS & ERRCLS_INT_PAR)
1585 /* Check for reconfiguration */
1586 if(rguSap->state != KW_SAP_NOT_CFG)
1588 RLOG2(L_ERROR,"RLC Mode [%d]: Invalid rguSap State [%d]",
1589 gCb->genCfg.rlcMode, rguSap->state);
1590 RETVALUE(LCM_REASON_RECONFIG_FAIL);
1592 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1594 /* Fill the parameters */
1595 KW_FILL_SAP_HELPER(rguSap, cfg, gCb);
1596 rguSap->suId = cfg->sapId;
1597 rguSap->bndTmrInt = cfg->bndTmrIntvl;
1598 rguSap->retryCnt = 0;
1599 rguSap->state = KW_SAP_CFG;
1601 cmInitTimers(&(rguSap->bndTmr), 1);
1603 RETVALUE(LCM_REASON_NOT_APPL);
1608 * Validates the RLC general control parameters
1610 * @param[in] cntrl RLC LM structure
1613 * -# LCM_REASON_NOT_APPL (SUCCESS)
1614 * -# LCM_REASON_INVALID_SUBACTION
1615 * -# LCM_REASON_INVALID_ACTION
1618 PRIVATE S16 kwLmmValidateGenCntrl
1623 PRIVATE S16 kwLmmValidateGenCntrl(cntrl)
1627 S16 reason; /* reason for failure */
1628 U8 sAction; /* subaction field */
1630 TRC2(kwLmmValidateGenCntrl);
1632 reason = LCM_REASON_NOT_APPL;
1633 sAction = cntrl->t.cntrl.subAction;
1635 switch (cntrl->t.cntrl.action)
1639 if ((sAction != SAUSTA) &&
1640 (sAction != SADBG) &&
1643 reason = LCM_REASON_INVALID_SUBACTION;
1649 reason = LCM_REASON_INVALID_ACTION;
1658 * it deregisters the timers and deregisters the kwuSap Control blocks
1660 * @param[in] gCb RLC Instance Control Block
1665 PRIVATE Void kwLmmCleanGblRsrcs
1670 PRIVATE Void kwLmmCleanGblRsrcs(gCb)
1677 TRC2(kwLmmCleanGblRsrcs)
1679 if (gCb->init.cfgDone)
1681 /* Deregister the timers */
1682 /*Pradeep: changing the SDeregTmrMt() to SDeregTmr*/
1683 (Void) SDeregTmrMt(gCb->init.ent, gCb->init.inst,
1684 (S16)gCb->genCfg.timeRes, kwActvTmr);
1685 /*(Void) SDeregTmr(gCb->init.ent, gCb->init.inst,
1686 (S16)gCb->genCfg.timeRes, kwActvTmr);*/
1688 kwSapSize = (Size)(gCb->genCfg.maxKwuSaps * sizeof(KwKwuSapCb));
1690 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1692 kwUdxSapSize = (Size)(gCb->genCfg.maxUdxSaps * sizeof(KwUdxDlSapCb));
1695 gCb->u.dlCb->shutdownReceived = TRUE;
1696 kwUtlFreeDlMemory(gCb);
1697 if (gCb->u.dlCb->kwuDlSap != NULLP)
1699 KW_FREE(gCb,gCb->u.dlCb->kwuDlSap, kwSapSize);
1702 if(gCb->u.dlCb->udxDlSap != NULLP)
1704 KW_FREE(gCb,gCb->u.dlCb->udxDlSap, kwUdxSapSize);
1707 if(gCb->u.dlCb->rguDlSap != NULLP)
1709 KW_FREE(gCb,gCb->u.dlCb->rguDlSap, gCb->genCfg.maxRguSaps);
1710 gCb->genCfg.maxRguSaps = 0;
1712 if (gCb->u.dlCb->shutdownReceived)
1714 if (gCb->u.dlCb->selfPstMBuf != NULL)
1716 SPutMsg(gCb->u.dlCb->selfPstMBuf);
1718 KW_FREE(gCb,gCb->u.dlCb, sizeof (KwDlCb));
1725 kwUdxSapSize = (Size)(gCb->genCfg.maxUdxSaps * sizeof(KwUdxUlSapCb));
1728 if (gCb->u.ulCb->kwuUlSap != NULLP)
1730 KW_FREE(gCb,gCb->u.ulCb->kwuUlSap, kwSapSize);
1733 if(gCb->u.ulCb->udxUlSap != NULLP)
1735 KW_FREE(gCb,gCb->u.ulCb->udxUlSap, kwUdxSapSize);
1738 if(gCb->u.ulCb->rguUlSap != NULLP)
1740 KW_FREE(gCb,gCb->u.ulCb->rguUlSap, gCb->genCfg.maxRguSaps);
1741 gCb->genCfg.maxRguSaps = 0;
1744 KW_FREE(gCb,gCb->u.ulCb, sizeof (KwUlCb));
1748 gCb->init.cfgDone = FALSE;
1749 gCb->init.acnt = FALSE;
1750 gCb->init.trc = FALSE;
1752 gCb->init.usta = FALSE;
1760 * Delete all SAPs and Control Blocks
1763 * Shutdown of RLC happens at modules level, tm, um and am modules will be
1764 * shutdown using utility functin and dbm shutdown will clean up the SAPs,
1765 * control blocks and lists.
1767 * @params[in] gCb RLC instance control block
1770 * -# LCM_REASON_NOT_APPL (SUCCESS)
1771 * -# LCM_REASON_HASHING_FAILED
1774 PRIVATE S16 kwLmmShutdown
1779 PRIVATE S16 kwLmmShutdown(gCb)
1788 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1790 for (idx = 0; idx < gCb->genCfg.maxRguSaps; idx++)
1792 rguSap = &(gCb->u.dlCb->rguDlSap[idx]);
1793 if ((rguSap->state == KW_SAP_BND) || (rguSap->state == KW_SAP_BINDING))
1795 KwLiRguUbndReq(&(rguSap->pst), rguSap->spId, 0);
1801 for (idx = 0; idx < gCb->genCfg.maxRguSaps; idx++)
1803 rguSap = &(gCb->u.ulCb->rguUlSap[idx]);
1804 if ((rguSap->state == KW_SAP_BND) || (rguSap->state == KW_SAP_BINDING))
1806 KwLiRguUbndReq(&(rguSap->pst), rguSap->spId, 0);
1811 if(gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1813 kwDbmDlShutdown(gCb);
1817 kwDbmUlShutdown(gCb);
1820 kwLmmCleanGblRsrcs(gCb);
1822 KW_MEM_SET (&(gCb->genSts), 0, sizeof (KwGenSts));
1824 RETVALUE(LCM_REASON_NOT_APPL);
1829 * Function processes the general control request
1831 * @param[in] gCb RLC instance control block
1832 * @param[in] cntrl RLC LM structure
1835 * -# LCM_REASON_NOT_APPL (SUCCESS)
1836 * -# LCM_REASON_INVALID_SUBACTION
1837 * -# LCM_REASON_INVALID_ACTION
1840 PRIVATE S16 kwLmmGenCntrl
1846 PRIVATE S16 kwLmmGenCntrl(gCb,cntrl)
1851 KwTrcCntrl *trcCntrl; /* trace */
1853 KwDbgCntrl *dbgCntrl; /* debug */
1855 S16 reason; /* reason for failure */
1857 TRC2(kwLmmGenCntrl);
1859 /* Validate control parameters */
1860 reason = kwLmmValidateGenCntrl (cntrl);
1862 if (reason != LCM_REASON_NOT_APPL)
1867 switch(cntrl->t.cntrl.action)
1871 switch(cntrl->t.cntrl.subAction)
1875 KW_SET_USTA_FLAG(gCb, TRUE);
1881 dbgCntrl = &cntrl->t.cntrl.s.dbgCntrl;
1882 KW_GET_DBG_MASK(gCb) |= dbgCntrl->dbgMask;
1888 trcCntrl = &cntrl->t.cntrl.s.trcCntrl;
1889 gCb->init.trc = TRUE;
1890 gCb->trcLen = trcCntrl->trcLen;
1891 (gCb->trcMask) |= trcCntrl->trcMask;
1899 switch(cntrl->t.cntrl.subAction)
1903 gCb->init.usta = FALSE;
1909 dbgCntrl = &cntrl->t.cntrl.s.dbgCntrl;
1910 KW_GET_DBG_MASK(gCb) &= ~(dbgCntrl->dbgMask);
1916 trcCntrl = &cntrl->t.cntrl.s.trcCntrl;
1917 gCb->init.trc = FALSE;
1918 gCb->trcMask &= ~(trcCntrl->trcMask);
1926 reason = kwLmmShutdown(gCb);
1935 * Bind/Unbind RLC UDX sap
1937 * @param[in] gCb RLC Instance Control Block
1938 * @param[in] cntrl RLC LM structure
1941 * -# LCM_REASON_NOT_/PPL (SUCCESS)
1942 * -# LCM_REASON_INVALID_SAP
1943 * -# LCM_REASON_INVALID_STATE
1944 * -# LCM_REASON_INVALID_ACTION
1947 PRIVATE S16 kwLmmUdxSapCntrl
1953 PRIVATE S16 kwLmmUdxSapCntrl(gCb,cntrl)
1958 TRC2(kwLmmUdxSapCntrl)
1960 #if (ERRCLASS & ERRCLS_INT_PAR)
1961 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
1963 RETVALUE(LCM_REASON_INVALID_SAP);
1966 if((cntrl->t.cntrl.s.sapCntrl.suId < 0) ||
1967 (cntrl->t.cntrl.s.sapCntrl.suId >= KW_MAX_UDXSAPS))
1969 RETVALUE(LCM_REASON_INVALID_SAP);
1971 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1973 #define UDX_SAP gCb->u.ulCb->udxUlSap[cntrl->t.cntrl.s.sapCntrl.suId]
1974 #if (ERRCLASS & ERRCLS_INT_PAR)
1976 if(UDX_SAP.state == KW_SAP_NOT_CFG)
1978 RLOG0(L_ERROR,"udxUlSap not configured yet");
1979 RETVALUE(LCM_REASON_INVALID_STATE);
1981 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1983 switch(cntrl->t.cntrl.action)
1987 if(UDX_SAP.state != KW_SAP_BND)
1989 /* start timer to wait for bind confirm */
1990 kwStartTmr(gCb,(PTR)(&UDX_SAP), KW_EVT_WAIT_BNDCFM);
1991 UDX_SAP.state = KW_SAP_BINDING;
1992 KwUlUdxBndReq(&(UDX_SAP.pst), UDX_SAP.suId, UDX_SAP.spId);
1996 /* control request received for an already bound SAP */
1997 RETVALUE(LCM_REASON_INVALID_STATE);
2003 /* make the state of UDXSAP configured but not bound */
2004 UDX_SAP.state = KW_SAP_CFG;
2005 KwUlUdxUbndReq(&(UDX_SAP.pst), UDX_SAP.spId, 0);
2009 RETVALUE(LCM_REASON_INVALID_ACTION);
2011 } /* end of switch */
2013 RETVALUE(LCM_REASON_NOT_APPL);
2018 * Bind/Unbind RLC lower sap
2020 * @param[in] gCb RLC Instance Control Block
2021 * @param[in] cntrl RLC LM structure
2023 * -# LCM_REASON_NOT_APPL (SUCCESS)
2024 * -# LCM_REASON_INVALID_SAP
2025 * -# LCM_REASON_INVALID_STATE
2026 * -# LCM_REASON_INVALID_ACTION
2029 PRIVATE S16 kwLmmLSapCntrl
2035 PRIVATE S16 kwLmmLSapCntrl(gCb,cntrl)
2040 KwRguSapCb *rguSap; /* rgu sap pointer */
2042 TRC2(kwLmmLSapCntrl)
2044 #if (ERRCLASS & ERRCLS_INT_PAR)
2046 if((cntrl->t.cntrl.s.sapCntrl.suId < 0) ||
2047 (cntrl->t.cntrl.s.sapCntrl.suId >= gCb->genCfg.maxRguSaps))
2049 KWLOGERROR(gCb,ERRCLS_INT_PAR, EKW047, (ErrVal)cntrl->t.cntrl.s.sapCntrl.suId,
2050 "kwLmmLSapCntrl: Invalid RGU suId\n");
2051 RETVALUE(LCM_REASON_INVALID_SAP);
2053 #endif /* ERRCLASS & ERRCLS_INT_PAR */
2054 rguSap = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL) ?
2055 &(gCb->u.dlCb->rguDlSap[cntrl->t.cntrl.s.sapCntrl.suId]): \
2056 &(gCb->u.ulCb->rguUlSap[cntrl->t.cntrl.s.sapCntrl.suId]);
2058 #if (ERRCLASS & ERRCLS_INT_PAR)
2060 if(rguSap->state == KW_SAP_NOT_CFG)
2062 RLOG1(L_ERROR,"RLC Mode [%d]:rguSap not configured yet", gCb->genCfg.rlcMode);
2063 RETVALUE(LCM_REASON_INVALID_STATE);
2065 #endif /* ERRCLASS & ERRCLS_INT_PAR */
2067 switch(cntrl->t.cntrl.action)
2071 if(rguSap->state != KW_SAP_BND)
2073 /* start timer to wait for bind confirm */
2074 kwStartTmr(gCb,(PTR)(rguSap), KW_EVT_WAIT_BNDCFM);
2075 rguSap->state = KW_SAP_BINDING;
2076 rguSap->spId = cntrl->t.cntrl.s.sapCntrl.spId;
2077 rguSap->suId = cntrl->t.cntrl.s.sapCntrl.suId;
2078 KwLiRguBndReq(&(rguSap->pst), rguSap->suId, rguSap->spId);
2082 /* control request received for an already bound SAP */
2083 RETVALUE(LCM_REASON_INVALID_STATE);
2089 /* make the state of RGUSAP is configure but not bound */
2090 rguSap->state = KW_SAP_CFG;
2091 KwLiRguUbndReq(&(rguSap->pst), rguSap->spId, 0);
2095 RETVALUE(LCM_REASON_INVALID_ACTION);
2097 } /* end of switch */
2099 RETVALUE(LCM_REASON_NOT_APPL);
2104 * Function gather the general KWU SAP status
2106 * @param[in] gCb RLC Instance Control Block
2107 * @param[in] sta LM KWU Sap Status structure
2110 * -# LCM_REASON_NOT_APPL (SUCCESS)
2111 * -# LCM_REASON_INVALID_PAR_VAL(FAILURE)
2114 PRIVATE S16 kwLmmGetKwuSapSta
2120 PRIVATE S16 kwLmmGetKwuSapSta(gCb,sta)
2125 KwKwuSapCb *kwSapCb;
2127 TRC2(kwLmmGetKwuSapSta);
2129 #if (ERRCLASS & ERRCLS_INT_PAR)
2130 /* Validate the protocol parameters */
2131 if ((sta->spId >= (S16)gCb->genCfg.maxKwuSaps)||
2134 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2138 /* Get Sap control block */
2139 kwSapCb = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)?
2140 (KwKwuSapCb*)(gCb->u.dlCb->kwuDlSap + sta->spId):
2141 (KwKwuSapCb*)(gCb->u.ulCb->kwuUlSap + sta->spId);
2143 sta->state = kwSapCb->state;
2145 RETVALUE(LCM_REASON_NOT_APPL);
2150 * Function gather the general RGU SAP status
2152 * @param[in] gCb RLC Instance Control Block
2153 * @param[in] sta LM RGU Sap Status structure
2155 * -# LCM_REASON_NOT_APPL (SUCCESS)
2156 * -# LCM_REASON_INVALID_PAR_VAL(FAILURE)
2159 PRIVATE S16 kwLmmGetRguSapSta
2165 PRIVATE S16 kwLmmGetRguSapSta(gCb,sta)
2170 TRC2(kwLmmGetRguSapSta);
2172 #if (ERRCLASS & ERRCLS_INT_PAR)
2173 /* Validate the protocol parameters */
2174 if((sta->suId >= KW_MAX_RGUSAPS) || (sta->suId < 0))
2176 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2180 sta->state = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL) ?
2181 gCb->u.dlCb->rguDlSap[sta->suId].state :
2182 gCb->u.ulCb->rguUlSap[sta->suId].state ;
2184 RETVALUE(LCM_REASON_NOT_APPL);
2189 * Function gather the general CKW SAP status
2191 * @param[in] gCb RLC Instance Control Block
2192 * @param[in] sta LM CKW Sap Status structure
2194 * -# LCM_REASON_NOT_APPL (SUCCESS)
2195 * -# LCM_REASON_INVALID_PAR_VAL(FAILURE)
2198 PRIVATE S16 kwLmmGetCkwCntSapSta
2204 PRIVATE S16 kwLmmGetCkwCntSapSta(gCb,sta)
2206 KwCkwCntSapSta *sta;
2209 TRC2(kwLmmGetCkwCntSapSta);
2211 #if (ERRCLASS & ERRCLS_INT_PAR)
2212 /* Validate config parameters */
2213 if ((sta->spId >= KW_MAX_CKWSAPS ) ||
2215 (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL))
2217 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2220 sta->state = gCb->u.ulCb->ckwSap.state;
2222 RETVALUE(LCM_REASON_NOT_APPL);
2228 * Gather the general statistics
2230 * @param[in] gCb RLC Instance Control Block
2231 * @param[in] sts LM general statistics structure
2232 * @param[in] action action
2234 * -# LCM_REASON_NOT_APPL (SUCCESS)
2235 * -# LCM_REASON_INVALID_PAR_VAL(FAILURE)
2238 PRIVATE S16 kwLmmGetGenSts
2245 PRIVATE S16 kwLmmGetGenSts(gCb,sts, action)
2251 TRC2(kwLmmGetGenSts);
2253 #if (ERRCLASS & ERRCLS_INT_PAR)
2254 /* Validate protocol parameters */
2255 if ((action != LKW_ZEROSTS) && (action != LKW_NOZEROSTS))
2257 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2263 if(action == LKW_ZEROSTS)
2265 KW_MEM_SET (&(gCb->genSts), 0, sizeof (KwGenSts));
2268 RETVALUE(LCM_REASON_NOT_APPL);
2273 * Gather the SAP statistics
2275 * @param[in] gCb RLC Instance Control Block
2276 * @param[in] sts LM general statistics structure
2277 * @param[in] elmnt element
2278 * @param[in] action action
2281 * -# LCM_REASON_NOT_APPL (SUCCESS)
2282 * -# LCM_REASON_INVALID_PAR_VAL (FAIL)
2285 PRIVATE S16 kwLmmGetSapSts
2293 PRIVATE S16 kwLmmGetSapSts(sts, elmnt, action)
2300 TRC2(kwLmmGetSapSts);
2302 /* Validate protocol parameters */
2303 if (action != LKW_ZEROSTS && action != LKW_NOZEROSTS)
2305 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2311 KwKwuSapSts *kwuSap;
2312 KwKwuSapCb *kwuSapCb;
2313 kwuSap = &sts->t.sts.s.kwuSap;
2315 /* Get Sap control block */
2316 /* kw005.201, modified the element of kwuSap from suId to spId */
2317 kwuSapCb = (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)?
2318 (KwKwuSapCb*)(gCb->u.dlCb->kwuDlSap + kwuSap->spId):
2319 (KwKwuSapCb*)(gCb->u.ulCb->kwuUlSap + kwuSap->spId);
2322 *kwuSap = kwuSapCb->sts;
2324 if (action == LKW_ZEROSTS)
2326 KW_MEM_SET (&kwuSapCb->sts, 0, sizeof (KwKwuSapSts));
2330 /* kw005.201 removed RGUSAP statistics support */
2333 KwCkwCntSts *ckwSap;
2334 ckwSap = &sts->t.sts.s.ckwSap;
2335 if (gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
2337 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2340 ckwSap->statMsgs = gCb->u.ulCb->ckwSap.sts.statMsgs;
2342 if (action == LKW_ZEROSTS)
2344 KW_MEM_SET (&(gCb->u.ulCb->ckwSap.sts), 0, sizeof (KwCkwCntSts));
2349 RETVALUE(LCM_REASON_INVALID_ELMNT);
2352 SGetDateTime(&sts->t.sts.dt);
2354 RETVALUE(LCM_REASON_NOT_APPL);
2359 * This function sends Unsolicited Status Indication to the Layer Management
2362 * @param[in] gCb RLC Instance Control Block
2363 * @param[in] category Category
2364 * @param[in] event event
2365 * @param[in] cause cause
2366 * @param[in] UeId ueId
2367 * @param[in] Qci qci
2373 PUBLIC Void kwLmmSendAlarm
2384 PUBLIC Void kwLmmSendAlarm(category, event, cause, suId, ueId, qci)
2393 #else /* LTE_L2_MEAS */
2395 PUBLIC Void kwLmmSendAlarm
2405 PUBLIC Void kwLmmSendAlarm(category, event, cause, suId, ueId)
2413 #endif /* LTE_L2_MEAS */
2415 KwMngmt usta; /* Rlc Management Structure */
2417 TRC2(kwLmmSendAlarm);
2419 if(gCb->init.usta == FALSE)
2424 usta.hdr.elmId.elmnt = STGEN;
2425 usta.hdr.entId.ent = gCb->init.ent;
2426 usta.hdr.entId.inst = gCb->init.inst;
2428 /* fill in the event and category */
2429 usta.t.usta.alarm.category = category;
2430 usta.t.usta.alarm.event = event;
2431 usta.t.usta.alarm.cause = cause;
2433 /* set the suId and ueId */
2434 usta.t.usta.ueId = ueId;
2435 usta.t.usta.suId = suId;
2436 /* kw005.201 added support for L2 Measurement */
2438 if(event == LKW_EVT_MEAS_HALT)
2440 usta.t.usta.qci = qci;
2442 #endif /* LTE_L2_MEAS */
2443 /* update the date and time */
2444 (Void) SGetDateTime(&usta.t.usta.alarm.dt);
2446 KwMiLkwStaInd(&(gCb->init.lmPst), &usta);
2454 * This function sends trace indication to LM
2456 * @param[in] gCb RLC Instance Control Block
2457 * @param[in] event event
2458 * @param[in] mBuf meessage buffer
2465 PUBLIC S16 kwLmmSendTrc
2472 PUBLIC S16 kwLmmSendTrc(gCb,event, mBuf)
2478 KwMngmt trc; /* RLC management control block */
2487 RLOG2(L_DEBUG, "kwLmmSendTrc(): Trace for event=%d, gCb->trcLen=%d",
2491 cmMemset((U8 *)&trc, 0, sizeof(KwMngmt));
2493 pst = gCb->init.lmPst;
2495 trc.t.trc.event = event;
2496 SGetDateTime(&trc.t.trc.dt);
2497 trc.cfm.status = LCM_PRIM_OK;
2498 trc.cfm.reason = LCM_REASON_NOT_APPL;
2502 /* Check if the whole buffer is to be sent in Trace indication */
2503 if(gCb->trcLen == LKW_FULL_TRACE)
2505 if (SCpyMsgMsg(mBuf, pst.region, pst.pool, &dstMbuf)
2508 /* rg005.201 removed SPutSBuf on error */
2509 RLOG0(L_ERROR,"SCpyMsgMsg Failed");
2512 /* Send Trace Indication to Layer manager */
2513 KwMiLkwTrcInd(&pst, &trc, dstMbuf);
2515 /* check if only a specified number of bytes are to be sent */
2516 else if(gCb->trcLen > 0)
2518 /* Get the length of the recvd message buffer */
2519 if (SFndLenMsg(mBuf, &bufLen) != ROK)
2521 RLOG0(L_ERROR,"SFndLenMsg Failed");
2524 /* Check if the recvd buffer size is less than request trace len */
2525 if(bufLen < gCb->trcLen)
2527 /* Copy the whole of the recvd buffer in trace indication */
2529 if (SCpyMsgMsg(mBuf, pst.region, pst.pool, &dstMbuf)
2532 RLOG0(L_ERROR,"SCpyMsgMsg Failed");
2536 /* Send Trace Indication to Layer manager */
2537 KwMiLkwTrcInd(&pst, &trc, dstMbuf);
2541 /* if the recvd buffer size is greater than request trace len */
2542 /* Get a temporary buffer to store the msg */
2543 KW_ALLOC(gCb,tempBuf, gCb->trcLen);
2545 #if (ERRCLASS & ERRCLS_INT_PAR)
2546 if(tempBuf == NULLP)
2548 (Void) SPutSMem(KW_GET_MEM_REGION(gCb), KW_GET_MEM_POOL(gCb));
2550 RLOG0(L_FATAL,"Memory Allocation failed");
2551 RETVALUE(LCM_REASON_MEM_NOAVAIL);
2553 #endif /* ERRCLASS & ERRCLS_INT_PAR */
2555 /* Copy trcLen nos of bytes from the recvd message */
2556 if (SCpyMsgFix(mBuf,0,gCb->trcLen,tempBuf,&tempCnt) != ROK)
2558 RLOG0(L_ERROR,"SCpyMsgFix Failed");
2562 if (SGetMsg(pst.region, pst.pool, &dstMbuf) != ROK)
2564 RLOG0(L_FATAL,"Memory Allocation failed");
2567 /* Copy the tempBuf data to dst mBuf */
2568 if (SCpyFixMsg(tempBuf,dstMbuf,0,gCb->trcLen,&tempCnt) != ROK)
2570 RLOG0(L_ERROR,"SCpyMsgFix Failed");
2574 /* Free the memory allocated for tempBuf */
2575 KW_FREE(gCb,tempBuf, gCb->trcLen);
2576 /* Send Trace Indication to Layer manager */
2577 KwMiLkwTrcInd(&pst, &trc, dstMbuf);
2583 KwMiLkwTrcInd(&pst, &trc, mBuf);
2592 * Activate Task - timer
2595 * Invoked by system services to activate a task with a timer tick.
2597 * @param[in] ent entity
2598 * @param[in] inst instance
2607 PUBLIC S16 kwActvTmr
2613 PUBLIC S16 kwActvTmr(ent,inst)
2621 if (inst >= KW_MAX_RLC_INSTANCES)
2625 gCb = KW_GET_KWCB(inst);
2626 cmPrcTmr(&(gCb->kwTqCp), gCb->kwTq, (PFV) kwTmrExpiry);
2629 } /* end of kwActvTmr */
2632 /********************************************************************30**
2635 **********************************************************************/