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