Memory handling fixes
[o-du/l2.git] / src / 5gnrrlc / rlc_portable_functions.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 - Lower Interface
22     
23         Type:    C file
24   
25         Desc:    C source code for the lower interface of NR RLC
26  
27         File:    kw_ptli.c
28   
29 *********************************************************************21*/
30
31 /** @file rlc_portable_functions.c
32 @brief RLC Lower 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 #ifdef KW_PDCP
43 #include "cpj.h"           /* CPJ defines */
44 #include "pju.h"           /* PJU defines */
45 #include "lpj.h"           /* LPJ defines */
46 #endif
47 #include "rlc_err.h"
48 #include "rlc_env.h"        /* RLC environment options */
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 #ifdef KW_PDCP
56 #include "cpj.x"           /* CPJ defines */
57 #include "pju.x"           /* PJU defines */
58 #include "lpj.x"           /* LPJ defines */
59 #endif
60
61 #include "rlc_utils.h"            /* RLC defines */
62 /*
63 #if defined(MAC_RLC_UL_RBUF) || (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF)) || defined(SS_RBUF)
64 #include "ss_rbuf.h"
65 #include "ss_rbuf.x"
66 #endif
67 */
68 #include "ss_rbuf.h"
69 #include "ss_rbuf.x"
70 #if defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF)
71 #include "mt_plat_t33.h"
72 #include "mt_plat_t33.x"
73 #endif
74
75 #ifndef LCKWLIRGU
76 #define PTKWRGU
77 #endif
78
79 #ifndef RG
80 #define PTKWRGU
81 #endif
82
83 #ifdef __cplusplus
84 extern "C" {
85 #endif /* __cplusplus */
86
87 /* local defines */
88 #define MAXKWMI 2               /* max. layer management interfaces */
89
90 #ifdef RLC_MAC_DAT_REQ_RBUF
91 S16 rlcLiRguDatReqRbuf(Pst *Post,SpId spId,Void *datReq);
92 #endif
93
94 #ifdef RLC_MAC_STA_RSP_RBUF
95 S16 rlcLiRguStaRspRbuf(Pst *Post,SpId spId,Void  *staRsp);
96 #endif
97 #if defined(MAC_RLC_HARQ_STA_RBUF) && defined(LTE_L2_MEAS)
98 S16 RlcDlHarqStaBatchProc (Void);
99 #endif
100
101 \f
102 /*********************************************************************
103  *             Primitives for RGU interface 
104  ********************************************************************/
105
106 /* RGU Bind Request primitive */
107
108 RguBndReq kwLiRguBndReqMt[] =
109 {
110 #ifdef LCKWLIRGU
111    cmPkRguBndReq,            /* 0 - loosely coupled */
112 #endif /* LCRGUIRGU */
113 #ifdef RG 
114    RgUiRguBndReq,            /* 1 - tightly coupled, MAC  */
115 #endif /* RG */
116 #ifdef LCKWLIRGU
117    cmPkRguBndReq,            /* 0 - loosely coupled */
118 #endif /* LCRGUIRGU */
119 };
120
121 /* RGU Unbind Request primitive */
122
123 RguBndReq kwLiRguUbndReqMt[] =
124 {
125 #ifdef LCKWLIRGU
126    cmPkRguUbndReq,            /* 0 - loosely coupled */
127 #endif /* LCRGUIRGU */
128 #ifdef RG 
129    RgUiRguUbndReq,            /* 1 - tightly coupled, MAC  */
130 #endif /* RG */
131 #ifdef LCKWLIRGU
132    cmPkRguUbndReq,            /* 0 - loosely coupled */
133 #endif /* LCRGUIRGU */
134 };
135
136 /* kw005.201 added support for L2 Measurement */
137 #ifdef LTE_L2_MEAS
138 #ifdef LTE_RLC_R9
139 /* RGU L2 Measurement Ul Ip Throughput Measurement Request primitive */
140
141 RguL2MUlThrpMeasReq kwLiRguL2MUlThrpMeasReqMt[] =
142 {
143 #ifdef LCKWLIRGU
144    cmPkRguL2MUlThrpMeasReq,            /* 0 - loosely coupled */
145 #endif /* LCRGUIRGU */
146 #ifdef RG 
147    RgUiRguL2MUlThrpMeasReq,            /* 1 - tightly coupled, MAC  */
148 #endif /* RG */
149 };
150 #endif /* LTE_RLC_R9 */
151 #endif /*  LTE_L2_MEAS */
152
153 /*********************************************************************
154  *             Primitives for LKW interface 
155  ********************************************************************/
156 /* Configuration confirmation primitive */
157
158 static RlcConfigCfm rlcMiRlcConfigCfmMt[MAXKWMI] =
159 {
160 #ifdef LCKWMILKW
161    packRlcConfigCfm,            /* 0 - loosely coupled - fc */
162 #endif /* LCRLMILKW */
163 #ifdef SM
164    SmMiRlcConfigCfm,            /* 1 - tightly coupled layer management*/
165 #endif /* SM */
166 };
167
168 /* control confirmation primitives */
169
170 static LkwCntrlCfm kwMiLkwCntrlCfmMt[MAXKWMI] =
171 {
172 #ifdef LCKWMILKW 
173    cmPkLkwCntrlCfm,          /* 0 - loosely coupled - fc */
174 #endif /* LCRLMILKW */
175 #ifdef SM
176    SmMiLkwCntrlCfm,          /* 1 - tightly coupled layer management*/
177 #endif /* SM */
178 };
179
180 /* Status Indication primitive */
181
182 static LkwStaInd kwMiLkwStaIndMt[MAXKWMI] =
183 {
184 #ifdef LCKWMILKW 
185    cmPkLkwStaInd,            /* 0 - loosely coupled  */
186 #endif /* LCKWMILKW */
187 #ifdef SM
188    SmMiLkwStaInd,            /* 1 - tightly coupled, layer management */
189 #endif /* SM */
190 };
191
192 /* Status confirm primitive */
193
194 static LkwStaCfm kwMiLkwStaCfmMt[MAXKWMI] =
195 {
196 #ifdef LCKWMILKW 
197    cmPkLkwStaCfm,            /* 0 - loosely coupled  */
198 #endif /* LCKWMILKW */
199 #ifdef SM
200    SmMiLkwStaCfm,            /* 1 - tightly coupled, layer management */
201 #endif /* SM */
202 };
203
204 /* Statistics confirm primitive */
205
206 static LkwStsCfm kwMiLkwStsCfmMt[MAXKWMI] =
207 {
208 #ifdef LCKWMILKW
209    cmPkLkwStsCfm,            /* 0 - loosely coupled  */
210 #endif /* LCRLMILKW */
211 #ifdef SM
212    SmMiLkwStsCfm,            /* 1 - tightly coupled, layer management */
213 #endif /* SM */
214 };
215
216 /* Trace indication primitive */
217
218 static LkwTrcInd kwMiLkwTrcIndMt[MAXKWMI] =
219 {
220 #ifdef LCKWMILKW
221    cmPkLkwTrcInd,            /* 0 - loosely coupled  */
222 #endif /* LCKWMILKW */
223 #ifdef SM
224    SmMiLkwTrcInd,            /* 1 - tightly coupled, layer management */
225 #endif /* SM */
226 };
227
228 /* kw005.201 added support for L2 Measurement */
229 #ifdef LTE_L2_MEAS
230 static const LkwL2MeasCfm rlcMiLkwL2MeasCfmMt[] =
231 {
232 #ifdef LCKWMILKW
233    cmPkLkwL2MeasCfm,
234 #endif
235 #ifdef SM
236    SmMiLkwL2MeasCfm,
237 #endif
238 };
239 static const LkwL2MeasStopCfm RlcMiLkwL2MeasStopCfmMt[] =
240 {
241 #ifdef LCKWMILKW
242    cmPkLkwL2MeasStopCfm,
243 #endif
244 #ifdef SM
245    SmMiLkwL2MeasStopCfm,
246 #endif
247 };
248 #endif /*  LTE_L2_MEAS */
249
250 /*********************************************************************
251  *             Forward Declartion for KWU Porting Functions
252  ********************************************************************/
253 #if defined(PDCP_RLC_DL_RBUF) || defined(SS_RBUF)
254 S16 rlcDlBatchProc ARGS ((Void));
255 S16 rlcUtlDlFreeRlcRBuf ARGS((Void));
256 void rlcUtlDlBatchProcHqStaInd ARGS ((Void));
257 Void rlcUtlFreeDlMem ARGS((Void));
258 SsRngBufCnt rngCb;
259 S16 rlcUtlDlBatchProcPkts ARGS((Void));
260 #endif
261
262 #if (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF))
263 S16 rlcDlBatchProcSplit  ARGS((Void));
264 #endif
265
266 \f  
267 /*********************************************************************
268  *             Primitives for KWU interface 
269  ********************************************************************/
270
271 /* KWU Bind Confirm primitive */
272
273 KwuBndCfm kwUiKwuBndCfmMt[] =
274 {
275 #ifdef LCKWUIKWU
276    cmPkKwuBndCfm,            /* 0 - loosely coupled */
277 #endif /* LCKWUIKWU */
278 #ifdef NH
279    NhLiKwuBndCfm,            /* 1 - tightly coupled, RRC  */
280 #endif /* NH */
281 #ifndef KW_PDCP
282 #ifdef PJ
283    PjLiKwuBndCfm,            /* 2 - tightly coupled, PDCP */
284 #endif /* NH */
285 #endif /* KW_PDCP */
286 #ifndef TENB_ACC
287 #ifdef LWLCKWUIKWU
288    cmPkKwuBndCfm,      /* 3 - light weight loosely coupled */ 
289 #endif /* LCKWUIKWU */
290 #endif /*TENB_ACC*/
291 };
292
293 /* KWU Data Indication primitive */
294
295 KwuDatInd kwUiKwuDatIndMt[] =
296 {
297 #ifdef LCKWUIKWU
298    cmPkKwuDatInd,            /* 0 - loosely coupled */
299 #endif /* LCKWUIKWU */
300 #ifdef NH
301    NhLiKwuDatInd,            /* 1 - tightly coupled, RRC  */
302 #endif /* NH */
303 #ifdef KW_PDCP
304 #else
305 #ifdef PJ
306    PjLiKwuDatInd,            /* 2 - tightly coupled, PDCP */
307 #endif /* NH */
308 #ifndef TENB_ACC
309 #ifdef LWLCKWUIKWU
310    cmPkKwuDatInd,         /* 3 - light weight loosely coupled */ 
311 #endif /* LCKWUIKWU */
312 #endif /*TENB_ACC*/
313 #endif /* KW_PDCP */
314 };
315
316 #ifndef KW_PDCP
317 KwuDatCfm kwUiKwuDatCfmMt[] =
318 {
319 #ifdef LCKWUIKWU
320    cmPkKwuDatCfm,            /* 0 - loosely coupled */
321 #endif /* LCKWUIKWU */
322 #ifdef PJ
323    PjLiKwuDatCfm,            /* 2 - tightly coupled, PDCP */
324 #endif /* PJ */
325 #ifndef TENB_ACC
326 #ifdef LWLCKWUIKWU
327    cmPkKwuDatCfm,         /* 3 - light weight loosely coupled */ 
328 #endif /* LCKWUIKWU */
329 #endif /*TENB_ACC*/
330 };
331
332 /* KWU AM Status Indication primitive */
333
334 KwuStaInd kwUiKwuStaIndMt[] =
335 {
336 #ifdef LCKWUIKWU
337    cmPkKwuStaInd,            /* 0 - loosely coupled */
338 #endif /* LCKWUIKWU */
339 #ifdef PJ
340    PjLiKwuStaInd,            /* 2 - tightly coupled, PDCP */
341 #endif /* PJ */
342 #ifndef TENB_ACC
343 #ifdef LWLCKWUIKWU
344    cmPkKwuStaInd,         /* 3 - light weight loosely coupled */ 
345 #endif /* LCKWUIKWU */
346 #endif /*TENB_ACC*/
347 };
348
349 KwuReEstCmpInd kwUiKwuReEstCmpIndMt[] =
350 {
351 #ifdef LCKWUIKWU
352    cmPkKwuReEstCmpInd,            /* 0 - loosely coupled */
353 #endif /* LCKWUIKWU */
354 #ifdef PJ
355    PjLiKwuReEstCmpInd,            /* 2 - tightly coupled, PDCP */
356 #else
357 #endif /* PJ */
358 #ifndef TENB_ACC
359 #ifdef LWLCKWUIKWU
360    cmPkKwuReEstCmpInd,    /* 3 - light weight loosely coupled */ 
361 #endif /* LCKWUIKWU */
362 #endif /*TENB_ACC*/
363 };
364
365 /* kw005.201 added support for L2 measurement */
366 KwuDiscSduCfm kwUiKwuDiscSduCfmMt[] =
367 {
368 #ifdef LCKWUIKWU
369    cmPkKwuDiscSduCfm,            /* 0 - loosely coupled */
370 #endif /* LCKWUIKWU */
371 #ifdef PJ
372    PjLiKwuDiscSduCfm,            /* 2 - tightly coupled, PDCP */
373 #endif
374 #ifndef TENB_ACC
375 #ifdef LWLCKWUIKWU
376    cmPkKwuDiscSduCfm,    /* 3 - light weight loosely coupled */    
377 #endif /* PJ */
378 #endif /*TENB_ACC*/
379 };
380 KwuFlowCntrlInd kwUiKwuFlowCntrlIndMt[] =
381 {
382 #ifdef LCKWUIKWU
383    cmPkKwuFlowCntrlInd,            /* 0 - loosely coupled */
384 #endif /* LCKWUIKWU */
385 #ifdef PJ
386    PjLiKwuFlowCntrlInd,            /* 2 - tightly coupled, PDCP */
387 #endif /* PJ */
388 #ifdef LCKWUIKWU
389    cmPkKwuFlowCntrlInd,            /* 3 - light weight loosely coupled */
390 #endif /* LCKWUIKWU */
391 };
392 #ifdef LTE_L2_MEAS
393 KwuDatAckInd kwUiKwuDatAckIndMt[] =
394 {
395 #ifdef LCKWUIKWU
396    cmPkKwuDatAckInd,            /* 0 - loosely coupled */
397 #endif /* LCKWUIKWU */
398 #ifdef PJ
399    PjLiKwuDatAckInd,            /* 2 - tightly coupled, PDCP */
400 #endif /* PJ */
401 #ifndef TENB_ACC
402 #ifdef LWLCKWUIKWU
403    cmPkKwuDatAckInd,     /* 3 - light weight loosely coupled, portable */          
404 #endif /* PJ */
405 #endif /*TENB_ACC*/
406 };
407 #endif /* LTE_L2_MEAS */
408 /* KWU AM Data confirm primitive */
409
410 #endif /* KW_PDCP */
411 \f  
412 /****************************************************************************
413  *                         LKW Interface Mt functions
414  ***************************************************************************/
415 /**
416    @brief
417    This function is called by the RlcMiRlcConfigReq function for responding
418    to configuration requests.The cfm field in the RlcMngmt  structure contains
419  the response value.
420
421    - This function calls the mapping matrix for sending the configuration
422      confirmation.
423    - The actual function called depends on the coupling at the LKW interface.
424    - For a loosely coupled interface, a common packing function is called.
425    - The packing function packs the parameter in a message buffer and posts
426      the message to the target task.
427    - For a tightly coupled interface, the actual function called depends on
428      the layer manager API provided.
429
430 */
431 S16 RlcMiRlcConfigCfm
432 (
433 Pst        *pst,                /* post structure */
434 RlcMngmt    *cfm                 /* Layer Management structure */
435 )
436 {
437
438    /* jump to specific primitive depending on configured selector */
439    (*rlcMiRlcConfigCfmMt[pst->selector])(pst, cfm);
440    
441    return ROK;
442 }
443
444
445 /**
446    @brief
447    This function is called by the RlcMiLkwCntrlReq function to send a control confirm to the layer management module.
448
449    - This function calls the mapping matrix for sending the control confirmation.
450    - Actual function called depends on the coupling of the LKW interface.
451    - For a loosely coupled interface, a common packing function is called.
452    - The packing function packs the parameter in a message buffer and posts the
453      message to the target task.
454    - For a tightly coupled interface, the actual function called depends on the
455      layer manager API provided.
456
457 */
458 S16 RlcMiLkwCntrlCfm
459 (
460 Pst *pst,                    /* post structure */
461 RlcMngmt *cfm                 /* configure */
462 )
463 {
464
465    /* jump to specific primitive depending on configured selector */
466    (*kwMiLkwCntrlCfmMt[pst->selector])(pst, cfm);
467
468    return ROK;
469
470 } /* end of RlcMiLkwCntrlCfm */
471
472 /**
473    @brief
474    Description:
475    - This function can be used by RLC to send unsolicited status information
476      to the layer manager, when the unsolicited status flag is enabled by the
477      layer manager through a previous control request.
478
479    - This function calls the mapping matrix for sending the unsolicited status
480      indication.The actual function called depends on the coupling of the
481      LKW interface.
482
483    - For a loosely coupled interface, a common packing function is called. The
484      packing function packs the parameter in a message buffer and posts the
485      message to the target task.
486
487    - For a tightly coupled interface, the actual function called depends on
488      the layer manager API provided.
489 */
490 S16 RlcMiLkwStaInd
491 (
492 Pst     *pst,                /* post structure */
493 RlcMngmt *usta                /* unsolicited status */
494 )
495 {
496    /* jump to specific primitive depending on configured selector */
497    (*kwMiLkwStaIndMt[pst->selector])(pst, usta);
498
499    return (ROK);
500 } /* end of RlcMiLkwStaInd */
501
502
503 /**
504    @brief
505    - This function is called by the RlcMiLkwStaReq function to send
506       the requested status information to the layer manager.
507
508    - This function calls the mapping matrix for sending the status
509       confirmation. The actual function called depends on the coupling
510       of the LKW interface.
511
512    - For a loosely coupled interface, a common packing function is called.
513       The packing function packs the parameter in a message buffer and
514       posts the message to the target task.
515
516    - For a tightly coupled interface, the actual function called depends
517       on the layer manager API provided.
518
519 */
520 S16 RlcMiLkwStaCfm
521 (
522 Pst *pst,                    /* post structure */
523 RlcMngmt *cfm                 /* solicited status confirmation */
524 )
525 {
526
527    /* jump to specific primitive depending on configured selector */
528    (*kwMiLkwStaCfmMt[pst->selector])(pst, cfm);
529
530    return ROK;
531
532 } /* end of RlcMiLkwStaCfm */
533
534
535 /**
536    @brief
537    - This function is called by the RlcMiLkwStsReq function for responding
538       to statistics requests.
539
540    - This function calls the mapping matrix for sending the statistics
541       confirmation. The actual function called depends on the coupling
542       of the LKW interface.
543
544    - For a loosely coupled interface, a common packing function is called.
545       The packing function packs the parameter in a message buffer and
546       posts the message to the target task.
547
548    - For a tightly coupled interface, the actual function called depends
549       on the layer manager API provided.
550
551 */
552 S16 RlcMiLkwStsCfm
553 (
554 Pst *pst,                    /* post structure */
555 Action action,               /* action */
556 RlcMngmt *cfm                 /* statistics confirmation */
557 )
558 {
559    /* jump to specific primitive depending on configured selector */
560    (*kwMiLkwStsCfmMt[pst->selector])(pst, action, cfm);
561
562    return ROK;
563
564 } /* end of RlcMiLkwStsCfm */
565
566 /**
567    @brief
568    - This function can be used by RLC module to send unsolicited trace
569       indications to the layer manager, when tracing is enabled by the
570       layer manager through a previous control request.
571
572    - This function calls the mapping matrix for sending the trace indication.
573       The actual function called depends on the coupling of the LKW interface.
574
575    - For a loosely coupled interface, a common packing function is called.
576       The packing function packs the parameter in a message buffer and posts
577       the message to the target task.
578
579    - For a tightly coupled interface, the actual function called depends on
580       the layer manager API provided.
581
582 */
583 S16 RlcMiLkwTrcInd
584 (
585 Pst *pst,                    /* post structure */
586 RlcMngmt *trc,                /* trace indication */
587 Buffer *mBuf                 /* message buffer */
588 )
589 {
590    /* jump to specific primitive depending on configured selector */
591    (*kwMiLkwTrcIndMt[pst->selector])(pst, trc, mBuf);
592
593    return ROK;
594
595 } /* end of RlcMiLkwTrcInd */
596
597
598 /* kw005.201 added support for L2 Measurement */
599 #ifdef LTE_L2_MEAS
600 S16 RlcMiLkwL2MeasCfm(Pst * pst,RlcL2MeasCfmEvt *measEvt)
601 {
602
603    (*rlcMiLkwL2MeasCfmMt[pst->selector])(pst, measEvt);
604
605    return ROK;
606
607 }
608 S16 RlcMiLkwL2MeasStopCfm(Pst *pst,uint8_t measType,uint8_t status)
609 {
610
611    (*RlcMiLkwL2MeasStopCfmMt[pst->selector])(pst, measType,status);
612
613    return ROK;
614
615 }
616 #endif /*  LTE_L2_MEAS */
617
618 \f
619 /****************************************************************************
620  *                         RGU Interface Mt functions
621  ***************************************************************************/
622 /**
623  *
624  * @brief 
625  *
626  *        Handler for RGU SAP bind Request.
627  *
628  * @b Description:
629  *
630  *        This function is used by RLC to request for binding to 
631  *        MAC for accessing MAC services.This function binds MAC's 
632  *        SAP (identified by spId) with the service user's SAP 
633  *        (identified by suId).
634  *
635  *  @param[in] pst   Post structure  
636  *  @param[in] suId  Service user SAP ID 
637  *  @param[in] spId  Service provider ID
638  *
639  *  @return  S16
640  *      -# ROK 
641  */
642
643 S16 RlcLiRguBndReq
644 (
645 Pst  *post,                       /* post structure */
646 SuId suId,                      /* Service User Id */
647 SpId spId                       /* Service Provider Id */
648 )
649 {
650
651    /* jump to specific primitive depending on configured selector */
652    (*kwLiRguBndReqMt[post->selector])(post, suId, spId);
653
654    return ROK;
655
656 } /* end of RlcLiRguBndReq */
657
658 \f
659 /**
660  *
661  * @brief 
662  *
663  *        Handler for bind confirmation from MAC.
664  *
665  * @b Description:
666  *
667  *        This function handles the bind confirmation received
668  *        from MAC. 
669  *
670  *  @param[in] post     - Post structure  
671  *  @param[in] suId    - Service provider SAP ID 
672  *  @param[in] reason  - Reason of confirmation
673  *
674  *  @return  S16
675  *      -# ROK 
676  */
677
678 S16 RlcLiRguUbndReq(Pst *post,SpId spId,Reason reason)
679 {
680
681    /* jump to specific primitive depending on configured selector */
682    (*kwLiRguUbndReqMt[post->selector])(post, spId, reason);
683
684    return ROK;
685
686 } /* end of RlcLiRguUbndReq */
687
688 /* kw005.201 added support for L2 Measurement */
689 #ifdef LTE_L2_MEAS
690 #ifdef LTE_RLC_R9
691 \f  
692 /**
693  *
694  * @brief 
695  *
696  *        Handler for sending ulThrpMeasReqInfo from RLC to MAC for UL ip throughput measurement. 
697  *
698  * @b Description:
699  *
700  *        This function sends ulThrpMeasReqInfo from RLC to MAC whenver UL ip throughput
701  * measurement is ON for a single or multiple qci in a UE. This is an indication for MAC
702  * to start the T2/T1 time stamps for the coresponding LCHs in the UE.
703  *
704  *  @param[in] post                    Post structure  
705  *  @param[in] spId                   Service Provider ID
706  *  @param[in] ulThrpMeasReqInfo      Ul ip measurement request info
707  *
708  *  @return  S16
709  *      -# ROK 
710  *      -# RFAILED
711  *
712  */
713 S16 RlcLiRguL2MUlThrpMeasReq(Pst *post,SpId spId,RguL2MUlThrpMeasReqInfo *l2mUlThrpMeasReq)
714 {
715
716    /* jump to specific primitive depending on configured selector */
717    (*kwLiRguL2MUlThrpMeasReqMt[post->selector])(post, spId, l2mUlThrpMeasReq);
718
719    return ROK;
720
721 } /* end of RlcLiRguL2MUlThrpMeasReq */
722
723 #endif /* LTE_RLC_R9 */
724 #endif /* LTE_L2_MEAS */
725
726
727 #ifdef MAC_RLC_UL_RBUF
728 S16 rlcUlBatchProc ARGS ((Void));
729 Void rlcUtlFreeUlRBuf ARGS((void));
730
731 S16 rlcUlBatchProc(Void)
732 {
733 /* Read from Ring Buffer and process PDCP packets */
734    RguDDatIndInfo   *datInd;
735    Void *elmIndx = NULLP;
736    static Pst rlcUlRbfuPst={1,1,ENTRLC,0,ENTMAC,0,PRIOR0,RTESPEC,EVTRLCULDAT,0,0,0,0};
737 /* Read from Ring Buffer and process PDCP packets */
738
739 #ifndef SS_RBUF
740    RguDedDatInd1 *rguDatInd = NULLP;
741    uint8_t rngBufDeqIndx = 0;
742
743    elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
744    while(NULLP != elmIndx)
745    {
746       rguDatInd = (RguDedDatInd1 *)elmIndx;
747       datInd = (RguDDatIndInfo*) rguDatInd->msg; 
748       SsRngInfoTbl[SS_RNG_BUF_ULMAC_TO_ULRLC].nPktProc++;//Number of pkt processed in tti
749       if(datInd != NULLP)
750       {
751          RlcProcDedLcUlData(&rlcUlRbfuPst, 0, datInd);
752       }
753       else
754       {
755          DU_LOG("\nERROR  -->  RLC UL : Received NULL buffer");
756       }
757       rguDatInd->msg=NULLP;
758       SRngIncrRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
759       elmIndx = NULLP;
760       rguDatInd = NULLP;
761
762       rngBufDeqIndx++;
763
764       //if(rngBufDeqIndx >= SS_RNG_MAX_ULMAC_TO_ULRLC_DQ_CNT)
765        // break;
766
767       if((elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC)) == NULLP)
768       break;
769    }
770 #else
771    elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
772    while(NULLP != elmIndx)
773    {
774       datInd = (RguDDatIndInfo *)elmIndx;
775       RlcProcDedLcUlData(&rlcUlRbfuPst, 0, datInd);
776
777       elmIndx = NULLP;
778       datInd = NULLP;
779       SRngIncrRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
780
781       if((elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC)) == NULLP)
782         break;
783    }
784 #endif
785    return ROK;
786
787 }
788
789 /**
790  *
791  * @brief 
792  *        Handler to clear Ring buffer from UL RLC
793  *
794  * @details
795  *         This function clears all the ring buffer content from  UL RLC
796  *
797  * @return  S16
798  *      -# ROK 
799  *      -# RFAILED
800  *
801  */
802 Void rlcUtlFreeUlRBuf(void)
803 {
804    RguDDatIndInfo *datInd;
805    PTR            elem;
806    uint8_t        numLch;
807    uint8_t        numPdu;
808
809    /* Free SS_RNG_BUF_ULMAC_TO_ULRLC  */
810    while((SDeqSRngBuf (SS_RNG_BUF_ULMAC_TO_ULRLC, &elem) == ROK))
811    {
812       datInd = (RguDDatIndInfo *)elem; 
813       for(numLch = 0; numLch< datInd->numLch; numLch++)
814       {
815          for(numPdu = 0; numPdu < datInd->lchData[numLch].pdu.numPdu; numPdu++)
816          {
817             if(datInd->lchData[numLch].pdu.mBuf[numPdu])
818             {
819                ODU_PUT_MSG_BUF(datInd->lchData[numLch].pdu.mBuf[numPdu]);
820             }
821          }
822       }
823       RLC_PST_FREE(0, 0, datInd, sizeof(RguDDatIndInfo)); 
824    }
825 }
826 #endif
827 #ifdef RLC_MAC_STA_RSP_RBUF
828 S16 rlcLiRguStaRspRbuf(Pst *post,SpId spId,Void *staRsp)
829 {
830    S16 ret1 = ROK;
831    
832    Void *elem = NULLP;
833
834    RguDStaRspInfo  *staRspInfo = NULL;
835    elem = SRngGetWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
836    if (NULLP != elem)
837    {
838       staRspInfo = (RguDStaRspInfo *)elem;
839       memcpy(staRspInfo, staRsp, sizeof(RguDStaRspInfo)); 
840       staRspInfo->post = *post;
841       SRngIncrWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
842       SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC].pktRate++;
843    }   
844    else
845    {
846       DU_LOG("\nERROR  -->  RLC_DL : RLC DL STA RSP RBUF is FULL!!! ");
847       SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC].pktDrop++;
848       ret1 = RFAILED;
849    }
850    return (ret1);
851 } /* cmPkRlcDatReq */
852
853 #endif
854 #ifdef RLC_MAC_DAT_REQ_RBUF
855 S16 rlcLiRguDatReqRbuf(Pst *post,SpId spId,Void *datReq)
856 {
857    S16 ret1 = ROK;
858    
859    Void *elem = NULLP;
860    RguInfoRingElem *datReqRing=NULLP;
861    elem = SRngGetWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ);
862    if (NULLP != elem)
863    {
864       datReqRing = (RguInfoRingElem *) elem;
865       datReqRing->spId = spId;
866       datReqRing->event = post->event;
867       datReqRing->msg =datReq;
868       SRngIncrWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ);
869       SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ].pktRate++;
870    }   
871    else
872    {
873       DU_LOG("\nERROR  -->  RLC_DL : RLC DL DAT REQ RBUF is FULL!!! \n");
874       SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ].pktDrop++;
875       ret1 = RFAILED;
876    }
877    return (ret1);
878 } /* cmPkRlcDatReq */
879
880 #endif
881
882 /****************************************************************************
883  *                         KWU Interface Mt functions
884  ***************************************************************************/\f
885 /**
886  *
887  * @brief 
888  *
889  *        Handler for confirming  the bind request received from KWU
890  *        interface.
891  *
892  * @b Description:
893  *
894  *        This function send the bind confirm primitive to the RLC user,
895  *        when it receives a bind request from its service user.
896  *
897  *  @param[in] pst     Post structure  
898  *  @param[in] suId    Service user SAP ID 
899  *  @param[in] status  Status of Confirmation 
900  *
901  *  @return  S16
902  *      -# ROK 
903  *
904  */
905 S16 RlcUiKwuBndCfm
906 (
907 Pst     *pst,                       /* post structure */
908 SuId    suId,                      /* Service User Id */
909 uint8_t status                     /* Status */
910 )
911 {
912
913    /* jump to specific primitive depending on configured selector */
914    (*kwUiKwuBndCfmMt[pst->selector])(pst, suId, status);
915
916    return ROK;
917
918 } /* end of RlcUiKwuBndCfm */
919
920 \f
921 /**
922  *
923  * @brief 
924  *
925  *        Handler for sending the data(SDU) from upper layer. 
926  *
927  * @b Description:
928  *
929  *        This function is used to transfer a SDU received from the peer
930  *        RLC entity to the service user(RRC/PDCP).
931  *
932  *  @param[in] pst         Post structure  
933  *  @param[in] suId        Service User SAP ID 
934  *  @param[in] datIndInfo  Data Request Information
935  *  @param[in] mBuf         Data Buffer (SDU) 
936  *
937  *  @return  S16
938  *      -# ROK 
939  *      -# RFAILED
940  */
941 S16 rlcSendUlDataToDu
942 (
943 Pst               *pst,
944 KwuDatIndInfo     *datInd,
945 Buffer            *mBuf
946 )
947 {
948
949    /* jump to specific primitive depending on configured selector */
950    (*kwUiKwuDatIndMt[pst->selector])(pst, datInd, mBuf);
951
952    return ROK;
953
954 } /* end of rlcSendUlDataToDu */
955
956    int rlcDatCfmsSent = 0;
957 \f
958 #ifndef KW_PDCP
959 /**
960  *
961  * @brief 
962  *
963  *        Handler for sending the data confirmation to upper layer. 
964  *
965  * @b Description:
966  *
967  *        This function is used to send a confirmation to the service
968  *        user about the data received by the peer RLC entity. 
969  *
970  *  @param[in] pst         Post structure  
971  *  @param[in] suId        Service User SAP ID 
972  *  @param[in] datCfmInfo  Data Confirmation Information
973  *
974  *  @return  S16
975  *      -# ROK 
976  *      -# RFAILED
977  */
978 S16 RlcUiKwuDatCfm
979 (
980 Pst            *pst,
981 SuId           suId,
982 KwuDatCfmInfo  *datCfm
983 )
984 {
985    rlcDatCfmsSent++;
986
987    /* jump to specific primitive depending on configured selector */
988    (*kwUiKwuDatCfmMt[pst->selector])(pst, suId, datCfm);
989
990    return ROK;
991
992 } /* end of RlcUiKwuDatCfm */
993
994 \f
995 /**
996  *
997  * @brief 
998  *
999  *        Handler for sending the Status Indication to the upper layer. 
1000  *
1001  * @b Description:
1002  *
1003  *        This function is used only by RLC AM entity.It send status 
1004  *        indication to the upper layer about the maximum number of 
1005  *        re-transmissions reached for a RLC AM entity. 
1006  *
1007  *  @param[in] pst         Post structure  
1008  *  @param[in] suId        Service User SAP ID 
1009  *  @param[in] staInd      RLC Entity Id  
1010  *
1011  *  @return  S16
1012  *      -# ROK 
1013  *      -# RFAILED
1014  */
1015 S16 RlcUiKwuStaInd
1016 (
1017 Pst               *pst,
1018 SuId              suId,
1019 KwuStaIndInfo     *staInd
1020 )
1021 {
1022
1023    /* jump to specific primitive depending on configured selector */
1024    (*kwUiKwuStaIndMt[pst->selector])(pst, suId, staInd);
1025
1026    return ROK;
1027
1028 } /* end of RlcUiKwuStaInd */
1029
1030 \f
1031 /**
1032  *
1033  * @brief 
1034  *
1035  *        Handler for sending the Status Indication to the upper layer. 
1036  *
1037  * @b Description:
1038  *
1039  *        This function is used only by RLC AM entity.It send status 
1040  *        indication to the upper layer about the maximum number of 
1041  *        re-transmissions reached for a RLC AM entity. 
1042  *
1043  *  @param[in] pst         Post structure  
1044  *  @param[in] suId        Service User SAP ID 
1045  *  @param[in] staInd      RLC Entity Id  
1046  *
1047  *  @return  S16
1048  *      -# ROK 
1049  *      -# RFAILED
1050  */
1051 S16 RlcUiKwuReEstCmpInd
1052 (
1053 Pst               *pst,
1054 SuId              suId,
1055 CmLteRlcId        rlcId
1056 )
1057 {
1058    DU_LOG("\nINFO   --> RLC : In RlcUiKwuReEstCmpInd");
1059
1060    /* jump to specific primitive depending on configured selector */
1061    (*kwUiKwuReEstCmpIndMt[pst->selector])(pst, suId, rlcId);
1062
1063    return ROK;
1064
1065 } /* end of RlcUiKwuReEstCmpInd */
1066 /* kw005.201 added support for L2 Measurement */
1067 \f
1068 /**
1069  *
1070  * @brief 
1071  *
1072  *        Handler for sending the Sdu Disc Cfm  to the upper layer. 
1073  *
1074  * @b Description:
1075  *       
1076  *       This function confirms the discard of an SDU .
1077  *
1078  *  @param[in] pst         Post structure  
1079  *  @param[in] suId        Service User SAP ID 
1080  *  @param[in] discCfm     Disc information.
1081  *
1082  *  @return  S16
1083  *      -# ROK 
1084  *      -# RFAILED
1085  */
1086 S16 RlcUiKwuDiscSduCfm
1087 (
1088 Pst               *pst,
1089 SuId              suId,
1090 KwuDiscSduInfo    *discCfm
1091 )
1092 {
1093
1094    /* jump to specific primitive depending on configured selector */
1095    (*kwUiKwuDiscSduCfmMt[pst->selector])(pst, suId, discCfm);
1096
1097    return ROK;
1098
1099 } /* end of RlcUiKwuDiscSduCfm */ 
1100
1101 /**
1102  *
1103  * @brief 
1104  *
1105  *        Handler for sending Flow indication to the upper layer. 
1106  *
1107  * @b Description:
1108  *       
1109  *       This function indicates to PDCP if packets need to be stopped or
1110  *       started for a particular RB
1111  *
1112  *  @param[in] pst                Post structure  
1113  *  @param[in] suId               Service User SAP ID 
1114  *  @param[in] flowCntrlIndInfo   Flow control information.
1115  *
1116  *  @return  S16
1117  *      -# ROK 
1118  *      -# RFAILED
1119  */
1120 S16 RlcUiKwuFlowCntrlInd(Pst *pst,SuId suId,KwuFlowCntrlIndInfo *flowCntrlIndInfo)
1121 {
1122
1123    /* jump to specific primitive depending on configured selector */
1124    (*kwUiKwuFlowCntrlIndMt[pst->selector])(pst, suId, flowCntrlIndInfo);
1125
1126    return ROK;
1127
1128 } /* end of RlcUiKwuFlowCntrlInd */ 
1129 #ifdef LTE_L2_MEAS
1130 \f
1131 /**
1132  *
1133  * @brief 
1134  *
1135  *        Handler for sending the Data ack indication  to the upper layer. 
1136  *
1137  * @b Description:
1138  *       
1139  *       This function confirms the succesfull transmission of SDU
1140  *
1141  *  @param[in] pst         Post structure  
1142  *  @param[in] suId        Service User SAP ID 
1143  *  @param[in] datAckInd   DatAckInd
1144  *
1145  *  @return  S16
1146  *      -# ROK 
1147  *      -# RFAILED
1148  */
1149 S16 RlcUiKwuDatAckInd(Pst *pst,SuId suId,KwuDatAckInfo *datAckInd)
1150 {
1151
1152    /* jump to specific primitive depending on configured selector */
1153    (*kwUiKwuDatAckIndMt[pst->selector])(pst, suId, datAckInd);
1154
1155    return ROK;
1156
1157 } /* end of RlcUiKwuDatAckInd */ 
1158 #endif /* LTE_L2_MEAS */
1159 #endif /* KW_PDCP */
1160
1161
1162 \f  
1163 /*********************************************************************
1164  *             Primitives for CKW interface 
1165  ********************************************************************/
1166
1167 /* CKW Bind Confirm primitive */
1168
1169 CkwBndCfm kwUiCkwBndCfmMt[] =
1170 {
1171 #ifdef LCKWUICKW
1172    cmPkCkwBndCfm,            /* 0 - loosely coupled */
1173 #endif /* LCCKUICKW */
1174 #ifdef NH
1175    NhLiCkwBndCfm,            /* 1 - tightly coupled, RRC  */
1176 #endif /* NH */
1177 };
1178
1179 /* CKW Configuration confirm primitive */
1180
1181 RlcCfgCfm kwUiRlcCfgCfmMt[] =
1182 {
1183 #ifdef LCKWUICKW
1184    cmPkRlcCfgCfm,            /* 0 - loosely coupled */
1185 #endif /* LCKWUICKW */
1186 #ifdef NH
1187    NhLiRlcCfgCfm,            /* 1 - tightly coupled, RRC  */
1188 #endif /* NH */
1189 };
1190
1191 CkwUeIdChgCfm kwUiCkwUeIdChgCfmMt[] =
1192 {
1193 #ifdef LCKWUICKW
1194    cmPkCkwUeIdChgCfm,            /* 0 - loosely coupled */
1195 #endif /* LCKWUICKW */
1196 #ifdef NH
1197    NhLiCkwUeIdChgCfm,            /* 1 - tightly coupled, RRC  */
1198 #endif /* NH */
1199 };
1200
1201
1202 \f  
1203 /****************************************************************************
1204  *                         CKW Interface Mt functions
1205  ***************************************************************************/
1206 /**
1207  *
1208  * @brief 
1209  *
1210  *        Handler for confirming  the bind request received from CKW
1211  *        interface.
1212  *
1213  * @b Description:
1214  *
1215  *        This function send the bind confirm primitive to the RLC user,
1216  *        when it receives a bind request from its service user.
1217  *
1218  *  @param[in] pst      - Post structure  
1219  *  @param[in] suId     - Service user SAP ID 
1220  *  @param[in] status   - Status
1221  *
1222  *  @return  S16
1223  *      -# ROK 
1224  */
1225 S16 RlcUiCkwBndCfm
1226 (
1227 Pst     *pst,                       /* post structure */
1228 SuId    suId,                      /* Service User Id */
1229 uint8_t status                     /* Status */
1230 )
1231 {
1232
1233    /* jump to specific primitive depending on configured selector */
1234    (*kwUiCkwBndCfmMt[pst->selector])(pst, suId, status);
1235
1236    return ROK;
1237
1238 } /* end of RlcUiCkwBndCfm */
1239
1240 \f
1241 /**
1242  *
1243  * @brief 
1244  *
1245  *        Handler for sending a configuration confirm to RRC.
1246  *
1247  * @b Description:
1248  *
1249  *        This function is used by RLC user to send a configuration
1250  *        confirmation to RRC after configuring(add/delete/modify)
1251  *        the RLC entities. 
1252  *
1253  *  @param[in] pst      Post structure  
1254  *  @param[in] transId  Transaction Id 
1255  *  @param[in] cfmInfo  Config Confirmation Info 
1256  *
1257  *  @return  S16
1258  *      -# ROK 
1259  *
1260  */
1261 S16 RlcUiRlcCfgCfm
1262 (
1263 Pst            *pst,                      /* post structure */
1264 SuId           suId,                      /* Service User Id */
1265 RlcCfgCfmInfo  *cfmInfo                    /* Configuration Confirm */
1266 )
1267 {
1268
1269    /* jump to specific primitive depending on configured selector */
1270    (*kwUiRlcCfgCfmMt[pst->selector])(pst, suId, cfmInfo);
1271
1272    return ROK;
1273
1274 } /* end of RlcUiRlcCfgCfm */
1275
1276 \f
1277 /**
1278  *
1279  * @brief 
1280  *
1281  *        Handler for sending a configuration for UE ID change.
1282  *
1283  * @b Description:
1284  *
1285  *        This function is used by RLC to send a configuration
1286  *        confirm for UE ID change.
1287  *
1288  *  @param[in] pst      Post structure  
1289  *  @param[in] suId     Service User Id
1290  *  @param[in] transId  Transaction Id 
1291  *  @param[in] cfmInfo  Config Confirmation Info 
1292  *
1293  *  @return  S16
1294  *      -# ROK 
1295  *
1296  */
1297 S16 RlcUiCkwUeIdChgCfm 
1298 (
1299 Pst            *pst,                      /* post structure */
1300 SuId           suId,                      /* Service User Id */
1301 uint32_t       transId,
1302 CkwUeInfo      *ueInfo,
1303 CmStatus       status
1304 )
1305 {
1306
1307    /* jump to specific primitive depending on configured selector */
1308    (*kwUiCkwUeIdChgCfmMt[pst->selector])(pst, suId, transId, ueInfo, status);
1309
1310    return ROK;
1311
1312 } /* end of RlcUiRlcCfgCfm */
1313
1314
1315 #if (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF))
1316 /**
1317  *
1318  * @brief 
1319  *
1320  *        rlcDlBatchProcSplit- process rbug messages
1321  *
1322  *  @return  S16
1323  *      -# ROK 
1324  */
1325 S16 rlcDlBatchProcSplit(Void)
1326 {
1327
1328 /* Read from Ring Buffer and process PDCP packets */
1329    Void *elmIndx = NULLP;
1330    RxmBufReq *datReq = NULLP;
1331 #ifdef LTE_ADV
1332    uint32_t dlPktCount = 0;
1333 #endif
1334    uint8_t rngBufDeqIndx = 0;
1335    uint32_t rngBufDeqMaxCnt;
1336    uint32_t rngBufCurrCnt;
1337
1338    rngBufDeqMaxCnt = SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT;
1339 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
1340    rngBufCurrCnt = SGetNumElemInRng(SS_RNG_BUF_RX_TO_DLRLC);
1341    if ( rngBufCurrCnt > (3 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
1342    {
1343       if ( rngBufCurrCnt > (6 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
1344       {
1345          /* Restablishment scenario */
1346          rngBufDeqMaxCnt = (4 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT);
1347       }
1348       else
1349       {
1350          rngBufDeqMaxCnt = (3 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT)/2;
1351       }
1352    }
1353 #endif
1354    elmIndx = SRngGetRIndx(SS_RNG_BUF_RX_TO_DLRLC);
1355    while(NULLP != elmIndx)
1356    {
1357       datReq = (RxmBufReq *)elmIndx;
1358       if(datReq->mBuf != NULLP)
1359       {
1360         cmUnpkKwuDatReq(rlcProcDlData, &datReq->pst, datReq->mBuf);
1361       }
1362       else
1363       {
1364          DU_LOG("\nERROR  --> RLC : mBuf is NULL");
1365          if(datReq->mBuf)
1366           cmUnpkKwuDatReq(rlcProcDlData, &datReq->pst, datReq->mBuf);
1367
1368       }
1369       SsRngInfoTbl[SS_RNG_BUF_RX_TO_DLRLC].nPktProc++;//Number of pkt processed in tti
1370       datReq->mBuf = NULLP;
1371       SRngIncrRIndx(SS_RNG_BUF_RX_TO_DLRLC);
1372       rngBufDeqIndx++;
1373       if(rngBufDeqIndx >= rngBufDeqMaxCnt)
1374       {
1375          break;
1376       }
1377 #ifdef LTE_ADV
1378       {
1379         dlPktCount++;
1380         if(dlPktCount > 75)
1381         {
1382            break;
1383         }
1384       }
1385 #endif
1386       if((elmIndx = SRngGetRIndx(SS_RNG_BUF_RX_TO_DLRLC)) == NULLP)
1387       {
1388          break;
1389       }
1390    }
1391
1392    return ROK;
1393 }
1394 #endif
1395
1396 #if defined(PDCP_RLC_DL_RBUF) || defined(SS_RBUF)
1397 S16 rlcDlBatchProc(Void)
1398 {
1399 /* Read from Ring Buffer and process PDCP packets */
1400
1401    uint8_t rngBufDeqIndx = 0;
1402    uint32_t rngBufDeqMaxCnt;
1403 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
1404    uint32_t rngBufCurrCnt;
1405 #endif
1406    /* Memory regions different for BRCM and Intel */
1407    /*dstProcId,srcProcId,dstEnt,dstInst,srcEnt,srcInst,prior,route,event,region,pool,selector*/
1408 #ifdef SS_RBUF
1409    static Pst rlcDlRbfuPst ={1,1,ENTRLC,1,ENTPJ,1,PRIOR0,RTESPEC,KWU_EVT_DAT_REQ,1,1,0,0};
1410 #else
1411    static Pst rlcDlRbfuPst ={1,1,ENTRLC,1,ENTPJ,1,PRIOR0,RTESPEC,KWU_EVT_DAT_REQ,2,1,0,0};
1412 #endif
1413    Void *elmIndx = NULLP;
1414    KwuDatReqDetl *kwuDatReqDetl = NULLP;
1415    RlcDatReqInfo datReq;
1416
1417    rngBufDeqMaxCnt = SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT;
1418 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
1419    rngBufCurrCnt = SGetNumElemInRng(SS_RNG_BUF_DLPDCP_TO_DLRLC);
1420    if ( rngBufCurrCnt > (3 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
1421    {
1422       if ( rngBufCurrCnt > (5 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
1423       {
1424          /* Restablishment scenario */
1425          rngBufDeqMaxCnt = (4 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT);
1426       }
1427       else
1428       {
1429          rngBufDeqMaxCnt = (2 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT);
1430       }
1431    }
1432 #endif
1433    elmIndx = SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
1434    while(NULLP != elmIndx)
1435    {
1436       kwuDatReqDetl = (KwuDatReqDetl *)elmIndx;
1437       datReq.rlcId = kwuDatReqDetl->rlcId;
1438       datReq.sduId = kwuDatReqDetl->sduId;
1439       datReq.lcType = kwuDatReqDetl->lcType;
1440       SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].nPktProc++;//Number of pkt processed in tti
1441       if(kwuDatReqDetl->mBuf != NULLP)
1442       {
1443          rlcProcDlData(&rlcDlRbfuPst, kwuDatReqDetl->spId, &datReq, kwuDatReqDetl->mBuf);
1444       }
1445       SRngIncrRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
1446       rngBufDeqIndx++;
1447
1448       if(rngBufDeqIndx >= rngBufDeqMaxCnt)
1449       {
1450          break;
1451       }
1452       elmIndx = (Void *)SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
1453    }
1454
1455    return ROK;
1456 }
1457
1458
1459 S16 rlcUtlDlBatchProcPkts(Void)
1460 {
1461     rlcDlBatchProc();
1462 #ifdef SS_RBUF
1463 #ifdef LTE_L2_MEAS
1464     rlcUtlDlBatchProcHqStaInd();
1465 #endif
1466     rlcUtlFreeDlMem();
1467 #endif
1468     return ROK;
1469 }   
1470
1471
1472 S16 rlcUtlDlFreeRlcRBuf(Void)
1473 {
1474 /* Read from Ring Buffer and process PDCP packets */
1475    Void *elmIndx = NULLP;
1476    KwuDatReqDetl *kwuDatReqDetl = NULLP;
1477    /* Free SS_RNG_BUF_DLPDCP_TO_DLRLC  */
1478    elmIndx = SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
1479    while(NULLP != elmIndx)
1480    {
1481       kwuDatReqDetl = (KwuDatReqDetl *)elmIndx;
1482       SRngIncrRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
1483       SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].nPktProc++;
1484       ODU_PUT_MSG_BUF(kwuDatReqDetl->mBuf);
1485       elmIndx = NULLP;
1486       kwuDatReqDetl = NULLP;
1487       if((elmIndx = SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC)) == NULLP)
1488       break;
1489    }
1490    return ROK;
1491 }
1492
1493
1494 #endif 
1495 #ifdef __cplusplus
1496 }
1497 #endif /* __cplusplus */
1498
1499 /************************************************************************
1500          End of file
1501 **********************************************************************/