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 - PDCP - 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="PDCP";
42 static int RLOG_FILE_ID=135;
43 static int RLOG_MODULE_ID=1024;
46 @brief PDCP Layer Manager Module
50 /* header (.h) include files */
51 #include "envopt.h" /* environment options */
52 #include "envdep.h" /* environment dependent */
53 #include "envind.h" /* environment independent */
55 #include "gen.h" /* general */
56 #include "ssi.h" /* system services */
57 #include "cm5.h" /* common timer defines */
58 #include "cm_tkns.h" /* common tokens defines */
59 #include "cm_mblk.h" /* common memory allocation library defines */
60 #include "cm_llist.h" /* common link list defines */
61 #include "cm_hash.h" /* common hash list defines */
62 #include "cm_lte.h" /* common LTE defines */
64 #include "lpj.h" /* LPJ defines */
65 #include "cpj.h" /* CPJ defines */
66 #include "pju.h" /* PJU defines */
68 #include "pj_err.h" /* Err defines */
69 #include "pj_env.h" /* PDCP environment options */
70 #include "pj.h" /* PDCP defines */
73 /* extern (.x) include files */
74 #include "gen.x" /* general */
75 #include "ssi.x" /* system services */
77 #include "cm5.x" /* common timer library */
78 #include "cm_tkns.x" /* common tokens */
79 #include "cm_mblk.x" /* common memory allocation */
80 #include "cm_llist.x" /* common link list */
81 #include "cm_hash.x" /* common hash list */
82 #include "cm_lte.x" /* common LTE includes */
83 #include "cm_lib.x" /* common memory allocation library */
85 #include "lpj.x" /* LPJ */
86 #include "cpj.x" /* CPJ */
87 #include "pju.x" /* PJU */
98 #endif /* CPLUSPLUS */
100 EXTERN S16 pjGetSId ARGS((SystemId *s));
103 #endif /* CPLUSPLUS */
106 PDCPStats gPdcpStats;
108 #ifdef TENB_AS_SECURITY
113 /*********************************************************************
114 * Forward Declaration of LPJ Porting Functions
115 ********************************************************************/
116 PUBLIC PjCb *pjCb[PJ_MAX_PDCP_INSTANCES];
117 EXTERN S16 pjActvTmr ARGS ((Ent ent, Inst inst));
119 PRIVATE S16 pjLmmSendCfm ARGS ((Pst *pst,PjMngmt *cfm,U8 type,Header *hdr));
120 PRIVATE S16 pjLmmGenCfg ARGS ((PjCb *gCb,PjGenCfg *cfg));
121 PRIVATE S16 pjLmmPjuSapCfg ARGS ((PjCb *gCb,PjSapCfg *cfg));
122 PRIVATE S16 pjLmmKwuSapCfg ARGS ((PjCb *gCb,PjSapCfg *cfg));
123 PRIVATE S16 pjLmmUdxSapCfg ARGS ((PjCb *gCb,PjSapCfg *cfg));
124 PRIVATE S16 pjLmmCpjSapCfg ARGS ((PjCb *gCb,PjSapCfg *cfg));
125 PRIVATE S16 pjLmmGenCntrl ARGS ((PjCb *gCb,PjMngmt *cntrl));
126 PRIVATE S16 pjLmmUdxSapCntrl ARGS ((PjCb *gCb,PjMngmt *cntrl));
127 PRIVATE S16 pjLmmLSapCntrl ARGS ((PjCb *gCb,PjMngmt *cntrl));
128 PRIVATE S16 pjLmmFormLmCfm ARGS ((Pst *pst, Header *hdr, Reason reason));
129 PRIVATE S16 pjLmmGetPjuSapSta ARGS ((PjCb *gCb,PjPjuSapSta *sta));
130 PRIVATE S16 pjLmmGetKwuSapSta ARGS ((PjCb *gCb,PjKwuSapSta *sta));
131 PRIVATE S16 pjLmmGetUdxSapSta ARGS ((PjCb *gCb,PjUdxSapSta *sta));
132 PRIVATE S16 pjLmmGetCpjSapSta ARGS ((PjCb *gCb,PjCpjSapSta *sta));
133 PRIVATE S16 pjLmmGetGenSts ARGS ((PjCb *gCb,PjGenSts *sts,Action action));
134 PRIVATE S16 pjLmmGetSapSts ARGS ((PjCb *gCb,PjMngmt *sts,Elmnt elmnt,Action action));
135 PRIVATE Void pjLmmCleanGblRsrcs ARGS ((PjCb *gCb));
137 /*********************************************************************
138 * Primitives for LPJ interface
139 ********************************************************************/
142 Stores the general PDCP configuration. It calculates the
143 memory requirement and reserves it. It also initializes the
144 control blocks, the hash lists and registers the timers. In
145 case of error it rolls back and reports error in the confirm.
146 If the general configuration is already done it is treated as
147 reconfiguration, but right now reconfiguration is not supported.
149 * @param[in] cfm PDCP LM general config structure
151 * -# Success : LCM_REASON_NOT_APPL
152 * -# Failure : LCM_REASON_MEM_NOAVAIL
153 * LCM_REASON_REGTMR_FAIL
154 * LCM_REASON_INVALID_PAR_VAL
155 * LCM_REASON_HASHING_FAILED
158 PRIVATE S16 pjLmmGenCfg
164 PRIVATE S16 pjLmmGenCfg(gCb, cfg)
179 if(cfg->maxUe > PJ_MAX_UE)
181 #if (ERRCLASS & ERRCLS_INT_PAR)
182 RLOG2(L_ERROR, "Invalid maxUe : Max [%lu] Received [%lu]",
183 PJ_MAX_UE, cfg->maxUe);
184 #endif /* ERRCLASS & ERRCLS_INT_PAR */
185 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
188 if(cfg->maxPjuSaps > PJ_MAX_PJUSAPS)
190 #if (ERRCLASS & ERRCLS_INT_PAR)
191 RLOG2(L_ERROR, "Invalid maxPjuSaps : Max [%lu] Received [%lu]",
192 PJ_MAX_PJUSAPS, cfg->maxPjuSaps);
193 #endif /* ERRCLASS & ERRCLS_INT_PAR */
194 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
197 if(cfg->maxKwuSaps > PJ_MAX_KWUSAPS)
199 #if (ERRCLASS & ERRCLS_INT_PAR)
200 RLOG2(L_ERROR, "Invalid maxKwuSaps : Max [%lu] Received [%lu]",
201 PJ_MAX_KWUSAPS, cfg->maxKwuSaps);
202 #endif /* ERRCLASS & ERRCLS_INT_PAR */
203 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
206 if(cfg->maxUdxSaps > PJ_MAX_UDXSAPS)
208 #if (ERRCLASS & ERRCLS_INT_PAR)
209 RLOG2(L_ERROR, "Invalid maxUduSaps : Max [%lu] Received [%lu]",
210 PJ_MAX_UDXSAPS, cfg->maxUdxSaps);
211 #endif /* ERRCLASS & ERRCLS_INT_PAR */
212 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
215 if(gCb->init.cfgDone & PJ_LMM_GENCFG_DONE)
217 /* reconfiguration is supported only for obdDiscTmrInt */
218 #if (defined(PJ_SEC_ASYNC) || defined(PJ_CMP_ASYNC))
219 gCb->pjGenCfg.obdTmrInt = cfg->obdTmrInt;
220 gCb->pjGenCfg.obdWtTmrInt = cfg->obdWtTmrInt;
221 #endif /* PJ_SEC_ASYNC || PJ_CMP_ASYNC */
222 RETVALUE(LCM_REASON_NOT_APPL);
225 PJ_MEM_CPY(&(gCb->pjGenCfg), cfg, sizeof(PjGenCfg));
226 #ifdef TENB_AS_SECURITY
227 isSecBatchMode = TRUE;
230 isSecBatchMode = FALSE;
235 /* Timer Queue Control point initialization */
236 pjTqCp = &(gCb->pjTqCp);
237 pjTqCp->tmrLen = PJ_TMR_LEN;
240 /* calculate the memory requirements */
241 pjMemSize += (Size)SBUFSIZE(PJ_UE_LIST_BUCKET_SIZE * sizeof(CmListEnt));
243 /* Cell Hash List Size */
244 pjMemSize += (Size)SBUFSIZE(PJ_CELL_LIST_BUCKET_SIZE * sizeof(CmListEnt));
246 /* Reserve the memory */
247 if(SGetSMem(PJ_GET_MEM_REGION(gCb), pjMemSize,
248 PJ_GET_MEM_POOL_ADDRESS(gCb)) != ROK)
250 RETVALUE(LCM_REASON_MEM_NOAVAIL);
252 cmMemset((U8 *)&gCb->pjTq, 0, sizeof(CmTqType)*PJ_TMR_LEN);
253 cmMemset((U8 *)&gCb->pjTqCp, 0, sizeof(CmTqCp));
254 gCb->pjTqCp.tmrLen = PJ_TMR_LEN;
255 /* Register the timer */
256 if(SRegTmrMt(gCb->init.ent, gCb->init.inst, (U16)cfg->timeRes,
259 (Void) SPutSMem(PJ_GET_MEM_REGION(gCb), PJ_GET_MEM_POOL(gCb));
261 RETVALUE(LCM_REASON_REGTMR_FAIL);
264 /* Timer Initialization */
265 gCb->pjTqCp.tmrLen = PJ_TMR_LEN;
266 for(cnt = 0; cnt < PJ_TMR_LEN; cnt++)
268 gCb->pjTq[cnt].first = NULLP;
269 gCb->pjTq[cnt].tail = NULLP;
273 if (cfg->mode == LPJ_MODE_PDCP_UL)
275 PJ_ALLOC(gCb, gCb->u.ulCb, sizeof(PjUlgCb));
276 if (gCb->u.ulCb == NULLP)
278 RLOG0(L_FATAL, "Memory Allocation failed.");
283 /* Initialize the Ue and Cell hash list */
284 ret = pjDbmUlInit(gCb); /*How would DbmDlInit be called? */
288 RETVALUE(LCM_REASON_HASHING_FAILED);
291 /* Initialize the PJU SAP control blocks */
292 PJ_MEM_SET(&(gCb->u.ulCb->pjuSap[PJ_SRB_SAP]), 0, sizeof(PjPjuSapCb));
293 PJ_MEM_SET(&(gCb->u.ulCb->pjuSap[PJ_DRB_SAP]), 0, sizeof(PjPjuSapCb));
295 /* Initialize the KWU SAP Control blocks */
296 PJ_MEM_SET(&(gCb->u.ulCb->kwuSap), 0, (PJ_MAX_KWUSAPS * sizeof(PjPjuSapCb)));
297 PJ_MEM_SET(&(gCb->u.ulCb->udxUlSap), 0, (PJ_MAX_UDXSAPS * sizeof(PjUdxUlSapCb)));
299 /* Initialize CPJ SAP control block */
300 PJ_MEM_SET(&(gCb->u.ulCb->cpjSap), 0, sizeof(PjCpjSapCb));
302 pjUtlL2MeasUlInit(gCb);
307 PJ_ALLOC(gCb, gCb->u.dlCb, sizeof(PjDlgCb));
308 if (gCb->u.dlCb == NULLP)
310 RLOG0(L_FATAL, "Memory Allocation failed.");
315 /* Initialize the Ue and Cell hash list */
316 ret = pjDbmDlInit(gCb);
319 RETVALUE(LCM_REASON_HASHING_FAILED);
323 /* Initialize the PJU SAP control blocks */
324 PJ_MEM_SET(&(gCb->u.dlCb->pjuSap[PJ_SRB_SAP]), 0, sizeof(PjPjuSapCb));
325 PJ_MEM_SET(&(gCb->u.dlCb->pjuSap[PJ_DRB_SAP]), 0, sizeof(PjPjuSapCb));
327 /* Initialize the KWU SAP Control blocks */
328 PJ_MEM_SET(&(gCb->u.dlCb->kwuSap), 0, (PJ_MAX_KWUSAPS * sizeof(PjPjuSapCb)));
329 PJ_MEM_SET(&(gCb->u.dlCb->udxDlSap), 0, (PJ_MAX_UDXSAPS * sizeof(PjUdxDlSapCb)));
331 pjUtlL2MeasDlInit(gCb);
335 PJ_MEM_CPY(&(gCb->init.lmPst), &cfg->lmPst,
338 gCb->init.lmPst.srcProcId = gCb->init.procId;
339 gCb->init.lmPst.srcEnt = gCb->init.ent;
340 gCb->init.lmPst.srcInst = gCb->init.inst;
341 gCb->init.lmPst.event = EVTNONE;
343 /* pj002.201 For multi core and multi region, no need to reinitiailize the region again .
344 This would be done with pjActvInit from SSI */
345 #if !defined(SS_MULTICORE_SUPPORT) && !defined(SS_M_PROTO_REGION)
346 gCb->init.region = cfg->lmPst.region;
348 gCb->init.pool = cfg->lmPst.pool;
350 gCb->init.cfgDone |= PJ_LMM_GENCFG_DONE;
352 gPoolId = &(gCb->u.dlCb->kwuSap->pst.pool);
354 #ifdef TENB_AS_SECURITY
355 /* Initialize UL fd for interfacing with SPAcc */
356 if (cfg->mode == LPJ_MODE_PDCP_UL)
358 if(PjLibObdUlInitReq(gCb) != ROK)
360 RETVALUE(LCM_REASON_MISC_FAILURE);
365 /* Initialize DL fd for interfacing with SPAcc */
366 if(PjLibObdDlInitReq(gCb) != ROK)
368 RETVALUE(LCM_REASON_MISC_FAILURE);
374 RETVALUE(LCM_REASON_NOT_APPL);
380 * Sends confirmation message to LM Called by Request function
381 * @param[in] pst Post structure
382 * @param[in] cfm PDCP LM structure
383 * @param[in] type type of message
384 * @param[in] hdr message header
389 PRIVATE S16 pjLmmSendCfm
391 Pst *pst, /* Post structure */
392 PjMngmt *cfm, /* PDCP LM structure */
393 U8 type, /* type of message */
394 Header *hdr /* message header */
397 PRIVATE S16 pjLmmSendCfm(pst, cfm, type, hdr)
398 Pst *pst; /* Post structure */
399 PjMngmt *cfm; /* PDCP LM structure */
400 U8 type; /* type of message */
401 Header *hdr; /* message header */
404 Pst rPst; /* Reply post structure */
408 tPjCb = PJ_GET_PJCB(pst->dstInst);
409 PJ_MEM_SET(&rPst, 0, sizeof(Pst));
411 /* reply post structure for confirmation */
412 rPst.srcEnt = tPjCb->init.ent;
413 rPst.srcInst = tPjCb->init.inst;
414 rPst.srcProcId = SFndProcId();
415 rPst.dstEnt = pst->srcEnt;
416 rPst.dstInst = pst->srcInst;
417 rPst.dstProcId = pst->srcProcId;
418 rPst.selector = hdr->response.selector;
419 rPst.prior = hdr->response.prior;
420 rPst.route = hdr->response.route;
421 rPst.region = hdr->response.mem.region;
422 rPst.pool= hdr->response.mem.pool;
424 /* Fill the reply header */
425 PJ_MEM_SET (&cfm->hdr, '\0', sizeof(cfm->hdr));
426 cfm->hdr.elmId.elmnt = hdr->elmId.elmnt;
427 cfm->hdr.entId.ent = tPjCb->init.ent;
428 cfm->hdr.entId.inst = tPjCb->init.inst;
429 cfm->hdr.transId = hdr->transId;
434 PjMiLpjCfgCfm(&rPst,cfm);
437 SGetDateTime(&(cfm->t.cntrl.dt));
438 PjMiLpjCntrlCfm(&rPst,cfm);
441 SGetDateTime(&(cfm->t.sts.dt));
442 PjMiLpjStsCfm(&rPst,0,cfm);
445 SGetDateTime(&(cfm->t.ssta.dt));
446 PjMiLpjStaCfm(&rPst,cfm);
449 #if (ERRCLASS & ERRCLS_INT_PAR)
450 RLOG0(L_ERROR, "Invalid message type");
452 #endif /* ERRCLASS & ERRCLS_INT_PAR */
462 This function processes configuration requests received from the layer manager.
463 The configuration requests can be for general configuration, or configuration
464 of PJU, and CPJ SAPs. The type of the configuration request can be determined
465 from the elmId field in the header of the layer manager message.This function
466 is called by the layer manager to configure PDCP.
468 This function implements the following logic: \n
470 - switch (cfg->hdr.elmId.elmnt)
472 - update the genCfg field in RlCb;
473 - allocate the maximum static memory required by the PDCP product;
474 - register the timer service by calling SReqTmr;
475 - set CfgDone for not configuring again;
477 - if genCfg is not done, send negative Cfm to the layer manager;
478 - if all the parameters are valid, then allocate the RlSap control block;
479 - update the SAP control block with the information provided in the
480 - configuration request;
481 - send configuration confirm with the status, success;
483 - if genCfg is not done, send negative Cfm to the layer manager;
484 - if all the parametes are valid, then allocate the CrSap control block;
485 - update the SAP control block with the information provided in the
486 configuration request;
487 - send configuration confirm with the status, success;
490 * @param[in] pst post structure
491 * @param[in] cfg LM management structure
494 * -# Failure : RFAILED
498 PUBLIC S16 PjMiLpjCfgReq
504 PUBLIC S16 PjMiLpjCfgReq (pst, cfg)
510 Elmnt elmnt; /* header element */
511 PjMngmt rCfm; /* Reply cfm */
512 Reason reason; /* failure reason */
517 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES) /* KW_FIX */
522 tPjCb = PJ_GET_PJCB(pst->dstInst);
524 RLOG1(L_DEBUG, "PjMiLpjCfgReq(post, elmId(%d))", cfg->hdr.elmId.elmnt);
528 /* check configuration is done or not */
529 if ((!(tPjCb->init.cfgDone & PJ_LMM_GENCFG_DONE)) &&
530 (cfg->hdr.elmId.elmnt != STGEN))
533 * if general config is not over then use pst structure
534 * in primitive to communicate to stack manager
537 rCfm.cfm.status = LCM_PRIM_NOK;
538 rCfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
539 pjLmmSendCfm(pst, &rCfm, TCFG, &cfg->hdr);
543 elmnt = cfg->hdr.elmId.elmnt;
549 reason = pjLmmGenCfg(tPjCb,&cfg->t.cfg.s.gen);
554 reason = pjLmmPjuSapCfg(tPjCb,&cfg->t.cfg.s.sap);
559 reason = pjLmmKwuSapCfg(tPjCb,&cfg->t.cfg.s.sap);
564 reason = pjLmmCpjSapCfg(tPjCb,&cfg->t.cfg.s.sap);
569 reason = pjLmmUdxSapCfg(tPjCb,&cfg->t.cfg.s.sap);
574 reason = LCM_REASON_INVALID_ELMNT;
579 if (reason == LCM_REASON_NOT_APPL)
581 rCfm.cfm.status = LCM_PRIM_OK;
582 rCfm.cfm.reason = LCM_REASON_NOT_APPL;
588 rCfm.cfm.status = LCM_PRIM_NOK;
589 rCfm.cfm.reason = reason;
594 RLOG2(L_DEBUG, "Cfg Req processed : status(%d) reason(%d)",
595 rCfm.cfm.status, rCfm.cfm.reason);
597 ret = pjLmmSendCfm(pst, &rCfm, TCFG, &cfg->hdr);
600 } /* PjMiLpjCfgReq */
604 The layer manager initiates and uses the management-control procedure to
605 control PDCP elements.The PDCP control request primitive (PjMiLpjCntrlReq)
606 can be called more than once and at any time after the management-configuration
607 procedure.The control request primitive is confirmed by a PjMiLpjCntrlCfm
610 This function implements the following logic: \n
612 - if(cfgDone = FALSE)
613 - send negative confirmation to the layer manager;
616 - switch(cntrl->hdr.elmId.elmnt)
622 - enable the unsolicited status flag;
623 - send the control Cfm with success;
625 - set the debug mask;
626 - send the control Cfm with success;
628 - enable the trace flag;
629 - send the control Cfm with success;
633 - disable the unsolicited status flag;
634 - send the control Cfm with success;
636 - disable the trace flag;
637 - send the control Cfm with success;
645 * @param[in] pst post structure
646 * @param[in] cntrl LM management structure
649 * -# Failure : RFAILED
652 PUBLIC S16 PjMiLpjCntrlReq
658 PUBLIC S16 PjMiLpjCntrlReq(pst, cntrl)
663 Elmnt elmnt; /* header element */
664 PjMngmt rCfm; /* Reply cfm */
665 Reason reason; /* failure reason */
670 TRC3(PjMiLpjCntrlReq)
672 if (pst->dstInst >= PJ_MAX_PDCP_INSTANCES) /* KW_FIX */
677 tPjCb = PJ_GET_PJCB(pst->dstInst);
679 RLOG1(L_DEBUG, "Cntrl Req Received (post, elmId(%d))",
680 cntrl->hdr.elmId.elmnt);
684 if (!(tPjCb->init.cfgDone & PJ_LMM_GENCFG_DONE))
686 rCfm.cfm.status = LCM_PRIM_NOK;
687 rCfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
689 pjLmmSendCfm(pst, &rCfm, TCNTRL, &cntrl->hdr);
693 /* In normal cases, LCM_REASON_NOT_APPL is returned in cfm.
694 * In all error cases appropriate reason is returned
695 * by the functions below
698 elmnt = cntrl->hdr.elmId.elmnt;
700 reason = LCM_REASON_NOT_APPL;
707 /* general control */
708 reason = pjLmmGenCntrl(tPjCb,cntrl);
714 /* general control */
715 reason = pjLmmLSapCntrl(tPjCb,cntrl);
720 /* general control */
721 reason = pjLmmUdxSapCntrl(tPjCb,cntrl);
727 reason = LCM_REASON_INVALID_ELMNT;
732 RLOG1(L_DEBUG, "Cntrl Req Processed sending cfm: reason(%d)", reason);
734 ret = pjLmmFormLmCfm(pst, &cntrl->hdr, reason);
736 } /* PjMiLpjCntrlReq */
740 This function processes solicited status requests received from the layer
741 manager. The layer manager can request status information regarding the
742 system ID, PJUSAP, or CPJSAP.
744 * @param[in] pst post structure
745 * @param[in] cfm LM management structure
748 * -# Failure : RFAILED
751 PUBLIC S16 PjMiLpjStaReq
757 PUBLIC S16 PjMiLpjStaReq(pst, sta)
763 Elmnt elmnt; /* Header element */
764 PjMngmt rSta; /* Status */
765 Reason reason; /* Failure reason */
770 tPjCb = PJ_GET_PJCB(pst->dstInst);
771 RLOG1(L_DEBUG, "Status Req Received (post, elmId(%d))",
772 sta->hdr.elmId.elmnt);
774 PJ_MEM_SET(&rSta, 0, sizeof(PjMngmt));
776 reason = LCM_REASON_NOT_APPL;
778 elmnt = sta->hdr.elmId.elmnt;
784 reason = LCM_REASON_NOT_APPL;
785 pjGetSId(&rSta.t.ssta.s.sysId);
794 PJ_MEM_CPY (&rSta.t.ssta.s.kwuSap, &sta->t.ssta.s.kwuSap,
795 sizeof (PjKwuSapSta));
796 reason = pjLmmGetKwuSapSta (tPjCb,&rSta.t.ssta.s.kwuSap);
801 PJ_MEM_CPY (&rSta.t.ssta.s.udxSap, &sta->t.ssta.s.udxSap,
802 sizeof (PjUdxSapSta));
803 reason = pjLmmGetUdxSapSta (tPjCb,&rSta.t.ssta.s.udxSap);
808 PJ_MEM_CPY (&rSta.t.ssta.s.pjuSap, &sta->t.ssta.s.pjuSap,
809 sizeof (PjPjuSapSta));
810 reason = pjLmmGetPjuSapSta (tPjCb,&rSta.t.ssta.s.pjuSap);
815 PJ_MEM_CPY (&rSta.t.ssta.s.cpjSap, &sta->t.ssta.s.cpjSap,
816 sizeof (PjCpjSapSta));
817 reason = pjLmmGetCpjSapSta (tPjCb,&rSta.t.ssta.s.cpjSap);
822 reason = LCM_REASON_INVALID_ELMNT;
825 } /* end of switch */
827 if (reason == LCM_REASON_NOT_APPL)
829 rSta.cfm.status = LCM_PRIM_OK;
830 rSta.cfm.reason = LCM_REASON_NOT_APPL;
836 rSta.cfm.status = LCM_PRIM_NOK;
837 rSta.cfm.reason = reason;
842 RLOG2(L_DEBUG, "Sta Req processed - sending cfm: status(%d) reason(%d)",
843 rSta.cfm.status, rSta.cfm.reason);
845 ret = pjLmmSendCfm(pst, &rSta, TSSTA, &sta->hdr);
848 } /* PjMiLpjStaReq */
852 This function processes statistics requests received from the layer manager.
853 After collecting the statistics, this function calls the statistics confirm
854 function to send the statistics to the layer manager.
856 - switch(sts->hdr.elmId.elmnt)
858 - get the general statistics from the PJ control block;
859 - if (action = RESET)
860 - reset the general statistic field in the RlCb;
861 - call PjMiLpjStsCfm to send statistics back to layer manager;
864 - get the SAP specific statistics from PJ control block;
865 - if (action = RESET)
866 - reset the general statistic field in the RlCb;
867 - call PjMiLpjStsCfm to send statistics to the layer manager;
870 * @param[in] pst post structure
871 * @param[in] action action
872 * @param[in] cfg LM management structure
875 * -# Failure : RFAILED
878 PUBLIC S16 PjMiLpjStsReq
885 PUBLIC S16 PjMiLpjStsReq (pst, action, sts)
892 PjMngmt rSts; /* Statistics */
893 Reason reason; /* Reason for failure */
894 Elmnt elmnt; /* Element Id */
899 tPjCb = PJ_GET_PJCB(pst->dstInst);
900 RLOG2(L_DEBUG, "Sts Req (post, elmId(%d),action(%d))",
901 action, sts->hdr.elmId.elmnt);
903 PJ_MEM_SET(&rSts, 0, sizeof(PjMngmt));
904 elmnt = sts->hdr.elmId.elmnt;
910 reason = pjLmmGetGenSts(tPjCb,&rSts.t.sts.s.gen, action);
915 reason = pjLmmGetSapSts(tPjCb,sts, elmnt, action);
916 PJ_MEM_CPY(&rSts.t.sts.s.pjuSap, &sts->t.sts.s.pjuSap,
920 case STCPJSAP: /* No CPJ SAP statistics available */
923 reason = LCM_REASON_INVALID_ELMNT;
928 if (reason == LCM_REASON_NOT_APPL)
930 rSts.cfm.status = LCM_PRIM_OK;
931 rSts.cfm.reason = LCM_REASON_NOT_APPL;
937 rSts.cfm.status = LCM_PRIM_NOK;
938 rSts.cfm.reason = reason;
943 RLOG2(L_DEBUG, "Sts Req Processed - sending cfm: status(%d) reason(%d)",
944 rSts.cfm.status, rSts.cfm.reason);
946 ret = pjLmmSendCfm(pst, &rSts, TSTS, &sts->hdr);
949 } /* PjMiLpjStsReq */
950 /* pj005.201 added support for L2 Measurement */
953 * @brief Validates the measurement request parameters.
957 * Function :pjUtlValidateL2Meas
959 * @param[in] PjL2MeasReqEvt measReqEvt
960 * @param[out] PjL2MeasCfmEvt measCfmEvt
963 PRIVATE S16 pjUtlValidateL2Meas
966 PjL2MeasReqEvt *measReqEvt,
967 PjL2MeasCfmEvt *measCfmEvt
970 PRIVATE S16 pjUtlValidateL2Meas(tPjCb, measReqEvt, measCfmEvt)
972 PjL2MeasReqEvt *measReqEvt;
973 PjL2MeasCfmEvt *measCfmEvt;
980 TRC3(pjUtlValidateL2Meas)
983 measType = measReqEvt->measReq.measType;
987 measCfmEvt->numQciCfm = 1;
988 measCfmEvt->measCfm[0].qci = measReqEvt->measReq.qci[0];
989 measCfmEvt->transId = measReqEvt->transId;
990 measCfmEvt->measType = measType;
991 measCfmEvt->status.status = LCM_PRIM_NOK;
992 measCfmEvt->status.reason = LPJ_CAUSE_INVALID_MEASTYPE;
995 if(((measReqEvt->measReq.measType & LPJ_L2CPU_PERCORE_STATS) ||
996 (measReqEvt->measReq.measType & LPJ_L2MEM_PERPOOL_STATS)) &&
997 (~(measReqEvt->measReq.measType & LPJ_L2MEAS_UL_LOSS)))
1002 if(measReqEvt->measReq.numQci > LPJ_MAX_QCI || measReqEvt->measReq.numQci == 0)
1004 measCfmEvt->numQciCfm = 1;
1005 measCfmEvt->transId = measReqEvt->transId;
1006 measCfmEvt->measType = measType;
1007 measCfmEvt->status.status = LCM_PRIM_NOK;
1008 measCfmEvt->status.reason = LPJ_CAUSE_EXCEED_NUMQCI;
1011 if(measReqEvt->measPeriod != 0)
1013 measCfmEvt->numQciCfm = 1;
1014 measCfmEvt->transId = measReqEvt->transId;
1015 measCfmEvt->measType = measType;
1016 measCfmEvt->status.status = LCM_PRIM_NOK;
1017 measCfmEvt->status.reason = LPJ_CAUSE_INVALID_MEASTYPE;
1020 for(qciIdx = 0; qciIdx < measReqEvt->measReq.numQci; qciIdx++)
1022 if(tPjCb->u.ulCb->pjL2Cb.measOn[measReqEvt->measReq.qci[qciIdx]] &
1023 measReqEvt->measReq.measType)
1025 /* Measurement is already ongoing */
1026 measCfmEvt->measCfm[measCfmEvt->numQciCfm].qci = qciIdx;
1027 measCfmEvt->measType = measType;
1028 measCfmEvt->numQciCfm++;
1031 if(measCfmEvt->numQciCfm > 0)
1033 measCfmEvt->status.status = LCM_PRIM_NOK;
1034 measCfmEvt->status.reason = LPJ_CAUSE_MEAS_ALREADY_ENA;
1035 measCfmEvt->transId = measReqEvt->transId;
1038 for(qciIdx = 0; qciIdx < measReqEvt->measReq.numQci; qciIdx++)
1040 qciVal = measReqEvt->measReq.qci[qciIdx];
1041 if(qciVal == 0 || qciVal > 9)
1043 measCfmEvt->numQciCfm = 1;
1044 measCfmEvt->measCfm[0].qci = measReqEvt->measReq.qci[qciIdx];
1045 measCfmEvt->transId = measReqEvt->transId;
1046 measCfmEvt->measType = measReqEvt->measReq.measType;
1047 measCfmEvt->status.status = LCM_PRIM_NOK;
1048 measCfmEvt->status.reason = LPJ_CAUSE_INVALID_QCI;
1055 }/* pjUtlValidateL2Meas */
1059 This function processes L2 Measurement requests received from the layer manager.
1060 The L2 Measurement is start for a time period and after the timer expiry, the
1061 measurement confirm is sent.
1063 - Accept only one set of measurements.
1064 - Allocate and initialise KwL2MeasEvtCb.
1065 - Validate if the measurement is already in progress.
1066 - Loop through the existing measEvtCb with matching measType
1067 - Check if measurement is running for any qci present in the measReq
1068 - If present, move the qCi to list of invalid qCIs.
1069 - Set KwL2MeasEvtCb.measOn to TRUE for QCIs to be measured.
1070 - For the number of measurements requested.
1071 - For all Ues with RBs matching qCI.
1072 - Add RbCb to the RB linked list.
1073 - Set kwRbCb.measOn to measurement type.
1074 - If Meas type is DL_DELAY
1075 - Update COUNT to startCount.
1078 * @param[in] pst post structure
1079 * @param[in] action action
1080 * @param[in] cfg LM management structure
1083 * -# Failure : RFAILED
1086 PUBLIC S16 PjMiLpjL2MeasReq
1089 PjL2MeasReqEvt *measReqEvt
1092 PUBLIC S16 PjMiLpjL2MeasReq (pst, measReqEvt)
1094 PjL2MeasReqEvt *measReqEvt;
1099 PjL2MeasCfmEvt measCfmEvt;
1100 PjL2Cb *pjL2Cb = NULLP;
1101 PjCb *tPjCb = PJ_GET_PJCB(pst->dstInst);
1103 TRC3(PjMiLpjL2MeasReq);
1105 tPjCb = PJ_GET_PJCB(pst->dstInst);
1107 measType = measReqEvt->measReq.measType;
1109 RLOG1(L_DEBUG, "L2_MEAS START Measurement type is %u\n", measType);
1110 /* Initialize measCfmEvt */
1111 memset(&measCfmEvt,0, sizeof(PjL2MeasCfmEvt));
1113 ret = pjUtlValidateL2Meas(tPjCb, measReqEvt, &measCfmEvt);
1116 pjUtlSndUlL2MeasNCfm(tPjCb, &measCfmEvt);
1120 RLOG1(L_DEBUG,"Measurement Start Req type is [%lu]", measType);
1121 if (measType & LPJ_L2MEAS_UL_LOSS)
1125 pjL2Cb = &tPjCb->u.ulCb->pjL2Cb;
1127 for(cntr = 1; cntr < LPJ_MAX_QCI; cntr++)
1129 pjL2Cb->measOn[cntr] |= measType;
1132 if ((measType & LPJ_L2MEM_PERPOOL_STATS) || (measType & LPJ_L2CPU_PERCORE_STATS) )
1134 /* starting measurement timer */
1135 ret = pjStartTmr(tPjCb, (PTR)tPjCb, PJ_EVT_L2_MEAS_TMR);
1141 if(measType & LPJ_L2MEM_PERPOOL_STATS)
1143 pjL2Cb->memUtilizationMask |= LPJ_L2MEM_PERPOOL_STATS;
1145 if(measType & LPJ_L2CPU_PERCORE_STATS)
1147 pjL2Cb->cpuUtilizationMask |= LPJ_L2CPU_PERCORE_STATS;
1149 /* Use else for DL in future */
1151 } /* PjMiLpjL2MeasReq */
1155 This function processes L2 Measurement stop request received from the layer manager.
1156 After receving this request, PDCP stops L2 Measurement
1157 * @param[in] pst post structure
1158 * @param[in] measType meas Type
1161 * -# Failure : RFAILED
1165 PUBLIC S16 PjMiLpjL2MeasStopReq
1171 PUBLIC S16 PjMiLpjL2MeasStopReq (pst, measType)
1177 PjCb *tPjCb = PJ_GET_PJCB(pst->dstInst);
1178 PjL2MeasEvtCb *measEvtCb = NULLP;
1179 PjL2MeasCfmEvt measCfmEvt;
1180 TRC3(PjMiLpjL2MeasStopReq);
1183 RLOG1(L_DEBUG,"Meas Stop Req type is [%lu]", measType);
1184 /* For UL counters only */
1185 cmMemset((U8*)&measCfmEvt, 0, sizeof(PjL2MeasCfmEvt));
1187 if(measType & LPJ_L2MEM_PERPOOL_STATS ||
1188 measType & LPJ_L2CPU_PERCORE_STATS)
1190 /* stopping timer */
1191 pjStopTmr(tPjCb, (PTR)tPjCb, PJ_EVT_L2_MEAS_TMR);
1193 if(measType & LPJ_L2MEM_PERPOOL_STATS)
1195 tPjCb->u.ulCb->pjL2Cb.memUtilizationMask = 0;
1197 if(measType & LPJ_L2CPU_PERCORE_STATS)
1199 tPjCb->u.ulCb->pjL2Cb.cpuUtilizationMask = 0;
1202 for(cntr = 0; cntr < LPJ_MAX_L2MEAS; cntr++)
1204 measEvtCb = &(tPjCb->u.ulCb->pjL2Cb.pjL2EvtCb[cntr]);
1205 if(measEvtCb->measCb.measType & measType)
1207 pjUtlResetUlL2MeasCntr(tPjCb, &measEvtCb->measCb, measType);
1210 PjMiLpjL2MeasStopCfm(&tPjCb->pjGenCfg.lmPst, measType,LCM_PRIM_OK);
1217 * @brief For reporting measurement.
1221 * This function is called when the l2 measurement report send request is received.
1222 * This function sends a consolidates the mesaurements taken during
1223 * this time and sends the confirm .
1225 * @param[in] measEvtCb Measurement Event Control Block.
1233 PRIVATE S16 PjUtlPrepNSndL2MeasSendCfm
1236 PjL2MeasEvtCb *measEvtCb
1239 PRIVATE S16 PjUtlPrepNSndL2MeasSendCfm(tPjCb, measEvtCb)
1241 PjL2MeasEvtCb *measEvtCb;
1245 PjL2MeasCfmEvt measCfmEvt;
1249 TRC3(PjUtlPrepNSndL2MeasSendCfm);
1251 measCb = &measEvtCb->measCb;
1252 /* Initialize measCfmEvt */
1253 cmMemset((U8 *) &measCfmEvt, 0, sizeof(PjL2MeasCfmEvt));
1254 measCfmEvt.measType = measCb->measType;
1255 measCfmEvt.status.status = LCM_PRIM_OK;
1256 measCfmEvt.status.reason = LCM_REASON_NOT_APPL;
1258 /* Filling Memory Utilzation structure */
1259 if(measCb->measType & LPJ_L2MEM_PERPOOL_STATS)
1261 if(tPjCb->u.ulCb->pjL2Cb.memUtilizationMask & LPJ_L2MEM_PERPOOL_STATS)
1263 cmFillMemUtilizationMeas(&(measCfmEvt.memoryInfo),&(measCb->memInfo));
1264 cmClearMemUtilizationCounter(&(measCb->memInfo));
1265 if(FALSE == (pjChkTmr(tPjCb, (PTR)tPjCb, PJ_EVT_L2_MEAS_TMR)))
1267 /* starting measurement timer */
1268 ret = pjStartTmr(tPjCb, (PTR)tPjCb, PJ_EVT_L2_MEAS_TMR);
1277 RLOG0(L_DEBUG,"Meas Send Req without configuring Memory meas");
1280 if(measCb->measType & LPJ_L2MEAS_UL_LOSS)
1282 /* Fill the measCfmEvt structure */
1283 for(qciIdx = 1; qciIdx < LPJ_MAX_QCI; qciIdx++)
1285 U8 qci = measCb->qci[qciIdx];
1288 if(measCb->measType & LPJ_L2MEAS_UL_LOSS)
1290 U64 totPkts, lostPkts;
1292 lostPkts = (U64)(measCb->measData[qci].ulLoss.val);
1293 totPkts = (U64)(measCb->measData[qci].ulLoss.numPkts);
1295 measCfmEvt.measCfm[measCfmEvt.numQciCfm].qci = qci;
1296 measCfmEvt.measCfm[measCfmEvt.numQciCfm].ulLoss = 0;
1299 /* ul Loss = num of Pkts lost * 10^6 / total no of pkts. */
1300 measCfmEvt.measCfm[measCfmEvt.numQciCfm].ulLoss = (((U64)(lostPkts * ((U64)1000000))) / totPkts);
1302 measCb->measData[qci].ulLoss.val = 0;
1303 measCb->measData[qci].ulLoss.numPkts = 0;
1306 if (measCb->measData[qci].totDrbsPerQci == 0)
1308 measCb->qci[qciIdx] = 0;
1310 measCfmEvt.numQciCfm++;
1314 if((measCb->measType & LPJ_L2CPU_PERCORE_STATS) &&(tPjCb->u.ulCb->pjL2Cb.cpuUtilizationMask & LPJ_L2CPU_PERCORE_STATS))
1316 CmCpuStatsInfo *cpuInfo = &measCb->cpuInfo;
1317 for(coreIdx = 0; (coreIdx < cpuInfo->numCores) && (coreIdx < CM_MAX_CPU_CORES); coreIdx++)
1319 measCfmEvt.cmLteCpuInfo[coreIdx].avgCpuUtil = cpuInfo->cpuUtil[coreIdx].totCpuUtil / cpuInfo->cpuUtil[coreIdx].numSamples ;
1320 measCfmEvt.cmLteCpuInfo[coreIdx].maxCpuUtil = cpuInfo->cpuUtil[coreIdx].maxCpuUtil ;
1321 cpuInfo->cpuUtil[coreIdx].totCpuUtil = 0;
1322 cpuInfo->cpuUtil[coreIdx].maxCpuUtil = 0;
1323 cpuInfo->cpuUtil[coreIdx].numSamples = 0;
1325 measCfmEvt.numCores = cpuInfo->numCores;
1326 cpuInfo->numCores = 0;
1327 if(FALSE == (pjChkTmr(tPjCb, (PTR)tPjCb, PJ_EVT_L2_MEAS_TMR)))
1329 /* starting measurement timer */
1330 ret = pjStartTmr(tPjCb, (PTR)tPjCb, PJ_EVT_L2_MEAS_TMR);
1337 /* Send Measurement confirmation to layer manager */
1338 pjUtlSndUlL2MeasNCfm(tPjCb, &measCfmEvt);
1341 } /* PjUtlPrepNSndL2MeasSendCfm */
1345 This function processes L2 Measurement Send request received from the layer manager.
1346 After receving this request, RLC sends L2 Measurement
1347 * @param[in] pst post structure
1348 * @param[in] measType meas Type
1351 * -# Failure : RFAILED
1355 PUBLIC S16 PjMiLpjL2MeasSendReq
1361 PUBLIC S16 PjMiLpjL2MeasSendReq (pst, measType)
1366 TRC3(PjMiLpjL2MeasSendReq);
1368 if((measType & LPJ_L2MEAS_UL_LOSS) ||
1369 (measType & LPJ_L2MEM_PERPOOL_STATS) ||
1370 (measType & LPJ_L2CPU_PERCORE_STATS))
1373 PjCb *tPjCb = PJ_GET_PJCB(pst->dstInst);
1374 PjL2MeasEvtCb *measEvtCb = NULLP;
1376 if((measType & LPJ_L2MEM_PERPOOL_STATS) &&
1377 (tPjCb->u.ulCb->pjL2Cb.memUtilizationMask & LPJ_L2MEM_PERPOOL_STATS))
1379 if(TRUE == (pjChkTmr(tPjCb, (PTR)tPjCb, PJ_EVT_L2_MEAS_TMR)))
1381 /* stopping timer */
1382 pjStopTmr(tPjCb, (PTR)tPjCb, PJ_EVT_L2_MEAS_TMR);
1385 if((measType & LPJ_L2CPU_PERCORE_STATS) &&
1386 (tPjCb->u.ulCb->pjL2Cb.cpuUtilizationMask & LPJ_L2CPU_PERCORE_STATS))
1388 if(TRUE == (pjChkTmr(tPjCb, (PTR)tPjCb, PJ_EVT_L2_MEAS_TMR)))
1390 /* stopping timer */
1391 pjStopTmr(tPjCb, (PTR)tPjCb, PJ_EVT_L2_MEAS_TMR);
1395 for(cntr = 0; cntr < PJ_MAX_L2MEAS_EVT; cntr++)
1397 measEvtCb = &tPjCb->u.ulCb->pjL2Cb.pjL2EvtCb[cntr];
1398 if(measEvtCb->measCb.measType & measType)
1400 PjUtlPrepNSndL2MeasSendCfm(tPjCb, measEvtCb);
1407 PUBLIC Void UpdateMemInfo
1412 PUBLIC Void UpdateMemInfo(tPjL2Cb)
1417 PjL2MeasEvtCb *measEvtCb = NULLP;
1418 for(cntr = 0; cntr < PJ_MAX_L2MEAS_EVT; cntr++)
1420 measEvtCb = &tPjL2Cb->pjL2EvtCb[cntr];
1421 if(measEvtCb->measCb.measType & LPJ_L2MEM_PERPOOL_STATS)
1423 /* Update Memory Info for SSI Memory */
1424 cmUpdateSsiMemInfo(&(measEvtCb->measCb.memInfo));
1426 #ifdef SS_LOCKLESS_MEMORY
1428 UpdateSocMemInfo(CM_L2_MEM_UTIL_AREAIDX, &(measEvtCb->measCb.memInfo));
1437 PUBLIC S16 UpdateCpuInfo
1442 PUBLIC S16 UpdateCpuInfo(tPjL2Cb)
1447 PjL2MeasEvtCb *measEvtCb = NULLP;
1449 for(cntr = 0; cntr < PJ_MAX_L2MEAS_EVT; cntr++)
1451 measEvtCb = &tPjL2Cb->pjL2EvtCb[cntr];
1452 if(measEvtCb->measCb.measType & LPJ_L2CPU_PERCORE_STATS)
1454 /* Update CpuUtilization Info */
1455 UpdateSocCpuInfo(&(measEvtCb->measCb.cpuInfo), CM_L2_CPU_UTIL);
1464 PUBLIC S16 pjUtlMemCpuHdlTmrExp
1470 PUBLIC S16 pjUtlMemCpuHdlTmrExp(tPjCb,tPjL2Cb)
1476 if(tPjCb->u.ulCb->pjL2Cb.memUtilizationMask & LPJ_L2MEM_PERPOOL_STATS)
1478 /* calling memory Info */
1479 UpdateMemInfo(tPjL2Cb);
1481 if(tPjCb->u.ulCb->pjL2Cb.cpuUtilizationMask & LPJ_L2CPU_PERCORE_STATS)
1483 UpdateCpuInfo(tPjL2Cb);
1485 /*TODO: call cpu util */
1486 /* starting measurement timer */
1487 ret = pjStartTmr(tPjCb, (PTR)tPjCb, PJ_EVT_L2_MEAS_TMR);
1496 #endif /* LTE_L2_MEAS */
1499 This function configures the PDCP data sap
1501 * @param[in] cfg PDCP LM Sap structure
1503 * -# Success : LCM_REASON_NOT_APPL
1504 * -# Failure : LCM_REASON_INVALID_SAP
1505 * LCM_REASON_INVALID_SAP
1506 * LCM_REASON_RECONFIG_FAIL
1509 PRIVATE S16 pjLmmPjuSapCfg
1512 PjSapCfg *cfg /* SAP control block */
1515 PRIVATE S16 pjLmmPjuSapCfg(gCb, cfg)
1517 PjSapCfg *cfg; /* SAP control block */
1522 TRC2(pjLmmPjuSapCfg)
1524 /* Validate config parameters */
1525 if (cfg->sapId >= PJ_MAX_PJUSAPS )
1527 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
1530 if (gCb->pjGenCfg.mode == LPJ_MODE_PDCP_UL)
1532 pjuSap = &(gCb->u.ulCb->pjuSap[cfg->sapId]);
1536 pjuSap = &(gCb->u.dlCb->pjuSap[cfg->sapId]);
1539 #if (ERRCLASS & ERRCLS_INT_PAR)
1540 /* Check for reconfiguration */
1541 if(pjuSap->state != PJ_SAP_NOT_CFG)
1543 RLOG0(L_ERROR, "Invalid pjuSap State");
1544 RETVALUE(LCM_REASON_RECONFIG_FAIL);
1546 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1548 /* Fill the parameters */
1549 pjuSap->pst.selector = cfg->selector;
1550 pjuSap->pst.route = cfg->route;
1551 pjuSap->pst.prior = cfg->priority;
1552 /* pj002.201 With multicore support layer shall use the assigned region
1553 and pool from SSI */
1554 #if defined(SS_MULTICORE_SUPPORT) && defined(SS_M_PROTO_REGION)
1555 pjuSap->pst.region = gCb->init.region;
1556 pjuSap->pst.pool = gCb->init.pool;
1558 pjuSap->pst.region = cfg->mem.region;
1559 pjuSap->pst.pool = cfg->mem.pool;
1561 pjuSap->pst.dstProcId = cfg->procId;
1562 pjuSap->pst.dstEnt = cfg->ent;
1563 pjuSap->pst.dstInst = cfg->inst;
1564 pjuSap->pst.srcProcId = gCb->init.procId;
1565 pjuSap->pst.srcEnt = gCb->init.ent;
1566 pjuSap->pst.srcInst = gCb->init.inst;
1567 pjuSap->pst.event = EVTNONE;
1568 pjuSap->spId = cfg->sapId;
1570 /* make sap unbound initially */
1571 pjuSap->state = PJ_SAP_CFG;
1573 RETVALUE(LCM_REASON_NOT_APPL);
1574 } /* pjLmmPjuSapCfg */
1578 This function configures the PDCP / RLC data sap
1580 * @param[in] cfg PDCP LM Sap structure
1582 * -# Success : LCM_REASON_NOT_APPL
1583 * -# Failure : LCM_REASON_INVALID_SAP
1584 * LCM_REASON_INVALID_SAP
1585 * LCM_REASON_RECONFIG_FAIL
1588 PRIVATE S16 pjLmmKwuSapCfg
1591 PjSapCfg *cfg /* SAP control block */
1594 PRIVATE S16 pjLmmKwuSapCfg(gCb, cfg)
1596 PjSapCfg *cfg; /* SAP control block */
1601 TRC2(pjLmmKwuSapCfg)
1604 /* Validate config parameters */
1605 if (cfg->sapId >= PJ_MAX_KWUSAPS )
1607 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
1610 if (gCb->pjGenCfg.mode == LPJ_MODE_PDCP_UL)
1612 kwuSap = &(gCb->u.ulCb->kwuSap[cfg->sapId]);
1616 kwuSap = &(gCb->u.dlCb->kwuSap[cfg->sapId]);
1619 #if (ERRCLASS & ERRCLS_INT_PAR)
1620 /* Check for reconfiguration */
1621 if(kwuSap->state != PJ_SAP_NOT_CFG)
1623 RLOG0(L_ERROR, "Invalid kwuSap State");
1624 RETVALUE(LCM_REASON_RECONFIG_FAIL);
1626 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1628 /* Fill the parameters */
1629 kwuSap->pst.selector = cfg->selector;
1630 kwuSap->pst.route = cfg->route;
1631 kwuSap->pst.prior = cfg->priority;
1632 /* pj002.201 With multicore support layer shall use the assigned region
1633 and pool from SSI */
1634 #if defined(SS_MULTICORE_SUPPORT) && defined(SS_M_PROTO_REGION)
1635 kwuSap->pst.region = gCb->init.region;
1636 kwuSap->pst.pool = gCb->init.pool;
1638 kwuSap->pst.region = cfg->mem.region;
1639 kwuSap->pst.pool = cfg->mem.pool;
1641 kwuSap->pst.dstProcId = cfg->procId;
1642 kwuSap->pst.dstEnt = cfg->ent;
1643 kwuSap->pst.dstInst = cfg->inst;
1644 kwuSap->pst.srcProcId = gCb->init.procId;
1645 kwuSap->pst.srcEnt = gCb->init.ent;
1646 kwuSap->pst.srcInst = gCb->init.inst;
1647 kwuSap->pst.event = EVTNONE;
1648 kwuSap->suId = cfg->sapId;
1650 /* make sap unbound initially */
1651 kwuSap->bndTmrInt = cfg->bndTmrIntvl;
1652 cmInitTimers(&kwuSap->bndTmr,PJ_MAX_KWUSAP_TMR);
1653 kwuSap->state = PJ_SAP_CFG;
1655 RETVALUE(LCM_REASON_NOT_APPL);
1656 } /* pjLmmKwuSapCfg */
1660 This function configures the PDCP / RLC data sap
1662 * @param[in] cfg PDCP LM Sap structure
1664 * -# Success : LCM_REASON_NOT_APPL
1665 * -# Failure : LCM_REASON_INVALID_SAP
1666 * LCM_REASON_INVALID_SAP
1667 * LCM_REASON_RECONFIG_FAIL
1670 PRIVATE S16 pjLmmUdxSapCfg
1673 PjSapCfg *cfg /* SAP control block */
1676 PRIVATE S16 pjLmmUdxSapCfg(gCb, cfg)
1678 PjSapCfg *cfg; /* SAP control block */
1682 TRC2(pjLmmUdxSapCfg)
1685 /* Validate config parameters */
1686 if (cfg->sapId >= PJ_MAX_UDXSAPS )
1688 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
1691 if (gCb->pjGenCfg.mode == LPJ_MODE_PDCP_UL)
1693 PjUdxUlSapCb *udxSap;
1694 udxSap = (gCb->u.ulCb->udxUlSap + cfg->sapId);
1695 #if (ERRCLASS & ERRCLS_INT_PAR)
1696 /* Check for reconfiguration */
1697 if(udxSap->state != PJ_SAP_NOT_CFG)
1699 RLOG0(L_ERROR, "Invalid udxSap State");
1700 RETVALUE(LCM_REASON_RECONFIG_FAIL);
1702 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1704 /* Fill the parameters */
1705 udxSap->pst.selector = cfg->selector;
1706 udxSap->pst.route = cfg->route;
1707 udxSap->pst.prior = cfg->priority;
1708 /* pj002.201 With multicore support layer shall use the assigned region
1709 and pool from SSI */
1710 #if defined(SS_MULTICORE_SUPPORT) && defined(SS_M_PROTO_REGION)
1711 udxSap->pst.region = gCb->init.region;
1712 udxSap->pst.pool = gCb->init.pool;
1714 udxSap->pst.region = cfg->mem.region;
1715 udxSap->pst.pool = cfg->mem.pool;
1717 udxSap->pst.dstProcId = cfg->procId;
1718 udxSap->pst.dstEnt = cfg->ent;
1719 udxSap->pst.dstInst = cfg->inst;
1720 udxSap->pst.srcProcId = gCb->init.procId;
1721 udxSap->pst.srcEnt = gCb->init.ent;
1722 udxSap->pst.srcInst = gCb->init.inst;
1723 udxSap->pst.event = EVTNONE;
1724 udxSap->suId = cfg->sapId;
1726 /* make sap unbound initially */
1727 udxSap->bndTmrInt = cfg->bndTmrIntvl;
1728 cmInitTimers(&udxSap->bndTmr,PJ_MAX_UDXSAP_TMR);
1729 udxSap->state = PJ_SAP_CFG;
1734 PjUdxDlSapCb *udxSap;
1735 udxSap = (gCb->u.dlCb->udxDlSap + cfg->sapId);
1736 #if (ERRCLASS & ERRCLS_INT_PAR)
1737 /* Check for reconfiguration */
1738 if(udxSap->state != PJ_SAP_NOT_CFG)
1740 RLOG0(L_ERROR, "Invalid udxSap State");
1741 RETVALUE(LCM_REASON_RECONFIG_FAIL);
1743 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1745 /* Fill the parameters */
1746 udxSap->pst.selector = cfg->selector;
1747 udxSap->pst.route = cfg->route;
1748 udxSap->pst.prior = cfg->priority;
1749 /* pj002.201 With multicore support layer shall use the assigned region
1750 and pool from SSI */
1751 #if defined(SS_MULTICORE_SUPPORT) && defined(SS_M_PROTO_REGION)
1752 udxSap->pst.region = gCb->init.region;
1753 udxSap->pst.pool = gCb->init.pool;
1755 udxSap->pst.region = cfg->mem.region;
1756 udxSap->pst.pool = cfg->mem.pool;
1758 udxSap->pst.dstProcId = cfg->procId;
1759 udxSap->pst.dstEnt = cfg->ent;
1760 udxSap->pst.dstInst = cfg->inst;
1761 udxSap->pst.srcProcId = gCb->init.procId;
1762 udxSap->pst.srcEnt = gCb->init.ent;
1763 udxSap->pst.srcInst = gCb->init.inst;
1764 udxSap->pst.event = EVTNONE;
1765 udxSap->suId = cfg->sapId;
1766 udxSap->state = PJ_SAP_CFG;
1769 RETVALUE(LCM_REASON_NOT_APPL);
1770 } /* pjLmmUdxSapCfg */
1776 This function configures the PDCP control sap
1778 * @param[in] cfg PDCP LM Sap structure
1780 * -# Success : LCM_REASON_NOT_APPL
1781 * -# Failure : LCM_REASON_INVALID_SAP
1782 * LCM_REASON_INVALID_SAP
1783 * LCM_REASON_RECONFIG_FAIL
1786 PRIVATE S16 pjLmmCpjSapCfg
1789 PjSapCfg *cfg /* SAP control block */
1792 PRIVATE S16 pjLmmCpjSapCfg(gCb,cfg)
1794 PjSapCfg *cfg; /* SAP control block */
1799 TRC2(pjLmmCpjSapCfg)
1801 /* Validate config parameters */
1802 if (cfg->sapId >= PJ_MAX_CPJSAPS )
1804 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
1807 if (gCb->pjGenCfg.mode == LPJ_MODE_PDCP_UL)
1809 cpjSap = &(gCb->u.ulCb->cpjSap);
1813 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
1816 #if (ERRCLASS & ERRCLS_INT_PAR)
1817 /* Check for reconfiguration */
1818 if(cpjSap->state != PJ_SAP_NOT_CFG)
1820 RLOG0(L_ERROR, "Invalid cpjSap State");
1821 RETVALUE(LCM_REASON_RECONFIG_FAIL);
1823 #endif /* ERRCLASS & ERRCLS_INT_PAR */
1825 /* Fill the parameters */
1826 cpjSap->pst.selector = cfg->selector;
1827 cpjSap->pst.route = cfg->route;
1828 cpjSap->pst.prior = cfg->priority;
1829 /* pj002.201 With multicore support layer shall use the assigned region
1830 and pool from SSI */
1831 #if defined(SS_MULTICORE_SUPPORT) && defined(SS_M_PROTO_REGION)
1832 cpjSap->pst.region = gCb->init.region;
1833 cpjSap->pst.pool = gCb->init.pool;
1835 cpjSap->pst.region = cfg->mem.region;
1836 cpjSap->pst.pool = cfg->mem.pool;
1838 cpjSap->pst.dstProcId = cfg->procId;
1839 cpjSap->pst.dstEnt = cfg->ent;
1840 cpjSap->pst.dstInst = cfg->inst;
1841 cpjSap->pst.srcProcId = gCb->init.procId;
1842 cpjSap->pst.srcEnt = gCb->init.ent;
1843 cpjSap->pst.srcInst = gCb->init.inst;
1844 cpjSap->pst.event = EVTNONE;
1845 cpjSap->spId = cfg->sapId;
1847 /* make sap unbound initially */
1848 cpjSap->state = PJ_SAP_CFG;
1850 RETVALUE(LCM_REASON_NOT_APPL);
1851 } /* pjLmmCpjSapCfg */
1855 Validates the PDCP general control parameters
1857 * @param[in] cntrl PDCP LM structure
1859 * -# Success : LCM_REASON_NOT_APPL
1860 * -# Failure : LCM_REASON_INVALID_SUBACTION
1861 * LCM_REASON_INVALID_ACTION
1864 PRIVATE S16 pjLmmValidateGenCntrl
1866 PjMngmt *cntrl /* PDCP LM structure */
1869 PRIVATE S16 pjLmmValidateGenCntrl(cntrl)
1870 PjMngmt *cntrl; /* PDCP LM structure */
1873 S16 reason; /* reason for failure */
1874 U8 action; /* action parameter */
1875 U8 sAction; /* subaction field */
1878 reason = LCM_REASON_NOT_APPL;
1880 TRC2(pjLmmValidateGenCntrl);
1882 action = cntrl->t.cntrl.action;
1883 sAction = cntrl->t.cntrl.subAction;
1889 if ((sAction != SAUSTA)
1890 && (sAction != SADBG)
1891 && (sAction != SATRC))
1893 reason = LCM_REASON_INVALID_SUBACTION;
1899 reason = LCM_REASON_INVALID_ACTION;
1904 } /* pjLmmValidateGenCntrl */
1908 Delete all SAPs and Control Blocks
1911 * Shutdown of PDCP happens at modules level, tm, um and am modules will
1912 * be shutdown using utility functin and dbm shutdown will clean up the
1913 * SAPs, control blocks and lists.
1916 * -# Success : LCM_REASON_NOT_APPL
1917 * -# Failure : LCM_REASON_HASHING_FAILED
1920 PRIVATE S16 pjLmmShutdown
1925 PRIVATE S16 pjLmmShutdown(gCb)
1931 /* Call PDCP DBM Cleanup function.
1932 * RLC LM shutdown takes care of cleanup of Gloabal and RLC resources */
1933 if (gCb->pjGenCfg.mode == LPJ_MODE_PDCP_UL)
1935 ret = pjUtlUlShutdown(gCb);
1937 #ifdef TENB_AS_SECURITY
1939 #ifdef QAT_TWO_INSTANCE
1940 PjLibObdUlCloseReq(gCb->u.ulCb->instHndl);
1942 /* There is only one instance so its already freed as part of UL shutdown */
1945 PjLibObdUlCloseReq();
1951 ret = pjUtlDlShutdown(gCb);
1953 #ifdef TENB_AS_SECURITY
1955 #ifdef QAT_TWO_INSTANCE
1956 PjLibObdDlCloseReq(gCb->u.dlCb->instHndl);
1958 /* There is only one instance so its already freed as part of UL shutdown */
1961 PjLibObdDlCloseReq();
1965 pjLmmCleanGblRsrcs(gCb);
1973 RETVALUE(LCM_REASON_NOT_APPL);
1975 } /* end of pjLmmShutdown */
1979 Function processes the general control request
1981 * @param[in] cntrl PDCP LM structure
1983 * -# Success : LCM_REASON_NOT_APPL
1984 * -# Failure : LCM_REASON_INVALID_SUBACTION
1985 * LCM_REASON_INVALID_ACTION
1988 PRIVATE S16 pjLmmGenCntrl
1991 PjMngmt *cntrl /* PDCP LM structure */
1994 PRIVATE S16 pjLmmGenCntrl(gCb,cntrl)
1996 PjMngmt *cntrl; /* PDCP LM structure */
1999 U8 action; /* action parameter */
2000 U8 sAction; /* subaction field */
2001 PjTrcCntrl *trcCntrl; /* trace */
2004 PjDbgCntrl *dbgCntrl; /* debug */
2007 S16 reason; /* reason for failure */
2009 TRC2(pjLmmGenCntrl);
2011 reason = LCM_REASON_NOT_APPL;
2013 /* Validate control parameters */
2014 reason = pjLmmValidateGenCntrl (cntrl);
2016 action = cntrl->t.cntrl.action;
2017 sAction = cntrl->t.cntrl.subAction;
2019 if (reason != LCM_REASON_NOT_APPL)
2032 PJ_SET_USTA_FLAG(gCb, TRUE);
2038 dbgCntrl = &cntrl->t.cntrl.s.dbgCntrl;
2039 PJ_GET_DBG_MASK(gCb) |= dbgCntrl->dbgMask;
2045 trcCntrl = &cntrl->t.cntrl.s.trcCntrl;
2046 gCb->init.trc = TRUE;
2047 gCb->trcLen = trcCntrl->trcLen;
2048 (gCb->trcMask) |= trcCntrl->trcMask;
2060 gCb->init.usta = FALSE;
2066 dbgCntrl = &cntrl->t.cntrl.s.dbgCntrl;
2067 PJ_GET_DBG_MASK(gCb) &= ~(dbgCntrl->dbgMask);
2073 trcCntrl = &cntrl->t.cntrl.s.trcCntrl;
2074 gCb->init.trc = FALSE;
2075 gCb->trcMask &= ~(trcCntrl->trcMask);
2083 reason = pjLmmShutdown(gCb);
2088 } /* pjLmmGenCntrl */
2092 Bind/Unbind RLC upper sap
2094 * @param[in] cntrl RLC LM structure
2096 * -# Success : LCM_REASON_NOT_APPL
2097 * -# Failure : LCM_REASON_INVALID_SAP
2098 * LCM_REASON_INVALID_STATE
2099 * LCM_REASON_INVALID_ACTION
2102 PRIVATE S16 pjLmmUdxSapCntrl
2105 PjMngmt *cntrl /* RLC LM structure */
2108 PRIVATE S16 pjLmmUdxSapCntrl(gCb,cntrl)
2110 PjMngmt *cntrl; /* RLC LM structure */
2113 U8 action; /* action parameter */
2114 S16 reason; /* reason for failure */
2115 PjUdxUlSapCb *udxSap; /* udx sap pointer */
2117 TRC2(kwLmmUdxSapCntrl)
2120 reason = LCM_REASON_NOT_APPL;
2121 action = cntrl->t.cntrl.action;
2124 if((cntrl->t.cntrl.s.sapCntrl.suId < 0)
2125 || (cntrl->t.cntrl.s.sapCntrl.suId >= PJ_MAX_KWUSAPS))
2127 reason = LCM_REASON_INVALID_SAP;
2132 if (gCb->pjGenCfg.mode == LPJ_MODE_PDCP_UL)
2134 /*udxSap = &(gCb->u.ulCb->udxUlSap[cntrl->t.cntrl.s.sapCntrl.suId]);*/
2135 udxSap = (gCb->u.ulCb->udxUlSap + cntrl->t.cntrl.s.sapCntrl.suId);
2139 reason = LCM_REASON_INVALID_SAP;
2144 #if (ERRCLASS & ERRCLS_INT_PAR)
2146 if(udxSap->state == PJ_SAP_NOT_CFG)
2148 RLOG0(L_ERROR, "Invalid udxSap State");
2149 reason = LCM_REASON_INVALID_STATE;
2152 #endif /* ERRCLASS & ERRCLS_INT_PAR */
2158 if(udxSap->state != PJ_SAP_BND)
2161 /* start timer to wait for bind confirm */
2162 ret = pjStartTmr(gCb, (PTR)udxSap, PJ_EVT_WAIT_UDX_BNDCFM);
2165 reason = LCM_REASON_REGTMR_FAIL;
2169 udxSap->state = PJ_SAP_BINDING;
2170 /* udxSap->spId = cntrl->t.cntrl.s.sapCntrl.spId; */
2171 PjUlUdxBndReq(&(udxSap->pst), udxSap->suId, udxSap->spId);
2176 /* control request received for an already bound SAP */
2177 reason = LCM_REASON_INVALID_STATE;
2183 /* make the state of RGUSAP is configure but not bound */
2184 udxSap->state = PJ_SAP_CFG;
2185 PjUlUdxUbndReq(&(udxSap->pst), udxSap->spId, 0);
2189 reason = LCM_REASON_INVALID_ACTION;
2191 } /* end of switch */
2194 } /* pjLmmUdxSapCntrl */
2199 Bind/Unbind RLC upper sap
2201 * @param[in] cntrl RLC LM structure
2203 * -# Success : LCM_REASON_NOT_APPL
2204 * -# Failure : LCM_REASON_INVALID_SAP
2205 * LCM_REASON_INVALID_STATE
2206 * LCM_REASON_INVALID_ACTION
2209 PRIVATE S16 pjLmmLSapCntrl
2212 PjMngmt *cntrl /* RLC LM structure */
2215 PRIVATE S16 pjLmmLSapCntrl(gCb,cntrl)
2217 PjMngmt *cntrl; /* RLC LM structure */
2220 U8 action; /* action parameter */
2221 S16 reason; /* reason for failure */
2222 PjKwuSapCb *kwuSap; /* rgu sap pointer */
2224 TRC2(kwLmmLSapCntrl)
2226 reason = LCM_REASON_NOT_APPL;
2227 action = cntrl->t.cntrl.action;
2230 if((cntrl->t.cntrl.s.sapCntrl.suId < 0)
2231 || (cntrl->t.cntrl.s.sapCntrl.suId >= PJ_MAX_KWUSAPS))
2233 reason = LCM_REASON_INVALID_SAP;
2237 if (gCb->pjGenCfg.mode == LPJ_MODE_PDCP_UL)
2239 kwuSap = &(gCb->u.ulCb->kwuSap[cntrl->t.cntrl.s.sapCntrl.suId]);
2243 kwuSap = &(gCb->u.dlCb->kwuSap[cntrl->t.cntrl.s.sapCntrl.suId]);
2247 #if (ERRCLASS & ERRCLS_INT_PAR)
2249 if(kwuSap->state == PJ_SAP_NOT_CFG)
2251 RLOG0(L_ERROR, "Invalid kwuSap State");
2252 reason = LCM_REASON_INVALID_STATE;
2255 #endif /* ERRCLASS & ERRCLS_INT_PAR */
2261 if(kwuSap->state != PJ_SAP_BND)
2264 /* start timer to wait for bind confirm */
2265 ret = pjStartTmr(gCb, (PTR)kwuSap, PJ_EVT_WAIT_KWU_BNDCFM);
2268 reason = LCM_REASON_REGTMR_FAIL;
2272 kwuSap->state = PJ_SAP_BINDING;
2273 kwuSap->spId = cntrl->t.cntrl.s.sapCntrl.spId;
2274 PjLiKwuBndReq(&(kwuSap->pst), kwuSap->suId, kwuSap->spId);
2279 /* control request received for an already bound SAP */
2280 reason = LCM_REASON_INVALID_STATE;
2286 /* make the state of RGUSAP is configure but not bound */
2287 kwuSap->state = PJ_SAP_CFG;
2288 PjLiKwuUbndReq(&(kwuSap->pst), kwuSap->spId, 0);
2292 reason = LCM_REASON_INVALID_ACTION;
2294 } /* end of switch */
2297 } /* pjLmmLSapCntrl */
2302 forms Lm Cfm based on the return values
2304 * @param[in] cntrl PDCP LM structure
2307 * -# Failure : RFAILED
2310 PRIVATE S16 pjLmmFormLmCfm
2317 PRIVATE S16 pjLmmFormLmCfm(pst, hdr, reason)
2325 TRC3(pjLmmFormLmCfm)
2329 if (reason == LCM_REASON_NOT_APPL)
2331 rCfm.cfm.status = LCM_PRIM_OK;
2332 rCfm.cfm.reason = LCM_REASON_NOT_APPL;
2338 rCfm.cfm.status = LCM_PRIM_NOK;
2339 rCfm.cfm.reason = reason;
2344 pjLmmSendCfm(pst, &rCfm, TCNTRL, hdr);
2347 } /* pjLmmFormLmCfm */
2351 Function gather the general PJU SAP status
2353 * @param[in] sta LM PJU Sap Status structure
2355 * -# Success : LCM_REASON_NOT_APPL
2356 * -# Failure : LCM_REASON_INVALID_PAR_VAL
2359 PRIVATE S16 pjLmmGetPjuSapSta
2362 PjPjuSapSta *sta /* PJU SAP status */
2365 PRIVATE S16 pjLmmGetPjuSapSta(gCb,sta)
2367 PjPjuSapSta *sta; /* PJU SAP status */
2371 TRC2(pjLmmGetPjuSapSta);
2373 /* Validate config parameters */
2374 if (sta->spId >= PJ_MAX_PJUSAPS )
2376 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2379 if (gCb->pjGenCfg.mode == LPJ_MODE_PDCP_UL)
2381 pjuSap = &(gCb->u.ulCb->pjuSap[sta->spId]);
2385 pjuSap = &(gCb->u.dlCb->pjuSap[sta->spId]);
2389 /* Get Sap control block */
2390 sta->state = pjuSap->state;
2392 RETVALUE(LCM_REASON_NOT_APPL);
2393 } /* pjLmmGetPjuSapSta */
2397 Function gather the general PJU SAP status
2399 * @param[in] sta LM PJU Sap Status structure
2401 * -# Success : LCM_REASON_NOT_APPL
2402 * -# Failure : LCM_REASON_INVALID_PAR_VAL
2405 PRIVATE S16 pjLmmGetKwuSapSta
2408 PjKwuSapSta *sta /* PJU SAP status */
2411 PRIVATE S16 pjLmmGetKwuSapSta(gCb,sta)
2413 PjKwuSapSta *sta; /* PJU SAP status */
2417 TRC2(pjLmmGetKwuSapSta);
2419 /* Validate config parameters */
2420 if (sta->spId >= PJ_MAX_PJUSAPS )
2422 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2425 if (gCb->pjGenCfg.mode == LPJ_MODE_PDCP_UL)
2427 kwuSap = &(gCb->u.ulCb->kwuSap[sta->spId]);
2431 kwuSap = &(gCb->u.dlCb->kwuSap[sta->spId]);
2434 /* Get Sap control block */
2435 sta->state = kwuSap->state;
2437 RETVALUE(LCM_REASON_NOT_APPL);
2438 } /* pjLmmGetKwuSapSta */
2442 Function gather the general PJU SAP status
2444 * @param[in] sta LM PJU Sap Status structure
2446 * -# Success : LCM_REASON_NOT_APPL
2447 * -# Failure : LCM_REASON_INVALID_PAR_VAL
2450 PRIVATE S16 pjLmmGetUdxSapSta
2453 PjUdxSapSta *sta /* PJU SAP status */
2456 PRIVATE S16 pjLmmGetUdxSapSta(gCb,sta)
2458 PjUdxSapSta *sta; /* PJU SAP status */
2461 PjUdxUlSapCb *udxUlSap;
2462 PjUdxDlSapCb *udxDlSap;
2463 TRC2(pjLmmGetUdxSapSta);
2465 /* Validate config parameters */
2466 if (sta->spId >= PJ_MAX_UDXSAPS ) /* KW_FIX */
2468 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2471 if (gCb->pjGenCfg.mode == LPJ_MODE_PDCP_UL)
2473 udxUlSap = &(gCb->u.ulCb->udxUlSap[sta->spId]);
2474 /* Get Sap control block */
2475 sta->state = udxUlSap->state;
2479 udxDlSap = &(gCb->u.dlCb->udxDlSap[sta->spId]);
2480 /* Get Sap control block */
2481 sta->state = udxDlSap->state;
2485 RETVALUE(LCM_REASON_NOT_APPL);
2486 } /* pjLmmGetKwuSapSta */
2491 Function gather the general CPJ SAP status
2493 * @param[in] sta LM CPJ Sap Status structure
2495 * -# Success : LCM_REASON_NOT_APPL
2496 * -# Failure : LCM_REASON_INVALID_PAR_VAL
2499 PRIVATE S16 pjLmmGetCpjSapSta
2502 PjCpjSapSta *sta /* RLU SAP status */
2505 PRIVATE S16 pjLmmGetCpjSapSta(sta)
2507 PjCpjSapSta *sta; /* RLU SAP status */
2511 TRC2(pjLmmGetCpjSapSta);
2513 if (gCb->pjGenCfg.mode == LPJ_MODE_PDCP_UL)
2515 cpjSap = &(gCb->u.ulCb->cpjSap);
2519 RETVALUE(LCM_REASON_INVALID_SAP);
2523 sta->state = cpjSap->state;
2525 RETVALUE(LCM_REASON_NOT_APPL);
2527 } /* pjLmmGetCpjSapSta */
2531 Gather the general statistics
2533 * @param[in] sts LM general statistics structure
2534 * @param[in] action action
2536 * -# Success : LCM_REASON_NOT_APPL
2537 * -# Failure : LCM_REASON_INVALID_PAR_VAL
2540 PRIVATE S16 pjLmmGetGenSts
2543 PjGenSts *sts, /* general statistics structure */
2544 Action action /* Action */
2547 PRIVATE S16 pjLmmGetGenSts(gCb, sts, action)
2549 PjGenSts *sts; /* general statistics structure */
2550 Action action; /* Action */
2553 PjGenSts *genSts; /* General statistics */
2555 TRC2(pjLmmGetGenSts);
2557 /* Validate protocol parameters */
2558 if ((action != LPJ_ZEROSTS) && (action != LPJ_NOZEROSTS))
2560 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2563 PJ_MEM_CPY (sts, &(gCb->pjGenSts), sizeof (PjGenSts));
2565 if(action == LPJ_ZEROSTS)
2567 genSts = &(gCb->pjGenSts);
2568 PJ_MEM_SET (genSts, 0, sizeof (PjGenSts));
2571 RETVALUE(LCM_REASON_NOT_APPL);
2572 } /* pjLmmGetGenSts */
2576 Gather the SAP statistics
2578 * @param[in] sts LM general statistics structure
2579 * @param[in] elmnt element
2580 * @param[in] action action
2582 * -# Success : LCM_REASON_NOT_APPL
2583 * -# Failure : LCM_REASON_INVALID_PAR_VAL
2586 PRIVATE S16 pjLmmGetSapSts
2589 PjMngmt *sts, /* PDCP layer management */
2590 Elmnt elmnt, /* element */
2591 Action action /* Action */
2594 PRIVATE S16 pjLmmGetSapSts(gCb, sts, elmnt, action)
2596 PjMngmt *sts; /* PDCP layer management */
2597 Elmnt elmnt; /* element */
2598 Action action; /* Action */
2601 PjPjuSapCb *pjuSapCb; /* PDCP User SAP control block */
2602 PjPjuSts *pjuSap; /* place holder for SAP statistics */
2604 TRC2(pjLmmGetSapSts);
2606 /* Validate protocol parameters */
2607 if (action != LPJ_ZEROSTS && action != LPJ_NOZEROSTS)
2609 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
2612 pjuSap = &sts->t.sts.s.pjuSap;
2614 /* Get Sap control block */
2615 /* pj005.201, modified suId to spId */
2617 pjuSapCb = (gCb->pjGenCfg.mode == LPJ_MODE_PDCP_DL)?
2618 (PjPjuSapCb*)(gCb->u.dlCb->pjuSap + pjuSap->spId):
2619 (PjPjuSapCb*)(gCb->u.ulCb->pjuSap + pjuSap->spId);
2622 pjuSap->rxSdus = pjuSapCb->sts.rxSdus;
2623 pjuSap->txSdus = pjuSapCb->sts.txSdus;
2625 if (action == LPJ_ZEROSTS)
2627 PJ_MEM_SET (&pjuSapCb->sts, 0, sizeof (PjPjuSts));
2630 SGetDateTime(&sts->t.sts.dt);
2632 RETVALUE(LCM_REASON_NOT_APPL);
2633 } /* pjLmmGetSapSts */
2638 This function sends Unsolicited Status Indication to the Layer Management
2641 * @param[in] category Category
2642 * @param[in] event event
2643 * @param[in] cause cause
2644 * @param[in] cause ueId
2647 /* pj005.201 added support for L2 Measurement */
2650 PUBLIC Void pjLmmSendAlarm
2653 U16 category, /* Category */
2654 U16 event, /* Alarm event */
2655 U16 cause, /* Alarm cause */
2656 SuId suId, /* suId */
2657 U32 ueId, /* ueId */
2661 PUBLIC Void pjLmmSendAlarm(gCb, category, event, cause, suId, ueId, qci)
2663 U16 category; /* Category */
2664 U16 event; /* Alarm event */
2665 U16 cause; /* Alarm cause */
2666 SuId suId; /* suId */
2667 U32 ueId; /* ueId */
2672 PUBLIC Void pjLmmSendAlarm
2675 U16 category, /* Category */
2676 U16 event, /* Alarm event */
2677 U16 cause, /* Alarm cause */
2678 SuId suId, /* suId */
2682 PUBLIC Void pjLmmSendAlarm(gCb, category, event, cause, suId, ueId)
2684 U16 category; /* Category */
2685 U16 event; /* Alarm event */
2686 U16 cause; /* Alarm cause */
2687 SuId suId; /* suId */
2688 U32 ueId; /* ueId */
2693 PjMngmt usta; /* Rlc Management Structure */
2695 TRC2(pjLmmSendAlarm);
2697 if(gCb->init.usta == FALSE)
2702 /* initialize the management structure */
2703 PJ_MEM_SET(&usta, 0, sizeof(PjMngmt));
2705 usta.hdr.elmId.elmnt = STGEN;
2706 usta.hdr.entId.ent = gCb->init.ent;
2707 usta.hdr.entId.inst = gCb->init.inst;
2709 /* fill in the event and category */
2710 usta.t.usta.alarm.category = category;
2711 usta.t.usta.alarm.event = event;
2712 usta.t.usta.alarm.cause = cause;
2714 /* set the suId and ueId */
2715 usta.t.usta.ueId = ueId;
2716 usta.t.usta.suId = suId;
2717 /* pj005.201 added support for L2 Measurement */
2719 if(event == LPJ_EVT_MEAS_HALT)
2721 usta.t.usta.qci = qci;
2725 /* update the date and time */
2726 (Void) SGetDateTime(&usta.t.usta.alarm.dt);
2728 PjMiLpjStaInd(&(gCb->init.lmPst), &usta);
2732 } /* pjLmmSendAlarm */
2736 This function sends trace indication to LM
2738 * @param[in] event event
2739 * @param[in] mBuf meessage buffer
2742 * -# Failure : RFAILED
2745 PUBLIC S16 pjLmmSendTrc
2748 Event event, /* event */
2749 Buffer *mBuf /* message buffer */
2752 PUBLIC S16 pjLmmSendTrc(gCb, event, mBuf)
2754 Event event; /* event */
2755 Buffer *mBuf; /* message buffer */
2758 /* patch pj004.201 Corrected pjLmmSendTrc function definition */
2759 PjMngmt trc; /* PDCP management control block */
2768 PJ_MEM_SET(&trc, 0, sizeof(PjMngmt));
2770 cmMemset((U8 *)&trc, 0, sizeof(PjMngmt));
2772 pst = gCb->init.lmPst;
2774 trc.t.trc.event = event;
2775 SGetDateTime(&trc.t.trc.dt);
2776 trc.cfm.status = LCM_PRIM_OK;
2777 trc.cfm.reason = LCM_REASON_NOT_APPL;
2781 /* Check if the whole buffer is to be sent in Trace indication */
2782 if(gCb->trcLen == LPJ_FULL_TRACE)
2784 if (SCpyMsgMsg(mBuf, pst.region, pst.pool, &dstMbuf)
2787 /* rg005.201 removed SPutSBuf on error */
2788 RLOG0(L_DEBUG,"SCpyMsgMsg Failed.");
2791 /* Send Trace Indication to Layer manager */
2792 PjMiLpjTrcInd(&pst, &trc, dstMbuf);
2794 /* check if only a specified number of bytes are to be sent */
2795 else if(gCb->trcLen > 0)
2797 /* Get the length of the recvd message buffer */
2798 if (SFndLenMsg(mBuf, &bufLen) != ROK)
2800 RLOG0(L_DEBUG, "SFndLenMsg Failed.");
2803 /* Check if the recvd buffer size is less than request trace len */
2804 if(bufLen < gCb->trcLen)
2806 /* Copy the whole of the recvd buffer in trace indication */
2808 if (SCpyMsgMsg(mBuf, pst.region, pst.pool, &dstMbuf)
2811 RLOG0(L_DEBUG, "pjLmmSendTrc(): SCpyMsgMsg Failed.");
2815 /* Send Trace Indication to Layer manager */
2816 PjMiLpjTrcInd(&pst, &trc, dstMbuf);
2818 /* if the recvd buffer size is greater than request trace len */
2819 if(bufLen >= gCb->trcLen)
2821 /* Get a temporary buffer to store the msg */
2822 PJ_ALLOC(gCb, tempBuf, gCb->trcLen);
2824 #if (ERRCLASS & ERRCLS_INT_PAR)
2825 if(tempBuf == NULLP)
2827 (Void) SPutSMem(PJ_GET_MEM_REGION(gCb), PJ_GET_MEM_POOL(gCb));
2828 RLOG0(L_FATAL, "Memory Allocation failed.");
2829 RETVALUE(LCM_REASON_MEM_NOAVAIL);
2831 #endif /* ERRCLASS & ERRCLS_INT_PAR */
2833 /* Copy trcLen nos of bytes from the recvd message */
2834 if (SCpyMsgFix(mBuf,0,gCb->trcLen,tempBuf,&tempCnt) != ROK)
2836 RLOG0(L_DEBUG, "SCpyMsgFix Failed.");
2840 if (SGetMsg(pst.region, pst.pool, &dstMbuf) != ROK)
2842 RLOG0(L_FATAL, "Memory Allocation failed.");
2845 /* Copy the tempBuf data to dst mBuf */
2846 if (SCpyFixMsg(tempBuf,dstMbuf,0,gCb->trcLen,&tempCnt) != ROK)
2848 RLOG0(L_DEBUG, "SCpyFixMsg Failed.");
2852 /* Free the memory allocated for tempBuf */
2853 PJ_FREE(gCb, tempBuf, gCb->trcLen);
2854 /* Send Trace Indication to Layer manager */
2855 PjMiLpjTrcInd(&pst, &trc, dstMbuf);
2861 PjMiLpjTrcInd(&pst, &trc, mBuf);
2866 } /* end of pjLmmSendTrc */
2871 * Fun: Activate Task - timer
2873 * Desc: Invoked by system services to activate a task with
2884 PUBLIC S16 pjActvTmr
2890 PUBLIC S16 pjActvTmr(ent,inst)
2898 if (inst >= PJ_MAX_PDCP_INSTANCES)
2902 gCb = PJ_GET_PJCB(inst);
2903 cmPrcTmr(&(gCb->pjTqCp), gCb->pjTq, (PFV) pjTmrExpiry);
2907 } /* end of pjActvTmr */
2911 it deregisters the timers and deregisters the kwuSap Control blocks
2916 PRIVATE Void pjLmmCleanGblRsrcs
2921 PRIVATE Void pjLmmCleanGblRsrcs(gCb)
2926 TRC2(pjLmmCleanGblRsrcs)
2928 if (gCb->init.cfgDone)
2930 /* Deregister the timers */
2931 (Void) SDeregTmrMt(gCb->init.ent, gCb->init.inst,
2932 (S16)gCb->pjGenCfg.timeRes, pjActvTmr);
2933 /*(Void) SDeregTmr(gCb->init.ent, gCb->init.inst,
2934 (S16)gCb->genCfg.timeRes, kwActvTmr);*/
2936 if (gCb->pjGenCfg.mode == LPJ_MODE_PDCP_DL)
2940 if (gCb->u.dlCb->kwuSap != (PjKwuSapCb *)NULLP)
2942 /*PJ_FREE(gCb,gCb->u.dlCb->kwuSap, kwSapSize); */
2945 PJ_FREE(gCb,gCb->u.dlCb, sizeof (PjDlgCb));
2953 if (gCb->u.ulCb->kwuSap != (PjKwuSapCb *)NULLP)
2955 /*PJ_FREE(gCb,gCb->u.ulCb->kwuSap, kwSapSize);*/
2958 PJ_FREE(gCb,gCb->u.ulCb, sizeof (PjUlgCb));
2962 (Void) SPutSMem(gCb->init.region, gCb->init.pool);
2963 gCb->init.cfgDone = FALSE;
2964 gCb->init.acnt = FALSE;
2965 gCb->init.trc = FALSE;
2966 gCb->init.usta = FALSE;
2970 } /* pjLmmCleanGblRsrcs */
2972 /********************************************************************30**
2975 **********************************************************************/