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