RLC BO, BO response and DL Data handling. [Issue-ID: ODUHIGH-181]
[o-du/l2.git] / src / 5gnrrlc / kw_udx_dl.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 *******************************************************************************/
18
19 /**********************************************************************
20  
21     Name:   LTE RLC layer
22  
23     Type:   C include file
24  
25     Desc:   Defines required by LTE MAC
26  
27     File:   kw_udx_dl.c
28
29 **********************************************************************/
30 static const char* RLOG_MODULE_NAME="UDX";
31 static int RLOG_MODULE_ID=262144;
32 static int RLOG_FILE_ID=203;
33
34 /* header include files (.h) */
35 #include "common_def.h"
36 #include "lkw.h"           /* LKW defines */
37 #include "ckw.h"           /* CKW defines */
38 #include "kwu.h"           /* KWU defines */
39 #include "rgu.h"           /* RGU defines */
40 #include "kw_err.h"        /* Err defines */
41 #include "kw_env.h"        /* RLC environment options */
42
43 #include "kw.h"            /* RLC defines */
44 #include "kw_udx.h"
45 #include "kw_dl.h"
46
47 /* extern (.x) include files */
48 #include "lkw.x"           /* LKW */
49 #include "ckw.x"           /* CKW */
50 #include "kwu.x"           /* KWU */
51 #include "rgu.x"           /* RGU */
52
53 #include "kw.x"
54 #include "kw_udx.x"
55 #include "kw_dl.x"
56
57
58 #define RLC_MODULE RLC_DBGMASK_UDX
59 /* local defines */
60
61 EXTERN S16 rlcDlmHndlStaRsp ARGS (( RlcCb  *gCb,RlcDlRbCb  *rbCb,
62                 RlcUdxStaPdu *pStaPdu, RlcUdxBufLst  *rlsPduLst));
63
64
65
66
67 /**
68   * @brief
69   * UDX APIs
70   */
71
72 /**
73  *
74  * @brief 
75  *    Handler to bind the DL with UL. 
76  *
77  * @param[in] pst   Post structure  
78  * @param[in] suId  Service user SAP ID 
79  * @param[in] spId  Service provider ID
80  *
81  * @return  S16
82  *    -# ROK 
83  *    -# RFAILED
84  */
85 #ifdef ANSI
86 S16 rlcDlUdxBndReq 
87 (
88 Pst    *pst,  
89 SuId   suId, 
90 SpId   spId 
91 )
92 #else
93 S16 rlcDlUdxBndReq (pst, suId, spId)
94 Pst    *pst;   
95 SuId   suId;  
96 SpId   spId; 
97 #endif
98 {
99    RlcUdxDlSapCb   *udxSap;            /* pointer to session SAP */
100    RlcCb           *tRlcCb;
101
102    TRC3(rlcDlUdxBndReq);
103
104 #if (ERRCLASS & ERRCLS_INT_PAR)
105    if (pst->dstInst >= MAX_RLC_INSTANCES)
106    {
107       return RFAILED;
108    }
109 #endif
110    tRlcCb = RLC_GET_RLCCB(pst->dstInst);
111
112    RLCDBGP_BRIEF(tRlcCb, "rlcDlUdxBndReq(spId(%d), suId(%d))\n", 
113                 spId, suId);
114
115    udxSap = (tRlcCb->u.dlCb->udxDlSap + spId);
116
117    /* Verify CKW SAP State */
118    switch(udxSap->state)
119    {
120       /* SAP is configured but not bound */
121       case RLC_SAP_CFG:
122       case RLC_SAP_UBND:
123       {
124          /* copy bind configuration parameters in SSAP sap */
125          udxSap->suId = suId;
126          udxSap->pst.dstProcId = pst->srcProcId;
127          udxSap->pst.dstEnt = pst->srcEnt;
128          udxSap->pst.dstInst = pst->srcInst;
129
130          /* Update the State */
131          udxSap->state = RLC_SAP_BND;
132
133          RLOG1(L_INFO, "UDX SAP state [%d]", udxSap->state);
134          break;
135       }
136       /* SAP is already bound */
137       case RLC_SAP_BND:
138       {
139          /* 
140           * Sap is already bound check source, destination Entity and 
141           * Proc Id
142           */
143          if (udxSap->pst.dstProcId != pst->srcProcId 
144                || udxSap->pst.dstEnt != pst->srcEnt
145                || udxSap->pst.dstInst != pst->srcInst
146                || udxSap->suId != suId)
147          {
148             RLC_SEND_SAPID_ALARM(tRlcCb, spId, 
149                                 LKW_EVENT_UDX_BND_REQ, LCM_CAUSE_INV_PAR_VAL);
150
151             RLOG0(L_ERROR, "UDX SAP already Bound");
152             rlcDlUdxBndCfm(&(udxSap->pst), udxSap->suId, CM_BND_NOK);
153          }
154          break;
155       }
156
157      default:
158       {
159 #if (ERRCLASS & ERRCLS_INT_PAR)
160          RLC_SEND_SAPID_ALARM(tRlcCb,spId, 
161                              LKW_EVENT_CKW_BND_REQ, LCM_CAUSE_INV_STATE);
162 #endif /* ERRCLASS & ERRCLS_INT_PAR */
163          RLOG0(L_ERROR, "Invalid UDX SAP State in Bind Req");
164          rlcDlUdxBndCfm(&(udxSap->pst), udxSap->suId, CM_BND_NOK);
165          break;
166       }
167    }
168    rlcDlUdxBndCfm(&(udxSap->pst), udxSap->suId, CM_BND_OK);
169    return ROK;
170
171
172 \f
173 /**
174  * @brief 
175  *    Handler for unbinding the DL from UL. 
176  *
177  *  @param[in] pst     Post structure  
178  *  @param[in] spId    Service provider SAP ID 
179  *  @param[in] reason  Reason for Unbinding 
180  *
181  *  @return  S16
182  *      -# ROK 
183  */
184 #ifdef ANSI
185 S16 rlcDlUdxUbndReq
186 (
187 Pst      *pst,    
188 SpId     spId,   
189 Reason   reason 
190 )
191 #else
192 S16 rlcDlUdxUbndReq(pst, spId, reason)
193 Pst      *pst;   
194 SpId     spId;   
195 Reason   reason; 
196 #endif
197 {
198    RlcUdxDlSapCb   *udxSap; 
199    RlcCb           *tRlcCb;
200
201    TRC3(rlcDlUdxUbndReq)
202
203 #if (ERRCLASS & ERRCLS_INT_PAR)
204    if (pst->dstInst >= MAX_RLC_INSTANCES)
205    {
206       return RFAILED;
207    }
208 #endif
209
210    tRlcCb = RLC_GET_RLCCB(pst->dstInst);
211
212    RLOG2(L_DEBUG,"Unbind Req for spId[%d], reason[%d]", 
213                 spId, reason);
214    UNUSED(reason);
215    /* disable upper sap (CKW) */
216    udxSap = (tRlcCb->u.dlCb->udxDlSap + spId);
217
218 #if (ERRCLASS & ERRCLS_INT_PAR)
219    RLC_GET_AND_VALIDATE_UDXSAP(tRlcCb,udxSap, EKW208, "KwUiDlUdxndReq");
220 #endif /* ERRCLASS & ERRCLS_INT_PAR */
221    udxSap->state = RLC_SAP_CFG;
222    return ROK;
223 }
224
225 \f
226 /**
227  * @brief 
228  *    Handler for configuring RLC entities.
229  *
230  * @details
231  *    This function is used by RRC to configure(add/delete/modify)
232  *    one or more RLC entities. 
233  *        - CKW_CFG_ADD          => rlcCfgAddRb
234  *        - CKW_CFG_MODIFY       => rlcCfgReCfgRb
235  *        - CKW_CFG_DELETE       => rlcCfgDelRb
236  *        - CKW_CFG_REESTABLISH  => rlcCfgReEstRb
237  *        - CKW_CFG_DELETE_UE    => rlcCfgDelUe
238  *
239  * @param[in] pst   -  Post structure  
240  * @param[in] spId  -  Serive Provider ID 
241  * @param[in] cfg   -  Configuration information for one or more RLC entities. 
242  *
243  * @return  S16
244  *    -# ROK 
245  *    -# RFAILED
246  */
247 #ifdef ANSI
248 S16 rlcDlUdxCfgReq
249 (
250 Pst          *pst,
251 SpId         spId,
252 RlcCfgInfo   *cfg
253 )
254 #else
255 S16 rlcDlUdxCfgReq(pst, spId, cfg)
256 Pst          *pst;
257 SpId         spId;
258 RlcCfgInfo   *cfg;
259 #endif
260 {
261    RlcCfgCfmInfo   *cfgCfm; 
262    U8              idx;    
263    RlcCb            *tRlcCb;
264    Pst             *pstUdxCfm;
265
266    TRC3(rlcDlUdxCfgReq)
267
268 #if (ERRCLASS & ERRCLS_INT_PAR)
269    if (pst->dstInst >= MAX_RLC_INSTANCES)
270    {
271       return RFAILED;
272    }
273 #endif
274
275    tRlcCb = RLC_GET_RLCCB(pst->dstInst);
276
277    pstUdxCfm = &(tRlcCb->u.dlCb->udxDlSap[spId].pst);
278    RLCDBGP_BRIEF(tRlcCb,"spId(%d)\n", spId);
279    /* Allocate memory and memset to 0 for cfmInfo */
280    RLC_ALLOC_SHRABL_BUF_WC(pstUdxCfm->region,
281                           pstUdxCfm->pool,
282                           cfgCfm,
283                           sizeof(RlcCfgCfmInfo));
284
285 #if (ERRCLASS & ERRCLS_ADD_RES)
286    if (cfgCfm == NULLP)
287    {
288       RLOG0(L_FATAL,"Memory Allocation Failed.");
289       /* kw002.201 Freeing from proper region */
290       /* RLC_PST_FREE(pst->region, pst->pool, cfg, sizeof(RlcCfgInfo)); */
291       return RFAILED;
292    }
293 #endif /* ERRCLASS & ERRCLS_ADD_RES */
294
295    /* For every entity configuration process by cfgType */
296    for (idx = 0; idx < cfg->numEnt; idx++)
297    {
298       RlcEntCfgCfmInfo   *entCfgCfm;
299       RlcEntCfgInfo      *entCfg;
300
301       entCfg  = (RlcEntCfgInfo *)&(cfg->entCfg[idx]);
302       entCfgCfm   = (RlcEntCfgCfmInfo *)&(cfgCfm->entCfgCfm[idx]);
303
304       switch (entCfg->cfgType)
305       {
306          case CKW_CFG_ADD:
307             {
308                if (entCfg->dir & RLC_DIR_DL)
309                { 
310                   /* Add a new RB entity configuration */
311                   if (rlcCfgAddDlRb(tRlcCb,cfg->ueId, cfg->cellId,\
312                               entCfg, entCfgCfm) != ROK)
313                   {
314                      RLOG_ARG1(L_ERROR,DBG_RBID,cfg->entCfg[idx].rbId,"Addition Failed due to[%d]",
315                            entCfgCfm->status.reason);
316                   }
317                }
318                break;
319             }
320          case CKW_CFG_MODIFY:
321             {
322                if (entCfg->dir & RLC_DIR_DL)
323                {
324                   /* Re-configure the existing RB entity configuration */
325                   if (rlcCfgReCfgDlRb(tRlcCb,cfg->ueId, cfg->cellId,\
326                            entCfg, entCfgCfm) != ROK)
327                   {
328                      RLOG_ARG1(L_ERROR,DBG_RBID,cfg->entCfg[idx].rbId,"ReCfg Failed due to[%d]",
329                            entCfgCfm->status.reason);
330                   }
331                }
332                break;
333             }
334
335          case CKW_CFG_DELETE:
336             {
337                if (entCfg->dir & RLC_DIR_DL)
338                {
339                   /* Delete the existing RB entity configuration */
340                   if (rlcCfgDelDlRb(tRlcCb,cfg->ueId, cfg->cellId,\
341                         entCfg, entCfgCfm) != ROK)
342                   {
343                      RLOG_ARG1(L_ERROR,DBG_RBID,cfg->entCfg[idx].rbId,"Deletion Failed due to[%d]",
344                            entCfgCfm->status.reason);
345                   } 
346                }
347                break;
348             }
349
350          case CKW_CFG_REESTABLISH:
351             {
352                if (entCfg->dir & RLC_DIR_DL)
353                {
354                   /*if direction is both then, re-establishment end indication
355                    * should be sent only from the UL instance, only if DIR is
356                    * DL only then DL instance will send indication.*/
357                   Bool sndReEst = TRUE;
358                   if (entCfg->dir & RLC_DIR_UL)
359                   {
360                      sndReEst = FALSE;
361                   }
362                   /* Re-establish the existing RB entity configuration */
363                   if (rlcCfgReEstDlRb(tRlcCb,cfg->ueId, cfg->cellId,
364                                      sndReEst,entCfg, entCfgCfm) != ROK)
365                   {
366                      RLOG_ARG1(L_ERROR,DBG_RBID,cfg->entCfg[idx].rbId,"Reest Failed due to[%d]",
367                            entCfgCfm->status.reason);
368                   }
369                }
370                break;
371             }
372
373          case CKW_CFG_DELETE_UE:
374             {
375                /* Delete all RB entity configuration under UE */
376                if (rlcCfgDelDlUe(tRlcCb,cfg->ueId, cfg->cellId,
377                                 entCfg, entCfgCfm) != ROK)
378                {
379                   RLOG_ARG1(L_ERROR,DBG_UEID,cfg->ueId,"deletion Failed due to[%d]",
380                            entCfgCfm->status.reason);
381                }
382                break;
383             }
384          case CKW_CFG_DELETE_CELL:
385             {
386                if (rlcCfgDelDlCell(tRlcCb,cfg->cellId,entCfg,entCfgCfm) 
387                                                                 != ROK )
388                {
389                   RLOG_ARG1(L_ERROR,DBG_CELLID,cfg->cellId,"deletion Failed due to[%d]",
390                            entCfgCfm->status.reason);
391                } 
392                break;
393             }
394
395          default:
396             {
397                RLC_CFG_FILL_CFG_CFM(entCfgCfm, entCfg->rbId, entCfg->rbType,\
398                                    CKW_CFG_CFM_NOK, CKW_CFG_REAS_INVALID_CFG);
399                RLOG0(L_ERROR, "Invalid CfgType");
400             }
401       }
402    }
403
404    /* Assign number of entity configuraitons and suId */
405    cfgCfm->transId = cfg->transId;
406    cfgCfm->ueId = cfg->ueId;
407    cfgCfm->cellId = cfg->cellId;
408    cfgCfm->numEnt = cfg->numEnt;
409
410    /* kw002.201 Freeing from proper region */
411    /* RLC_PST_FREE(pst->region, pst->pool, cfg, sizeof(RlcCfgInfo)); */
412    /* Send Configuration confirm primitive */
413    rlcDlUdxCfgCfm(&(tRlcCb->u.dlCb->udxDlSap[spId].pst),
414                  tRlcCb->u.dlCb->udxDlSap[spId].suId, 
415                  cfgCfm);
416
417    return ROK;
418
419
420 /**
421  *@brief 
422  *   This primitive is used by RRC to change the UeId for the existing UE
423  *   context.
424  *
425  * @param pst     -  Pointer to the pst structure
426  * @param spId    -  The ID of the service provider SAP in the RLC layer 
427  * @param transId -  Transaction ID. This field uniquily identifies
428  *                   transaction between RRC and RLC
429  * @param ueInfo    -  Old UE Id Info for which the change request has come 
430  * @param newUeInfo -  New UE Id Info for existing UE context 
431  * 
432  * @return 
433  *    -# ROK
434  *    -# RFAILED
435  */
436 #ifdef ANSI
437 S16 rlcDlUdxUeIdChgReq
438 (
439 Pst         *pst, 
440 SpId        spId, 
441 U32         transId, 
442 CkwUeInfo   *ueInfo,
443 CkwUeInfo   *newUeInfo
444 )
445 #else
446 S16 rlcDlUdxUeIdChgReq(pst,spId,transId,ueInfo,newUeInfo)
447 Pst         *pst;
448 SpId        spId;
449 U32         transId;
450 CkwUeInfo   *ueInfo;
451 CkwUeInfo   *newUeInfo;
452 #endif
453 {
454    CmStatus       status;
455    RlcCb           *tRlcCb;
456
457    TRC3(rlcDlUdxUeIdChgReq)
458
459 #if (ERRCLASS & ERRCLS_INT_PAR)
460    if (pst->dstInst >= MAX_RLC_INSTANCES)
461    {
462       return RFAILED;
463    }
464 #endif
465
466    tRlcCb = RLC_GET_RLCCB(pst->dstInst);
467 #ifndef ALIGN_64BIT
468    RLCDBGP_BRIEF(tRlcCb, "(spId(%d), transId(%ld))\n", 
469                 spId, transId);
470 #else
471    RLCDBGP_BRIEF(tRlcCb, "(spId(%d), transId(%d))\n", 
472                 spId, transId);
473 #endif
474
475    status.reason = CKW_CFG_REAS_NONE;
476    status.status = CKW_CFG_CFM_OK;
477    
478    if (rlcCfgDlUeIdChng(tRlcCb, ueInfo, newUeInfo, &status) != ROK)
479    {
480       RLOG_ARG1(L_ERROR,DBG_CELLID,newUeInfo->cellId,"Failure due to[%d]",
481              status.reason);
482    }
483    rlcDlUdxUeIdChgCfm(&(tRlcCb->u.dlCb->udxDlSap[spId].pst),
484                      tRlcCb->u.dlCb->udxDlSap[spId].suId, 
485                      transId, 
486                      status);
487
488    return ROK;
489
490
491 /**
492 * @brief 
493 *    Request for status PDU from  ULM to DLM.
494 *
495 * @param[in]   pst   -  Post Structure
496 * @param[in]   spId  -  Service Provider Id
497 * @param[in]   rlcId -  Rlc Information Id
498 * @param[in]   pStaPdu - Status PDU 
499 *  
500 * @return   S16
501 *    -# ROK
502 *    -# RFAILED
503 **/
504 #ifdef ANSI
505 S16  rlcDlUdxStaPduReq
506 (
507 Pst             *pst,
508 SpId            spId,
509 CmLteRlcId      *rlcId,
510 RlcUdxDlStaPdu   *pStaPdu
511 )
512 #else
513 S16  rlcDlUdxStaPduReq(pst, spId, rlcId, pStaPdu)
514 Pst             *pst;
515 SpId            spId;
516 CmLteRlcId      *rlcId;
517 RlcUdxDlStaPdu   *pStaPdu;
518 #endif
519 {
520    RlcDlRbCb   *rbCb;
521    RlcCb       *tRlcCb;
522
523    tRlcCb =  RLC_GET_RLCCB (pst->dstInst);
524
525    rlcDbmFetchDlRbCbByRbId(tRlcCb, rlcId, &rbCb); /* Fetch DBM RbCb */
526    if (!rbCb)
527    {
528       RLOG_ARG2(L_ERROR, DBG_UEID,rlcId->ueId, "CellId [%u]:RbId[%d] not found",
529             rlcId->cellId,rlcId->rbId);
530       RLC_FREE_SHRABL_BUF(pst->region, 
531                          pst->pool, 
532                          pStaPdu, 
533                          sizeof(RlcUdxDlStaPdu));
534       return RFAILED;
535    }
536
537    AMDL.cntrlBo = pStaPdu->controlBo;
538    /* If there already exists a STAUS PDU, free it and take the new one
539       into account */
540    if(AMDL.pStaPdu)
541    {
542       RLC_FREE_SHRABL_BUF(pst->region, 
543                          pst->pool, 
544                          AMDL.pStaPdu, 
545                          sizeof(RlcUdxDlStaPdu));
546    }
547    
548    AMDL.pStaPdu = pStaPdu;
549    rlcAmmSendDedLcBoStatus(tRlcCb, rbCb, &AMDL);             
550
551    return  (ROK);
552 }
553
554 /**
555 * @brief 
556 *    It handles the status update recieved from ULM.
557 *
558 * @param[in]   pst   -  Post Structure
559 * @param[in]   spId  -  Service Provider Id
560 * @param[in]   rlcId -  Rlc Information Id
561 * @param[in]   pStaPdu - Status PDU 
562 *  
563 * @return   S16
564 *    -# ROK
565 *    -# RFAILED
566 **/
567 #ifdef ANSI
568 S16  rlcDlUdxStaUpdReq
569 (
570 Pst*          pst,
571 SpId          spId,
572 CmLteRlcId    *rlcId,
573 RlcUdxStaPdu   *pStaPdu
574 )
575 #else
576 S16 rlcDlUdxStaUpdReq(pst, spId, rlcId,pStaPdu)
577 Pst*          pst;
578 SpId          spId;
579 CmLteRlcId    *rlcId;
580 RlcUdxStaPdu   *pStaPdu;
581 #endif
582 {
583    RlcCb          *tRlcCb;
584    RlcDlRbCb      *rbCb;
585
586    tRlcCb = RLC_GET_RLCCB(pst->dstInst);
587
588    rlcDbmFetchDlRbCbByRbId(tRlcCb, rlcId, &rbCb);
589    if (!rbCb)
590    {
591       RLOG_ARG2(L_ERROR, DBG_UEID,rlcId->ueId, "CellId [%u]:RbId[%d] not found",
592             rlcId->cellId,rlcId->rbId);
593       return RFAILED;
594    }
595
596    rlcAmmDlHndlStatusPdu(tRlcCb, rbCb, pStaPdu);
597
598    RLC_FREE_SHRABL_BUF(pst->region,
599                       pst->pool, 
600                       pStaPdu, 
601                       sizeof(RlcUdxStaPdu));
602
603    return ROK;
604 }
605
606 #ifdef LTE_L2_MEAS
607 /**
608 */
609 #ifdef ANSI
610 S16 rlcDlUdxL2MeasReq 
611 (
612 Pst            *pst, 
613 RlcL2MeasReqEvt *measReqEvt 
614 )
615 #else
616 S16 rlcDlUdxL2MeasReq (pst, measReqEvt)
617 Pst            *pst; 
618 RlcL2MeasReqEvt *measReqEvt;
619 #endif
620 {
621    U32            cntr;
622    U8             measType;
623    VOLATILE U32     startTime = 0;
624    RlcCb     *tRlcCb;
625
626    TRC3(rlcDlUdxL2MeasReq);
627
628    /*starting Task*/
629    SStartTask(&startTime, PID_RLC_MEAS_START);
630
631    tRlcCb =  RLC_GET_RLCCB(pst->dstInst);
632
633    /* Initialize measCfmEvt */
634
635   /* validate the received measReqEvt */
636  /*LTE_L2_MEAS_PHASE2*/
637
638    measType = measReqEvt->measReq.measType;
639
640    if(measType & LKW_L2MEAS_DL_IP) 
641    {
642       /* if measurement is for DL IP enable for all QCI */
643       for(cntr = 0; cntr < LKW_MAX_QCI; cntr++)
644       {
645          tRlcCb->u.dlCb->rlcL2Cb.measOn[cntr] |= LKW_L2MEAS_DL_IP;
646       }
647    }
648    else
649    {
650       /* for nonIpThroughput meas, enable only for the sent QCIs */
651       U32 i;
652       for(i = 0; i < LKW_MAX_QCI; i++)
653       {
654          tRlcCb->u.dlCb->rlcL2Cb.measOn[i] |= measType;
655       }
656    }
657
658    /* We need to copy the transId for sending back confirms later */
659    for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
660    {
661       RlcL2MeasEvtCb* measEvtCb = &(tRlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[cntr]);
662       if(measEvtCb->measCb.measType & measType)
663       {
664          measEvtCb->transId= measReqEvt->transId;
665       }
666    }
667
668    /*stopping Task*/
669    SStopTask(startTime, PID_RLC_MEAS_START);
670    return ROK;
671 } /* rlcDlUdxMeasReq */
672
673 /**
674 @brief 
675 This function processes L2 Measurement stop request received from the layer manager.
676 After receving this request, RLC stops L2 Measurement
677  *  @param[in] pst      post structure
678  *  @param[in] measType meas Type 
679  *  @return S16
680  *      -# Success : ROK
681  *      -# Failure : RFAILED
682 */
683
684 #ifdef ANSI
685 S16 rlcDlUdxL2MeasStopReq
686 (
687 Pst            *pst,
688 U8             measType
689 )
690 #else
691 S16 rlcDlUdxL2MeasStopReq (pst, measType)
692 Pst            *pst;
693 U8             measType;
694 #endif
695 {
696   /* S16 ret = ROK;*/
697    RlcL2MeasEvtCb *measEvtCb = NULLP;
698    U16            cntr;
699    U8             status = ROK;
700 /*   RlcL2MeasCfmEvt          measCfmEvt;  */
701    VOLATILE U32     startTime = 0;
702    RlcCb     *tRlcCb=NULLP;
703    TRC3(rlcDlUdxMeasStopReq);
704    
705    /*starting Task*/
706    SStartTask(&startTime, PID_RLC_MEAS_STOP);
707
708    tRlcCb =  RLC_GET_RLCCB(pst->dstInst);
709 /*   cmMemset((U8*)&measCfmEvt, 0, sizeof(RlcL2MeasCfmEvt)); */
710    /* reset the counters for the measurement type passed */
711    for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
712    {
713       measEvtCb = &(tRlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[cntr]);
714       if(measEvtCb->measCb.measType & measType)
715       {
716          rlcUtlResetDlL2MeasInRlcRb(tRlcCb, &measEvtCb->measCb, measType);
717
718       }
719    }
720
721    /* switch off the measurements for the type passed */
722    for(cntr = 0; cntr < LKW_MAX_QCI; cntr++)
723    {
724       tRlcCb->u.dlCb->rlcL2Cb.measOn[cntr] &= ~measType;
725    }
726    
727    status = LCM_PRIM_OK;
728    /* Stop confirm is removed as UL thread is already sending it */
729    
730    /*stopping Task*/
731    SStopTask(startTime, PID_RLC_MEAS_STOP);
732
733    return ROK;
734 }
735 /**
736 @brief 
737 This function processes L2 Measurement Send request received from the layer manager.
738 After receving this request, RLC sends L2 Measurement
739  *  @param[in] pst      post structure
740  *  @param[in] measType meas Type 
741  *  @return S16
742  *      -# Success : ROK
743  *      -# Failure : RFAILED
744 */
745
746 #ifdef ANSI
747 S16 rlcDlUdxL2MeasSendReq
748 (
749 Pst            *pst,
750 U8             measType
751 )
752 #else
753 S16 rlcDlUdxL2MeasSendReq (pst, measType)
754 Pst            *pst;
755 U8             measType;
756 #endif
757 {
758    RlcL2MeasEvtCb *measEvtCb;
759    U16            cntr;
760    
761    VOLATILE U32     startTime = 0;
762    RlcCb     *tRlcCb;
763    TRC3(rlcDlUdxMeasSendReq);
764
765    tRlcCb =  RLC_GET_RLCCB(pst->dstInst);
766    for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
767    {
768       measEvtCb = &(tRlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[cntr]);
769       if(measEvtCb->measCb.measType & measType)
770       {
771          /*starting Task*/
772          SStartTask(&startTime, PID_RLC_MEAS_REPORT);
773
774          rlcUtlSndDlL2MeasCfm(tRlcCb, measEvtCb);
775
776          /*stopping Task*/
777          SStopTask(startTime, PID_RLC_MEAS_REPORT);
778       }
779    }
780
781    return ROK;
782 }
783 #endif /* LTE_L2_MEAS */
784
785 #ifdef __cplusplus
786 }
787 #endif /* __cplusplus */
788
789 \f
790 /**********************************************************************
791          End of file
792 **********************************************************************/