Deleted the rlog folder
[o-du/l2.git] / src / 5gnrrlc / kw_ptui.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**
20   
21         Name:    NR RLC Layer - Upper Interface
22     
23         Type:    C file
24   
25         Desc:    C source code for the upper interface of NR RLC
26  
27         File:    kw_ptui.c
28   
29 *********************************************************************21*/
30
31 /** @file kw_ptui.c
32 @brief RLC Upper Interface
33 */
34
35 \f
36 /* header (.h) include files */
37 #include "common_def.h"
38 #include "lkw.h"           /* LKW defines */
39 #include "ckw.h"           /* CKW defines */
40 #include "kwu.h"           /* KWU defines */
41 #include "rgu.h"           /* RGU defines */
42
43 #include "kw_err.h"
44 #include "kw_env.h"        /* RLC environment options */
45 #include "kw.h"            /* RLC defines */
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 #if defined(MAC_RLC_UL_RBUF) || (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF)) || defined(SS_RBUF)
53 #include "ss_rbuf.h"
54 #include "ss_rbuf.x"
55 #endif
56 #include "kw.x"
57 #if defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF)
58 #include "mt_plat_t33.h"
59 #include "mt_plat_t33.x"
60 #endif
61
62 #ifdef __cplusplus
63 extern "C" {
64 #endif /* __cplusplus */
65
66 \f  
67 /*********************************************************************
68  *             Forward Declartion for KWU Porting Functions
69  ********************************************************************/
70 #if defined(PDCP_RLC_DL_RBUF) || defined(SS_RBUF)
71 S16 rlcDlBatchProc ARGS ((Void));
72 S16 rlcUtlDlFreeRlcRBuf ARGS((Void));
73 void rlcUtlDlBatchProcHqStaInd ARGS ((Void));
74 Void rlcUtlFreeDlMem ARGS((Void));
75 SsRngBufCnt rngCb;
76 S16 rlcUtlDlBatchProcPkts ARGS((Void));
77 #endif
78
79 #if (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF))
80 S16 rlcDlBatchProcSplit  ARGS((Void));
81 #endif
82
83 \f  
84 /*********************************************************************
85  *             Primitives for KWU interface 
86  ********************************************************************/
87
88 /* KWU Bind Confirm primitive */
89
90 KwuBndCfm kwUiKwuBndCfmMt[] =
91 {
92 #ifdef LCKWUIKWU
93    cmPkKwuBndCfm,            /* 0 - loosely coupled */
94 #endif /* LCKWUIKWU */
95 #ifdef NH
96    NhLiKwuBndCfm,            /* 1 - tightly coupled, RRC  */
97 #endif /* NH */
98 #ifndef KW_PDCP
99 #ifdef PJ
100    PjLiKwuBndCfm,            /* 2 - tightly coupled, PDCP */
101 #endif /* NH */
102 #endif /* KW_PDCP */
103 #ifndef TENB_ACC
104 #ifdef LWLCKWUIKWU
105    cmPkKwuBndCfm,      /* 3 - light weight loosely coupled */ 
106 #endif /* LCKWUIKWU */
107 #endif /*TENB_ACC*/
108 };
109
110 /* KWU Data Indication primitive */
111
112 KwuDatInd kwUiKwuDatIndMt[] =
113 {
114 #ifdef LCKWUIKWU
115    cmPkKwuDatInd,            /* 0 - loosely coupled */
116 #endif /* LCKWUIKWU */
117 #ifdef NH
118    NhLiKwuDatInd,            /* 1 - tightly coupled, RRC  */
119 #endif /* NH */
120 #ifdef KW_PDCP
121 #else
122 #ifdef PJ
123    PjLiKwuDatInd,            /* 2 - tightly coupled, PDCP */
124 #endif /* NH */
125 #ifndef TENB_ACC
126 #ifdef LWLCKWUIKWU
127    cmPkKwuDatInd,         /* 3 - light weight loosely coupled */ 
128 #endif /* LCKWUIKWU */
129 #endif /*TENB_ACC*/
130 #endif /* KW_PDCP */
131 };
132
133 #ifndef KW_PDCP
134 KwuDatCfm kwUiKwuDatCfmMt[] =
135 {
136 #ifdef LCKWUIKWU
137    cmPkKwuDatCfm,            /* 0 - loosely coupled */
138 #endif /* LCKWUIKWU */
139 #ifdef PJ
140    PjLiKwuDatCfm,            /* 2 - tightly coupled, PDCP */
141 #endif /* PJ */
142 #ifndef TENB_ACC
143 #ifdef LWLCKWUIKWU
144    cmPkKwuDatCfm,         /* 3 - light weight loosely coupled */ 
145 #endif /* LCKWUIKWU */
146 #endif /*TENB_ACC*/
147 };
148
149 /* KWU AM Status Indication primitive */
150
151 KwuStaInd kwUiKwuStaIndMt[] =
152 {
153 #ifdef LCKWUIKWU
154    cmPkKwuStaInd,            /* 0 - loosely coupled */
155 #endif /* LCKWUIKWU */
156 #ifdef PJ
157    PjLiKwuStaInd,            /* 2 - tightly coupled, PDCP */
158 #endif /* PJ */
159 #ifndef TENB_ACC
160 #ifdef LWLCKWUIKWU
161    cmPkKwuStaInd,         /* 3 - light weight loosely coupled */ 
162 #endif /* LCKWUIKWU */
163 #endif /*TENB_ACC*/
164 };
165
166 KwuReEstCmpInd kwUiKwuReEstCmpIndMt[] =
167 {
168 #ifdef LCKWUIKWU
169    cmPkKwuReEstCmpInd,            /* 0 - loosely coupled */
170 #endif /* LCKWUIKWU */
171 #ifdef PJ
172    PjLiKwuReEstCmpInd,            /* 2 - tightly coupled, PDCP */
173 #else
174 #endif /* PJ */
175 #ifndef TENB_ACC
176 #ifdef LWLCKWUIKWU
177    cmPkKwuReEstCmpInd,    /* 3 - light weight loosely coupled */ 
178 #endif /* LCKWUIKWU */
179 #endif /*TENB_ACC*/
180 };
181
182 /* kw005.201 added support for L2 measurement */
183 KwuDiscSduCfm kwUiKwuDiscSduCfmMt[] =
184 {
185 #ifdef LCKWUIKWU
186    cmPkKwuDiscSduCfm,            /* 0 - loosely coupled */
187 #endif /* LCKWUIKWU */
188 #ifdef PJ
189    PjLiKwuDiscSduCfm,            /* 2 - tightly coupled, PDCP */
190 #endif
191 #ifndef TENB_ACC
192 #ifdef LWLCKWUIKWU
193    cmPkKwuDiscSduCfm,    /* 3 - light weight loosely coupled */    
194 #endif /* PJ */
195 #endif /*TENB_ACC*/
196 };
197 KwuFlowCntrlInd kwUiKwuFlowCntrlIndMt[] =
198 {
199 #ifdef LCKWUIKWU
200    cmPkKwuFlowCntrlInd,            /* 0 - loosely coupled */
201 #endif /* LCKWUIKWU */
202 #ifdef PJ
203    PjLiKwuFlowCntrlInd,            /* 2 - tightly coupled, PDCP */
204 #endif /* PJ */
205 #ifdef LCKWUIKWU
206    cmPkKwuFlowCntrlInd,            /* 3 - light weight loosely coupled */
207 #endif /* LCKWUIKWU */
208 };
209 #ifdef LTE_L2_MEAS
210 KwuDatAckInd kwUiKwuDatAckIndMt[] =
211 {
212 #ifdef LCKWUIKWU
213    cmPkKwuDatAckInd,            /* 0 - loosely coupled */
214 #endif /* LCKWUIKWU */
215 #ifdef PJ
216    PjLiKwuDatAckInd,            /* 2 - tightly coupled, PDCP */
217 #endif /* PJ */
218 #ifndef TENB_ACC
219 #ifdef LWLCKWUIKWU
220    cmPkKwuDatAckInd,     /* 3 - light weight loosely coupled, portable */          
221 #endif /* PJ */
222 #endif /*TENB_ACC*/
223 };
224 #endif /* LTE_L2_MEAS */
225 /* KWU AM Data confirm primitive */
226
227 #endif /* KW_PDCP */
228
229 \f  
230 /****************************************************************************
231  *                         KWU Interface Mt functions
232  ***************************************************************************/\f
233 /**
234  *
235  * @brief 
236  *
237  *        Handler for confirming  the bind request received from KWU
238  *        interface.
239  *
240  * @b Description:
241  *
242  *        This function send the bind confirm primitive to the RLC user,
243  *        when it receives a bind request from its service user.
244  *
245  *  @param[in] pst     Post structure  
246  *  @param[in] suId    Service user SAP ID 
247  *  @param[in] status  Status of Confirmation 
248  *
249  *  @return  S16
250  *      -# ROK 
251  *
252  */
253 S16 RlcUiKwuBndCfm
254 (
255 Pst     *pst,                       /* post structure */
256 SuId    suId,                      /* Service User Id */
257 uint8_t status                     /* Status */
258 )
259 {
260
261    /* jump to specific primitive depending on configured selector */
262    (*kwUiKwuBndCfmMt[pst->selector])(pst, suId, status);
263
264    return ROK;
265
266 } /* end of RlcUiKwuBndCfm */
267
268 \f
269 /**
270  *
271  * @brief 
272  *
273  *        Handler for sending the data(SDU) from upper layer. 
274  *
275  * @b Description:
276  *
277  *        This function is used to transfer a SDU received from the peer
278  *        RLC entity to the service user(RRC/PDCP).
279  *
280  *  @param[in] pst         Post structure  
281  *  @param[in] suId        Service User SAP ID 
282  *  @param[in] datIndInfo  Data Request Information
283  *  @param[in] mBuf         Data Buffer (SDU) 
284  *
285  *  @return  S16
286  *      -# ROK 
287  *      -# RFAILED
288  */
289 S16 rlcSendUlDataToDu
290 (
291 Pst               *pst,
292 KwuDatIndInfo     *datInd,
293 Buffer            *mBuf
294 )
295 {
296
297    /* jump to specific primitive depending on configured selector */
298    (*kwUiKwuDatIndMt[pst->selector])(pst, datInd, mBuf);
299
300    return ROK;
301
302 } /* end of rlcSendUlDataToDu */
303
304    int rlcDatCfmsSent = 0;
305 \f
306 #ifndef KW_PDCP
307 /**
308  *
309  * @brief 
310  *
311  *        Handler for sending the data confirmation to upper layer. 
312  *
313  * @b Description:
314  *
315  *        This function is used to send a confirmation to the service
316  *        user about the data received by the peer RLC entity. 
317  *
318  *  @param[in] pst         Post structure  
319  *  @param[in] suId        Service User SAP ID 
320  *  @param[in] datCfmInfo  Data Confirmation Information
321  *
322  *  @return  S16
323  *      -# ROK 
324  *      -# RFAILED
325  */
326 S16 RlcUiKwuDatCfm
327 (
328 Pst            *pst,
329 SuId           suId,
330 KwuDatCfmInfo  *datCfm
331 )
332 {
333    rlcDatCfmsSent++;
334
335    /* jump to specific primitive depending on configured selector */
336    (*kwUiKwuDatCfmMt[pst->selector])(pst, suId, datCfm);
337
338    return ROK;
339
340 } /* end of RlcUiKwuDatCfm */
341
342 \f
343 /**
344  *
345  * @brief 
346  *
347  *        Handler for sending the Status Indication to the upper layer. 
348  *
349  * @b Description:
350  *
351  *        This function is used only by RLC AM entity.It send status 
352  *        indication to the upper layer about the maximum number of 
353  *        re-transmissions reached for a RLC AM entity. 
354  *
355  *  @param[in] pst         Post structure  
356  *  @param[in] suId        Service User SAP ID 
357  *  @param[in] staInd      RLC Entity Id  
358  *
359  *  @return  S16
360  *      -# ROK 
361  *      -# RFAILED
362  */
363 S16 RlcUiKwuStaInd
364 (
365 Pst               *pst,
366 SuId              suId,
367 KwuStaIndInfo     *staInd
368 )
369 {
370
371    /* jump to specific primitive depending on configured selector */
372    (*kwUiKwuStaIndMt[pst->selector])(pst, suId, staInd);
373
374    return ROK;
375
376 } /* end of RlcUiKwuStaInd */
377
378 \f
379 /**
380  *
381  * @brief 
382  *
383  *        Handler for sending the Status Indication to the upper layer. 
384  *
385  * @b Description:
386  *
387  *        This function is used only by RLC AM entity.It send status 
388  *        indication to the upper layer about the maximum number of 
389  *        re-transmissions reached for a RLC AM entity. 
390  *
391  *  @param[in] pst         Post structure  
392  *  @param[in] suId        Service User SAP ID 
393  *  @param[in] staInd      RLC Entity Id  
394  *
395  *  @return  S16
396  *      -# ROK 
397  *      -# RFAILED
398  */
399 S16 RlcUiKwuReEstCmpInd
400 (
401 Pst               *pst,
402 SuId              suId,
403 CmLteRlcId        rlcId
404 )
405 {
406    DU_LOG("\nINFO   --> RLC : In RlcUiKwuReEstCmpInd");
407
408    /* jump to specific primitive depending on configured selector */
409    (*kwUiKwuReEstCmpIndMt[pst->selector])(pst, suId, rlcId);
410
411    return ROK;
412
413 } /* end of RlcUiKwuReEstCmpInd */
414 /* kw005.201 added support for L2 Measurement */
415 \f
416 /**
417  *
418  * @brief 
419  *
420  *        Handler for sending the Sdu Disc Cfm  to the upper layer. 
421  *
422  * @b Description:
423  *       
424  *       This function confirms the discard of an SDU .
425  *
426  *  @param[in] pst         Post structure  
427  *  @param[in] suId        Service User SAP ID 
428  *  @param[in] discCfm     Disc information.
429  *
430  *  @return  S16
431  *      -# ROK 
432  *      -# RFAILED
433  */
434 S16 RlcUiKwuDiscSduCfm
435 (
436 Pst               *pst,
437 SuId              suId,
438 KwuDiscSduInfo    *discCfm
439 )
440 {
441
442    /* jump to specific primitive depending on configured selector */
443    (*kwUiKwuDiscSduCfmMt[pst->selector])(pst, suId, discCfm);
444
445    return ROK;
446
447 } /* end of RlcUiKwuDiscSduCfm */ 
448
449 /**
450  *
451  * @brief 
452  *
453  *        Handler for sending Flow indication to the upper layer. 
454  *
455  * @b Description:
456  *       
457  *       This function indicates to PDCP if packets need to be stopped or
458  *       started for a particular RB
459  *
460  *  @param[in] pst                Post structure  
461  *  @param[in] suId               Service User SAP ID 
462  *  @param[in] flowCntrlIndInfo   Flow control information.
463  *
464  *  @return  S16
465  *      -# ROK 
466  *      -# RFAILED
467  */
468 S16 RlcUiKwuFlowCntrlInd(Pst *pst,SuId suId,KwuFlowCntrlIndInfo *flowCntrlIndInfo)
469 {
470
471    /* jump to specific primitive depending on configured selector */
472    (*kwUiKwuFlowCntrlIndMt[pst->selector])(pst, suId, flowCntrlIndInfo);
473
474    return ROK;
475
476 } /* end of RlcUiKwuFlowCntrlInd */ 
477 #ifdef LTE_L2_MEAS
478 \f
479 /**
480  *
481  * @brief 
482  *
483  *        Handler for sending the Data ack indication  to the upper layer. 
484  *
485  * @b Description:
486  *       
487  *       This function confirms the succesfull transmission of SDU
488  *
489  *  @param[in] pst         Post structure  
490  *  @param[in] suId        Service User SAP ID 
491  *  @param[in] datAckInd   DatAckInd
492  *
493  *  @return  S16
494  *      -# ROK 
495  *      -# RFAILED
496  */
497 S16 RlcUiKwuDatAckInd(Pst *pst,SuId suId,KwuDatAckInfo *datAckInd)
498 {
499
500    /* jump to specific primitive depending on configured selector */
501    (*kwUiKwuDatAckIndMt[pst->selector])(pst, suId, datAckInd);
502
503    return ROK;
504
505 } /* end of RlcUiKwuDatAckInd */ 
506 #endif /* LTE_L2_MEAS */
507 #endif /* KW_PDCP */
508
509
510 \f  
511 /*********************************************************************
512  *             Primitives for CKW interface 
513  ********************************************************************/
514
515 /* CKW Bind Confirm primitive */
516
517 CkwBndCfm kwUiCkwBndCfmMt[] =
518 {
519 #ifdef LCKWUICKW
520    cmPkCkwBndCfm,            /* 0 - loosely coupled */
521 #endif /* LCCKUICKW */
522 #ifdef NH
523    NhLiCkwBndCfm,            /* 1 - tightly coupled, RRC  */
524 #endif /* NH */
525 };
526
527 /* CKW Configuration confirm primitive */
528
529 RlcCfgCfm kwUiRlcCfgCfmMt[] =
530 {
531 #ifdef LCKWUICKW
532    cmPkRlcCfgCfm,            /* 0 - loosely coupled */
533 #endif /* LCKWUICKW */
534 #ifdef NH
535    NhLiRlcCfgCfm,            /* 1 - tightly coupled, RRC  */
536 #endif /* NH */
537 };
538
539 CkwUeIdChgCfm kwUiCkwUeIdChgCfmMt[] =
540 {
541 #ifdef LCKWUICKW
542    cmPkCkwUeIdChgCfm,            /* 0 - loosely coupled */
543 #endif /* LCKWUICKW */
544 #ifdef NH
545    NhLiCkwUeIdChgCfm,            /* 1 - tightly coupled, RRC  */
546 #endif /* NH */
547 };
548
549
550 \f  
551 /****************************************************************************
552  *                         CKW Interface Mt functions
553  ***************************************************************************/
554 /**
555  *
556  * @brief 
557  *
558  *        Handler for confirming  the bind request received from CKW
559  *        interface.
560  *
561  * @b Description:
562  *
563  *        This function send the bind confirm primitive to the RLC user,
564  *        when it receives a bind request from its service user.
565  *
566  *  @param[in] pst      - Post structure  
567  *  @param[in] suId     - Service user SAP ID 
568  *  @param[in] status   - Status
569  *
570  *  @return  S16
571  *      -# ROK 
572  */
573 S16 RlcUiCkwBndCfm
574 (
575 Pst     *pst,                       /* post structure */
576 SuId    suId,                      /* Service User Id */
577 uint8_t status                     /* Status */
578 )
579 {
580
581    /* jump to specific primitive depending on configured selector */
582    (*kwUiCkwBndCfmMt[pst->selector])(pst, suId, status);
583
584    return ROK;
585
586 } /* end of RlcUiCkwBndCfm */
587
588 \f
589 /**
590  *
591  * @brief 
592  *
593  *        Handler for sending a configuration confirm to RRC.
594  *
595  * @b Description:
596  *
597  *        This function is used by RLC user to send a configuration
598  *        confirmation to RRC after configuring(add/delete/modify)
599  *        the RLC entities. 
600  *
601  *  @param[in] pst      Post structure  
602  *  @param[in] transId  Transaction Id 
603  *  @param[in] cfmInfo  Config Confirmation Info 
604  *
605  *  @return  S16
606  *      -# ROK 
607  *
608  */
609 S16 RlcUiRlcCfgCfm
610 (
611 Pst            *pst,                      /* post structure */
612 SuId           suId,                      /* Service User Id */
613 RlcCfgCfmInfo  *cfmInfo                    /* Configuration Confirm */
614 )
615 {
616
617    /* jump to specific primitive depending on configured selector */
618    (*kwUiRlcCfgCfmMt[pst->selector])(pst, suId, cfmInfo);
619
620    return ROK;
621
622 } /* end of RlcUiRlcCfgCfm */
623
624 \f
625 /**
626  *
627  * @brief 
628  *
629  *        Handler for sending a configuration for UE ID change.
630  *
631  * @b Description:
632  *
633  *        This function is used by RLC to send a configuration
634  *        confirm for UE ID change.
635  *
636  *  @param[in] pst      Post structure  
637  *  @param[in] suId     Service User Id
638  *  @param[in] transId  Transaction Id 
639  *  @param[in] cfmInfo  Config Confirmation Info 
640  *
641  *  @return  S16
642  *      -# ROK 
643  *
644  */
645 S16 RlcUiCkwUeIdChgCfm 
646 (
647 Pst            *pst,                      /* post structure */
648 SuId           suId,                      /* Service User Id */
649 uint32_t       transId,
650 CkwUeInfo      *ueInfo,
651 CmStatus       status
652 )
653 {
654
655    /* jump to specific primitive depending on configured selector */
656    (*kwUiCkwUeIdChgCfmMt[pst->selector])(pst, suId, transId, ueInfo, status);
657
658    return ROK;
659
660 } /* end of RlcUiRlcCfgCfm */
661
662
663 #if (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF))
664 /**
665  *
666  * @brief 
667  *
668  *        rlcDlBatchProcSplit- process rbug messages
669  *
670  *  @return  S16
671  *      -# ROK 
672  */
673 S16 rlcDlBatchProcSplit(Void)
674 {
675
676 /* Read from Ring Buffer and process PDCP packets */
677    Void *elmIndx = NULLP;
678    RxmBufReq *datReq = NULLP;
679 #ifdef LTE_ADV
680    uint32_t dlPktCount = 0;
681 #endif
682    uint8_t rngBufDeqIndx = 0;
683    uint32_t rngBufDeqMaxCnt;
684    uint32_t rngBufCurrCnt;
685
686    rngBufDeqMaxCnt = SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT;
687 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
688    rngBufCurrCnt = SGetNumElemInRng(SS_RNG_BUF_RX_TO_DLRLC);
689    if ( rngBufCurrCnt > (3 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
690    {
691       if ( rngBufCurrCnt > (6 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
692       {
693          /* Restablishment scenario */
694          rngBufDeqMaxCnt = (4 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT);
695       }
696       else
697       {
698          rngBufDeqMaxCnt = (3 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT)/2;
699       }
700    }
701 #endif
702    elmIndx = SRngGetRIndx(SS_RNG_BUF_RX_TO_DLRLC);
703    while(NULLP != elmIndx)
704    {
705       datReq = (RxmBufReq *)elmIndx;
706       if(datReq->mBuf != NULLP)
707       {
708         cmUnpkKwuDatReq(rlcProcDlData, &datReq->pst, datReq->mBuf);
709       }
710       else
711       {
712          DU_LOG("\nERROR  --> RLC : mBuf is NULL");
713          if(datReq->mBuf)
714           cmUnpkKwuDatReq(rlcProcDlData, &datReq->pst, datReq->mBuf);
715
716       }
717       SsRngInfoTbl[SS_RNG_BUF_RX_TO_DLRLC].nPktProc++;//Number of pkt processed in tti
718       datReq->mBuf = NULLP;
719       SRngIncrRIndx(SS_RNG_BUF_RX_TO_DLRLC);
720       rngBufDeqIndx++;
721       if(rngBufDeqIndx >= rngBufDeqMaxCnt)
722       {
723          break;
724       }
725 #ifdef LTE_ADV
726       {
727         dlPktCount++;
728         if(dlPktCount > 75)
729         {
730            break;
731         }
732       }
733 #endif
734       if((elmIndx = SRngGetRIndx(SS_RNG_BUF_RX_TO_DLRLC)) == NULLP)
735       {
736          break;
737       }
738    }
739
740    return ROK;
741 }
742 #endif
743
744 #if defined(PDCP_RLC_DL_RBUF) || defined(SS_RBUF)
745 S16 rlcDlBatchProc(Void)
746 {
747 /* Read from Ring Buffer and process PDCP packets */
748
749    uint8_t rngBufDeqIndx = 0;
750    uint32_t rngBufDeqMaxCnt;
751 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
752    uint32_t rngBufCurrCnt;
753 #endif
754    /* Memory regions different for BRCM and Intel */
755    /*dstProcId,srcProcId,dstEnt,dstInst,srcEnt,srcInst,prior,route,event,region,pool,selector*/
756 #ifdef SS_RBUF
757    static Pst rlcDlRbfuPst ={1,1,ENTRLC,1,ENTPJ,1,PRIOR0,RTESPEC,KWU_EVT_DAT_REQ,1,1,0,0};
758 #else
759    static Pst rlcDlRbfuPst ={1,1,ENTRLC,1,ENTPJ,1,PRIOR0,RTESPEC,KWU_EVT_DAT_REQ,2,1,0,0};
760 #endif
761    Void *elmIndx = NULLP;
762    KwuDatReqDetl *kwuDatReqDetl = NULLP;
763    RlcDatReqInfo datReq;
764
765    rngBufDeqMaxCnt = SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT;
766 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
767    rngBufCurrCnt = SGetNumElemInRng(SS_RNG_BUF_DLPDCP_TO_DLRLC);
768    if ( rngBufCurrCnt > (3 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
769    {
770       if ( rngBufCurrCnt > (5 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
771       {
772          /* Restablishment scenario */
773          rngBufDeqMaxCnt = (4 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT);
774       }
775       else
776       {
777          rngBufDeqMaxCnt = (2 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT);
778       }
779    }
780 #endif
781    elmIndx = SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
782    while(NULLP != elmIndx)
783    {
784       kwuDatReqDetl = (KwuDatReqDetl *)elmIndx;
785       datReq.rlcId = kwuDatReqDetl->rlcId;
786       datReq.sduId = kwuDatReqDetl->sduId;
787       datReq.lcType = kwuDatReqDetl->lcType;
788       SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].nPktProc++;//Number of pkt processed in tti
789       if(kwuDatReqDetl->mBuf != NULLP)
790       {
791          rlcProcDlData(&rlcDlRbfuPst, kwuDatReqDetl->spId, &datReq, kwuDatReqDetl->mBuf);
792       }
793       SRngIncrRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
794       rngBufDeqIndx++;
795
796       if(rngBufDeqIndx >= rngBufDeqMaxCnt)
797       {
798          break;
799       }
800       elmIndx = (Void *)SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
801    }
802
803    return ROK;
804 }
805
806
807 S16 rlcUtlDlBatchProcPkts(Void)
808 {
809     rlcDlBatchProc();
810 #ifdef SS_RBUF
811 #ifdef LTE_L2_MEAS
812     rlcUtlDlBatchProcHqStaInd();
813 #endif
814     rlcUtlFreeDlMem();
815 #endif
816     return ROK;
817 }   
818
819
820 S16 rlcUtlDlFreeRlcRBuf(Void)
821 {
822 /* Read from Ring Buffer and process PDCP packets */
823    Void *elmIndx = NULLP;
824    KwuDatReqDetl *kwuDatReqDetl = NULLP;
825    /* Free SS_RNG_BUF_DLPDCP_TO_DLRLC  */
826    elmIndx = SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
827    while(NULLP != elmIndx)
828    {
829       kwuDatReqDetl = (KwuDatReqDetl *)elmIndx;
830       SRngIncrRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
831       SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].nPktProc++;
832       SPutMsg(kwuDatReqDetl->mBuf);
833       elmIndx = NULLP;
834       kwuDatReqDetl = NULLP;
835       if((elmIndx = SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC)) == NULLP)
836       break;
837    }
838    return ROK;
839 }
840
841
842 #endif 
843 #ifdef __cplusplus
844 }
845 #endif /* __cplusplus */
846 /********************************************************************30**
847          End of file
848 **********************************************************************/