RLC-MAC Interface APIs and Memory configuration Changes
[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 "envopt.h"        /* environment options */
41 #include "envdep.h"        /* environment dependent */
42 #include "envind.h"        /* environment independent */
43
44 #include "gen.h"           /* general */
45 #include "ssi.h"           /* system services */
46 #include "cm5.h"           /* common timer defines */
47 #include "cm_tkns.h"       /* common tokens defines */
48 #include "cm_mblk.h"       /* common memory allocation library defines */
49 #include "cm_llist.h"      /* common link list  defines  */
50 #include "cm_hash.h"       /* common hash list  defines */
51 #include "cm_lte.h"        /* common LTE defines */
52 #include "lkw.h"           /* LKW defines */
53 #include "ckw.h"           /* CKW defines */
54 #include "kwu.h"           /* KWU defines */
55 #include "rgu.h"           /* RGU defines */
56
57 #include "kw_err.h"
58 #include "kw_env.h"        /* RLC environment options */
59 #include "kw.h"            /* RLC defines */
60
61 /* extern (.x) include files */
62 #include "gen.x"           /* general */
63 #include "ssi.x"           /* system services */
64
65 #include "cm5.x"           /* common timer library */
66 #include "cm_tkns.x"       /* common tokens */
67 #include "cm_mblk.x"       /* common memory allocation */
68 #include "cm_llist.x"      /* common link list */
69 #include "cm_hash.x"       /* common hash list */
70 #include "cm_lte.x"        /* common LTE includes */
71 #include "cm_lib.x"        /* common memory allocation library */
72 #include "lkw.x"           /* LKW */
73 #include "ckw.x"           /* CKW */
74 #include "kwu.x"           /* KWU */
75 #include "rgu.x"           /* RGU */
76 #if defined(MAC_RLC_UL_RBUF) || (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF)) || defined(SS_RBUF)
77 #include "ss_rbuf.h"
78 #include "ss_rbuf.x"
79 #endif
80 #include "kw.x"
81 #if defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF)
82 #include "mt_plat_t33.h"
83 #include "mt_plat_t33.x"
84 #endif
85
86 #ifndef LCKWUIKWU
87 #define PTKWKWU
88 #endif
89
90 #ifndef LCKWUICKW
91 #define PTKWCKW
92 #endif
93
94 #ifndef NH
95 #define PTKWKWU
96 #define PTKWCKW
97 #endif
98
99 #ifndef PJ 
100 #define PTKWKWU
101 #define PTKWCKW
102 #endif
103
104
105 #ifdef __cplusplus
106 EXTERN "C" {
107 #endif /* __cplusplus */
108
109 \f  
110 /*********************************************************************
111  *             Forward Declartion for KWU Porting Functions
112  ********************************************************************/
113 #if defined(PDCP_RLC_DL_RBUF) || defined(SS_RBUF)
114 PUBLIC S16 kwDlBatchProc ARGS ((Void));
115 PUBLIC S16 kwUtlDlFreeRlcRBuf ARGS((Void));
116 EXTERN void kwUtlDlBatchProcHqStaInd ARGS ((Void));
117 EXTERN Void kwUtlFreeDlMem ARGS((Void));
118 EXTERN SsRngBufCnt rngCb;
119 EXTERN S16 kwUtlDlBatchProcPkts ARGS((Void));
120 #endif
121
122 #if (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF))
123 PUBLIC S16 kwDlBatchProcSplit  ARGS((Void));
124 #endif
125
126 \f  
127 /*********************************************************************
128  *             Primitives for KWU interface 
129  ********************************************************************/
130
131 /* KWU Bind Confirm primitive */
132
133 PUBLIC KwuBndCfm kwUiKwuBndCfmMt[] =
134 {
135 #ifdef LCKWUIKWU
136    cmPkKwuBndCfm,            /* 0 - loosely coupled */
137 #endif /* LCKWUIKWU */
138 #ifdef NH
139    NhLiKwuBndCfm,            /* 1 - tightly coupled, RRC  */
140 #endif /* NH */
141 #ifndef KW_PDCP
142 #ifdef PJ
143    PjLiKwuBndCfm,            /* 2 - tightly coupled, PDCP */
144 #endif /* NH */
145 #endif /* KW_PDCP */
146 #ifndef TENB_ACC
147 #ifdef LWLCKWUIKWU
148    cmPkKwuBndCfm,      /* 3 - light weight loosely coupled */ 
149 #endif /* LCKWUIKWU */
150 #endif /*TENB_ACC*/
151 };
152
153 /* KWU Data Indication primitive */
154
155 PUBLIC KwuDatInd kwUiKwuDatIndMt[] =
156 {
157 #ifdef LCKWUIKWU
158    cmPkKwuDatInd,            /* 0 - loosely coupled */
159 #endif /* LCKWUIKWU */
160 #ifdef NH
161    NhLiKwuDatInd,            /* 1 - tightly coupled, RRC  */
162 #endif /* NH */
163 #ifdef KW_PDCP
164 #else
165 #ifdef PJ
166    PjLiKwuDatInd,            /* 2 - tightly coupled, PDCP */
167 #endif /* NH */
168 #ifndef TENB_ACC
169 #ifdef LWLCKWUIKWU
170    cmPkKwuDatInd,         /* 3 - light weight loosely coupled */ 
171 #endif /* LCKWUIKWU */
172 #endif /*TENB_ACC*/
173 #endif /* KW_PDCP */
174 };
175
176 #ifndef KW_PDCP
177 PUBLIC KwuDatCfm kwUiKwuDatCfmMt[] =
178 {
179 #ifdef LCKWUIKWU
180    cmPkKwuDatCfm,            /* 0 - loosely coupled */
181 #endif /* LCKWUIKWU */
182 #ifdef PJ
183    PjLiKwuDatCfm,            /* 2 - tightly coupled, PDCP */
184 #endif /* PJ */
185 #ifndef TENB_ACC
186 #ifdef LWLCKWUIKWU
187    cmPkKwuDatCfm,         /* 3 - light weight loosely coupled */ 
188 #endif /* LCKWUIKWU */
189 #endif /*TENB_ACC*/
190 };
191
192 /* KWU AM Status Indication primitive */
193
194 PUBLIC KwuStaInd kwUiKwuStaIndMt[] =
195 {
196 #ifdef LCKWUIKWU
197    cmPkKwuStaInd,            /* 0 - loosely coupled */
198 #endif /* LCKWUIKWU */
199 #ifdef PJ
200    PjLiKwuStaInd,            /* 2 - tightly coupled, PDCP */
201 #endif /* PJ */
202 #ifndef TENB_ACC
203 #ifdef LWLCKWUIKWU
204    cmPkKwuStaInd,         /* 3 - light weight loosely coupled */ 
205 #endif /* LCKWUIKWU */
206 #endif /*TENB_ACC*/
207 };
208
209 PUBLIC KwuReEstCmpInd kwUiKwuReEstCmpIndMt[] =
210 {
211 #ifdef LCKWUIKWU
212    cmPkKwuReEstCmpInd,            /* 0 - loosely coupled */
213 #endif /* LCKWUIKWU */
214 #ifdef PJ
215    PjLiKwuReEstCmpInd,            /* 2 - tightly coupled, PDCP */
216 #else
217 #endif /* PJ */
218 #ifndef TENB_ACC
219 #ifdef LWLCKWUIKWU
220    cmPkKwuReEstCmpInd,    /* 3 - light weight loosely coupled */ 
221 #endif /* LCKWUIKWU */
222 #endif /*TENB_ACC*/
223 };
224
225 /* kw005.201 added support for L2 measurement */
226 PUBLIC KwuDiscSduCfm kwUiKwuDiscSduCfmMt[] =
227 {
228 #ifdef LCKWUIKWU
229    cmPkKwuDiscSduCfm,            /* 0 - loosely coupled */
230 #endif /* LCKWUIKWU */
231 #ifdef PJ
232    PjLiKwuDiscSduCfm,            /* 2 - tightly coupled, PDCP */
233 #endif
234 #ifndef TENB_ACC
235 #ifdef LWLCKWUIKWU
236    cmPkKwuDiscSduCfm,    /* 3 - light weight loosely coupled */    
237 #endif /* PJ */
238 #endif /*TENB_ACC*/
239 };
240 PUBLIC KwuFlowCntrlInd kwUiKwuFlowCntrlIndMt[] =
241 {
242 #ifdef LCKWUIKWU
243    cmPkKwuFlowCntrlInd,            /* 0 - loosely coupled */
244 #endif /* LCKWUIKWU */
245 #ifdef PJ
246    PjLiKwuFlowCntrlInd,            /* 2 - tightly coupled, PDCP */
247 #endif /* PJ */
248 #ifdef LCKWUIKWU
249    cmPkKwuFlowCntrlInd,            /* 3 - light weight loosely coupled */
250 #endif /* LCKWUIKWU */
251 };
252 #ifdef LTE_L2_MEAS
253 PUBLIC KwuDatAckInd kwUiKwuDatAckIndMt[] =
254 {
255 #ifdef LCKWUIKWU
256    cmPkKwuDatAckInd,            /* 0 - loosely coupled */
257 #endif /* LCKWUIKWU */
258 #ifdef PJ
259    PjLiKwuDatAckInd,            /* 2 - tightly coupled, PDCP */
260 #endif /* PJ */
261 #ifndef TENB_ACC
262 #ifdef LWLCKWUIKWU
263    cmPkKwuDatAckInd,     /* 3 - light weight loosely coupled, portable */          
264 #endif /* PJ */
265 #endif /*TENB_ACC*/
266 };
267 #endif /* LTE_L2_MEAS */
268 /* KWU AM Data confirm primitive */
269
270 #endif /* KW_PDCP */
271
272 \f  
273 /****************************************************************************
274  *                         KWU Interface Mt functions
275  ***************************************************************************/\f
276 /**
277  *
278  * @brief 
279  *
280  *        Handler for confirming  the bind request received from KWU
281  *        interface.
282  *
283  * @b Description:
284  *
285  *        This function send the bind confirm primitive to the RLC user,
286  *        when it receives a bind request from its service user.
287  *
288  *  @param[in] pst     Post structure  
289  *  @param[in] suId    Service user SAP ID 
290  *  @param[in] status  Status of Confirmation 
291  *
292  *  @return  S16
293  *      -# ROK 
294  *
295  */
296 #ifdef ANSI
297 PUBLIC S16 KwUiKwuBndCfm
298 (
299 Pst *pst,                       /* post structure */
300 SuId suId,                      /* Service User Id */
301 U8   status                     /* Status */
302 )
303 #else
304 PUBLIC S16 KwUiKwuBndCfm(pst, suId, status)
305 Pst *pst;                       /* post structure */
306 SuId suId;                      /* Service User Id */
307 U8   status;                    /* Status */
308 #endif
309 {
310    TRC3(KwUiKwuBndCfm)
311
312    /* jump to specific primitive depending on configured selector */
313    (*kwUiKwuBndCfmMt[pst->selector])(pst, suId, status);
314
315    RETVALUE(ROK);
316
317 } /* end of KwUiKwuBndCfm */
318
319 \f
320 /**
321  *
322  * @brief 
323  *
324  *        Handler for sending the data(SDU) from upper layer. 
325  *
326  * @b Description:
327  *
328  *        This function is used to transfer a SDU received from the peer
329  *        RLC entity to the service user(RRC/PDCP).
330  *
331  *  @param[in] pst         Post structure  
332  *  @param[in] suId        Service User SAP ID 
333  *  @param[in] datIndInfo  Data Request Information
334  *  @param[in] mBuf         Data Buffer (SDU) 
335  *
336  *  @return  S16
337  *      -# ROK 
338  *      -# RFAILED
339  */
340 #ifdef ANSI
341 PUBLIC S16 KwUiKwuDatInd
342 (
343 Pst               *pst,
344 SuId              suId,
345 KwuDatIndInfo     *datInd,
346 Buffer            *mBuf
347 )
348 #else
349 PUBLIC S16 KwUiKwuDatInd(pst, suId, datInd, mBuf)
350 Pst               *pst;
351 SuId              suId;
352 KwuDatIndInfo     *datInd;
353 Buffer            *mBuf;
354 #endif
355 {
356    TRC3(KwUiKwuDatInd)
357
358    /* jump to specific primitive depending on configured selector */
359    (*kwUiKwuDatIndMt[pst->selector])(pst, suId, datInd, mBuf);
360
361    RETVALUE(ROK);
362
363 } /* end of KwUiKwuDatInd */
364
365    PUBLIC int rlcDatCfmsSent = 0;
366 \f
367 #ifndef KW_PDCP
368 /**
369  *
370  * @brief 
371  *
372  *        Handler for sending the data confirmation to upper layer. 
373  *
374  * @b Description:
375  *
376  *        This function is used to send a confirmation to the service
377  *        user about the data received by the peer RLC entity. 
378  *
379  *  @param[in] pst         Post structure  
380  *  @param[in] suId        Service User SAP ID 
381  *  @param[in] datCfmInfo  Data Confirmation Information
382  *
383  *  @return  S16
384  *      -# ROK 
385  *      -# RFAILED
386  */
387 #ifdef ANSI
388 PUBLIC S16 KwUiKwuDatCfm
389 (
390 Pst               *pst,
391 SuId              suId,
392 KwuDatCfmInfo     *datCfm
393 )
394 #else
395 PUBLIC S16 KwUiKwuDatCfm(pst, suId, datCfm)
396 Pst               *pst;
397 SuId              suId;
398 KwuDatCfmInfo     *datCfm;
399 #endif
400 {
401    rlcDatCfmsSent++;
402    TRC3(KwUiKwuDatCfm)
403
404    /* jump to specific primitive depending on configured selector */
405    (*kwUiKwuDatCfmMt[pst->selector])(pst, suId, datCfm);
406
407    RETVALUE(ROK);
408
409 } /* end of KwUiKwuDatCfm */
410
411 \f
412 /**
413  *
414  * @brief 
415  *
416  *        Handler for sending the Status Indication to the upper layer. 
417  *
418  * @b Description:
419  *
420  *        This function is used only by RLC AM entity.It send status 
421  *        indication to the upper layer about the maximum number of 
422  *        re-transmissions reached for a RLC AM entity. 
423  *
424  *  @param[in] pst         Post structure  
425  *  @param[in] suId        Service User SAP ID 
426  *  @param[in] staInd      RLC Entity Id  
427  *
428  *  @return  S16
429  *      -# ROK 
430  *      -# RFAILED
431  */
432 #ifdef ANSI
433 PUBLIC S16 KwUiKwuStaInd
434 (
435 Pst               *pst,
436 SuId              suId,
437 KwuStaIndInfo     *staInd
438 )
439 #else
440 PUBLIC S16 KwUiKwuStaInd(pst, suId, staInd)
441 Pst               *pst;
442 SuId              suId;
443 KwuStaIndInfo     *staInd;
444 #endif
445 {
446    TRC3(KwUiKwuStaInd)
447
448    /* jump to specific primitive depending on configured selector */
449    (*kwUiKwuStaIndMt[pst->selector])(pst, suId, staInd);
450
451    RETVALUE(ROK);
452
453 } /* end of KwUiKwuStaInd */
454
455 \f
456 /**
457  *
458  * @brief 
459  *
460  *        Handler for sending the Status Indication to the upper layer. 
461  *
462  * @b Description:
463  *
464  *        This function is used only by RLC AM entity.It send status 
465  *        indication to the upper layer about the maximum number of 
466  *        re-transmissions reached for a RLC AM entity. 
467  *
468  *  @param[in] pst         Post structure  
469  *  @param[in] suId        Service User SAP ID 
470  *  @param[in] staInd      RLC Entity Id  
471  *
472  *  @return  S16
473  *      -# ROK 
474  *      -# RFAILED
475  */
476 #ifdef ANSI
477 PUBLIC S16 KwUiKwuReEstCmpInd
478 (
479 Pst               *pst,
480 SuId              suId,
481 CmLteRlcId        rlcId
482 )
483 #else
484 PUBLIC S16 KwUiKwuReEstCmpInd(pst, suId, rlcId)
485 Pst               *pst;
486 SuId              suId;
487 CmLteRlcId        rlcId;
488 #endif
489 {
490    TRC3(KwUiKwuReEstCmpInd)
491    RLOG0(L_DEBUG, "In KwUiKwuReEstCmpInd");
492
493    /* jump to specific primitive depending on configured selector */
494    (*kwUiKwuReEstCmpIndMt[pst->selector])(pst, suId, rlcId);
495
496    RETVALUE(ROK);
497
498 } /* end of KwUiKwuReEstCmpInd */
499 /* kw005.201 added support for L2 Measurement */
500 \f
501 /**
502  *
503  * @brief 
504  *
505  *        Handler for sending the Sdu Disc Cfm  to the upper layer. 
506  *
507  * @b Description:
508  *       
509  *       This function confirms the discard of an SDU .
510  *
511  *  @param[in] pst         Post structure  
512  *  @param[in] suId        Service User SAP ID 
513  *  @param[in] discCfm     Disc information.
514  *
515  *  @return  S16
516  *      -# ROK 
517  *      -# RFAILED
518  */
519 #ifdef ANSI
520 PUBLIC S16 KwUiKwuDiscSduCfm
521 (
522 Pst               *pst,
523 SuId              suId,
524 KwuDiscSduInfo    *discCfm
525 )
526 #else
527 PUBLIC S16 KwUiKwuDiscSduCfm(pst, suId, discCfm)
528 Pst               *pst;
529 SuId              suId;
530 KwuDiscSduInfo    *discCfm;
531 #endif
532 {
533    TRC3(KwUiKwuDiscSduCfm)
534
535    /* jump to specific primitive depending on configured selector */
536    (*kwUiKwuDiscSduCfmMt[pst->selector])(pst, suId, discCfm);
537
538    RETVALUE(ROK);
539
540 } /* end of KwUiKwuDiscSduCfm */ 
541
542 /**
543  *
544  * @brief 
545  *
546  *        Handler for sending Flow indication to the upper layer. 
547  *
548  * @b Description:
549  *       
550  *       This function indicates to PDCP if packets need to be stopped or
551  *       started for a particular RB
552  *
553  *  @param[in] pst                Post structure  
554  *  @param[in] suId               Service User SAP ID 
555  *  @param[in] flowCntrlIndInfo   Flow control information.
556  *
557  *  @return  S16
558  *      -# ROK 
559  *      -# RFAILED
560  */
561 #ifdef ANSI
562 PUBLIC S16 KwUiKwuFlowCntrlInd
563 (
564 Pst                   *pst,
565 SuId                  suId,
566 KwuFlowCntrlIndInfo   *flowCntrlIndInfo
567 )
568 #else
569 PUBLIC S16 KwUiKwuFlowCntrlInd(pst, suId, flowCntrlIndInfo)
570 Pst                   *pst;
571 SuId                  suId;
572 KwuFlowCntrlIndInfo   *flowCntrlIndInfo;
573 #endif
574 {
575    TRC3(KwUiKwuFlowCntrlInd)
576
577    /* jump to specific primitive depending on configured selector */
578    (*kwUiKwuFlowCntrlIndMt[pst->selector])(pst, suId, flowCntrlIndInfo);
579
580    RETVALUE(ROK);
581
582 } /* end of KwUiKwuFlowCntrlInd */ 
583 #ifdef LTE_L2_MEAS
584 \f
585 /**
586  *
587  * @brief 
588  *
589  *        Handler for sending the Data ack indication  to the upper layer. 
590  *
591  * @b Description:
592  *       
593  *       This function confirms the succesfull transmission of SDU
594  *
595  *  @param[in] pst         Post structure  
596  *  @param[in] suId        Service User SAP ID 
597  *  @param[in] datAckInd   DatAckInd
598  *
599  *  @return  S16
600  *      -# ROK 
601  *      -# RFAILED
602  */
603 #ifdef ANSI
604 PUBLIC S16 KwUiKwuDatAckInd
605 (
606 Pst               *pst,
607 SuId              suId,
608 KwuDatAckInfo     *datAckInd
609 )
610 #else
611 PUBLIC S16 KwUiKwuDatAckInd(pst, suId, datAckInd)
612 Pst               *pst;
613 SuId              suId;
614 KwuDatAckInfo     *datAckInd;
615 #endif
616 {
617    TRC3(KwUiKwuDatAckInd)
618
619    /* jump to specific primitive depending on configured selector */
620    (*kwUiKwuDatAckIndMt[pst->selector])(pst, suId, datAckInd);
621
622    RETVALUE(ROK);
623
624 } /* end of KwUiKwuDatAckInd */ 
625 #endif /* LTE_L2_MEAS */
626 #endif /* KW_PDCP */
627
628
629 \f  
630 /*********************************************************************
631  *             Primitives for CKW interface 
632  ********************************************************************/
633
634 /* CKW Bind Confirm primitive */
635
636 PUBLIC CkwBndCfm kwUiCkwBndCfmMt[] =
637 {
638 #ifdef LCKWUICKW
639    cmPkCkwBndCfm,            /* 0 - loosely coupled */
640 #endif /* LCCKUICKW */
641 #ifdef NH
642    NhLiCkwBndCfm,            /* 1 - tightly coupled, RRC  */
643 #endif /* NH */
644 };
645
646 /* CKW Configuration confirm primitive */
647
648 PUBLIC CkwCfgCfm kwUiCkwCfgCfmMt[] =
649 {
650 #ifdef LCKWUICKW
651    cmPkCkwCfgCfm,            /* 0 - loosely coupled */
652 #endif /* LCKWUICKW */
653 #ifdef NH
654    NhLiCkwCfgCfm,            /* 1 - tightly coupled, RRC  */
655 #endif /* NH */
656 };
657
658 PUBLIC CkwUeIdChgCfm kwUiCkwUeIdChgCfmMt[] =
659 {
660 #ifdef LCKWUICKW
661    cmPkCkwUeIdChgCfm,            /* 0 - loosely coupled */
662 #endif /* LCKWUICKW */
663 #ifdef NH
664    NhLiCkwUeIdChgCfm,            /* 1 - tightly coupled, RRC  */
665 #endif /* NH */
666 };
667
668
669 \f  
670 /****************************************************************************
671  *                         CKW Interface Mt functions
672  ***************************************************************************/
673 /**
674  *
675  * @brief 
676  *
677  *        Handler for confirming  the bind request received from CKW
678  *        interface.
679  *
680  * @b Description:
681  *
682  *        This function send the bind confirm primitive to the RLC user,
683  *        when it receives a bind request from its service user.
684  *
685  *  @param[in] pst      - Post structure  
686  *  @param[in] suId     - Service user SAP ID 
687  *  @param[in] status   - Status
688  *
689  *  @return  S16
690  *      -# ROK 
691  */
692 #ifdef ANSI
693 PUBLIC S16 KwUiCkwBndCfm
694 (
695 Pst *pst,                       /* post structure */
696 SuId suId,                      /* Service User Id */
697 U8   status                     /* Status */
698 )
699 #else
700 PUBLIC S16 KwUiCkwBndCfm(pst, suId, status)
701 Pst *pst;                       /* post structure */
702 SuId suId;                      /* Service User Id */
703 U8   status;                    /* Status */
704 #endif
705 {
706    TRC3(KwUiCkwBndCfm)
707
708    /* jump to specific primitive depending on configured selector */
709    (*kwUiCkwBndCfmMt[pst->selector])(pst, suId, status);
710
711    RETVALUE(ROK);
712
713 } /* end of KwUiCkwBndCfm */
714
715 \f
716 /**
717  *
718  * @brief 
719  *
720  *        Handler for sending a configuration confirm to RRC.
721  *
722  * @b Description:
723  *
724  *        This function is used by RLC user to send a configuration
725  *        confirmation to RRC after configuring(add/delete/modify)
726  *        the RLC entities. 
727  *
728  *  @param[in] pst      Post structure  
729  *  @param[in] transId  Transaction Id 
730  *  @param[in] cfmInfo  Config Confirmation Info 
731  *
732  *  @return  S16
733  *      -# ROK 
734  *
735  */
736 #ifdef ANSI
737 PUBLIC S16 KwUiCkwCfgCfm
738 (
739 Pst            *pst,                      /* post structure */
740 SuId           suId,                      /* Service User Id */
741 CkwCfgCfmInfo  *cfmInfo                    /* Configuration Confirm */
742 )
743 #else
744 PUBLIC S16 KwUiCkwCfgCfm(pst, suId, cfmInfo)
745 Pst            *pst;                      /* post structure */
746 SuId           suId;                      /* Service User Id */
747 CkwCfgCfmInfo  *cfmInfo;                   /* Configuration Confirm */
748 #endif
749 {
750    TRC3(KwUiCkwCfgCfm)
751
752    /* jump to specific primitive depending on configured selector */
753    (*kwUiCkwCfgCfmMt[pst->selector])(pst, suId, cfmInfo);
754
755    RETVALUE(ROK);
756
757 } /* end of KwUiCkwCfgCfm */
758
759 \f
760 /**
761  *
762  * @brief 
763  *
764  *        Handler for sending a configuration for UE ID change.
765  *
766  * @b Description:
767  *
768  *        This function is used by RLC to send a configuration
769  *        confirm for UE ID change.
770  *
771  *  @param[in] pst      Post structure  
772  *  @param[in] suId     Service User Id
773  *  @param[in] transId  Transaction Id 
774  *  @param[in] cfmInfo  Config Confirmation Info 
775  *
776  *  @return  S16
777  *      -# ROK 
778  *
779  */
780 #ifdef ANSI
781 PUBLIC S16 KwUiCkwUeIdChgCfm 
782 (
783 Pst            *pst,                      /* post structure */
784 SuId           suId,                      /* Service User Id */
785 U32            transId,
786 CkwUeInfo      *ueInfo,
787 CmStatus       status
788 )
789 #else
790 PUBLIC S16 KwUiCkwUeIdChgCfm(pst, suId, transId,ueInfo,status)
791 Pst            *pst;                      /* post structure */
792 SuId           suId;                      /* Service User Id */
793 U32            transId;
794 CkwUeInfo      *ueInfo;
795 CmStatus       status;
796 #endif
797 {
798    TRC3(KwUiCkwUeIdChgCfm)
799
800    /* jump to specific primitive depending on configured selector */
801    (*kwUiCkwUeIdChgCfmMt[pst->selector])(pst, suId, transId, ueInfo, status);
802
803    RETVALUE(ROK);
804
805 } /* end of KwUiCkwCfgCfm */
806
807
808 #if (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF))
809 /**
810  *
811  * @brief 
812  *
813  *        kwDlBatchProcSplit- process rbug messages
814  *
815  *  @return  S16
816  *      -# ROK 
817  */
818 #ifdef ANSI
819 PUBLIC S16 kwDlBatchProcSplit 
820 (
821 Void
822 )
823 #else
824 PUBLIC S16 kwDlBatchProcSplit()
825 Void;
826 #endif
827 {
828
829 /* Read from Ring Buffer and process PDCP packets */
830    Void *elmIndx = NULLP;
831    RxmBufReq *datReq = NULLP;
832 #ifdef LTE_ADV
833    U32 dlPktCount = 0;
834 #endif
835    U8 rngBufDeqIndx = 0;
836    U32 rngBufDeqMaxCnt;
837    U32 rngBufCurrCnt;
838
839    rngBufDeqMaxCnt = SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT;
840 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
841    rngBufCurrCnt = SGetNumElemInRng(SS_RNG_BUF_RX_TO_DLRLC);
842    if ( rngBufCurrCnt > (3 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
843    {
844       if ( rngBufCurrCnt > (6 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
845       {
846          /* Restablishment scenario */
847          rngBufDeqMaxCnt = (4 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT);
848       }
849       else
850       {
851          rngBufDeqMaxCnt = (3 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT)/2;
852       }
853    }
854 #endif
855    elmIndx = SRngGetRIndx(SS_RNG_BUF_RX_TO_DLRLC);
856    while(NULLP != elmIndx)
857    {
858       datReq = (RxmBufReq *)elmIndx;
859       if(datReq->mBuf != NULLP)
860       {
861         cmUnpkKwuDatReq(KwUiKwuDatReq, &datReq->pst, datReq->mBuf);
862       }
863       else
864       {
865          RLOG0(L_ERROR, "mBuf is NULL");
866          if(datReq->mBuf)
867           cmUnpkKwuDatReq(KwUiKwuDatReq, &datReq->pst, datReq->mBuf);
868
869       }
870       SsRngInfoTbl[SS_RNG_BUF_RX_TO_DLRLC].nPktProc++;//Number of pkt processed in tti
871       datReq->mBuf = NULLP;
872       SRngIncrRIndx(SS_RNG_BUF_RX_TO_DLRLC);
873       rngBufDeqIndx++;
874       if(rngBufDeqIndx >= rngBufDeqMaxCnt)
875       {
876          break;
877       }
878 #ifdef LTE_ADV
879       {
880         dlPktCount++;
881         if(dlPktCount > 75)
882         {
883            break;
884         }
885       }
886 #endif
887       if((elmIndx = SRngGetRIndx(SS_RNG_BUF_RX_TO_DLRLC)) == NULLP)
888       {
889          break;
890       }
891    }
892
893    RETVALUE(ROK);
894 }
895 #endif
896
897 #if defined(PDCP_RLC_DL_RBUF) || defined(SS_RBUF)
898 #ifdef ANSI
899 PUBLIC S16 kwDlBatchProc
900 (
901 Void
902 )
903 #else
904 PUBLIC S16 kwDlBatchProc()
905 Void;
906 #endif
907 {
908 /* Read from Ring Buffer and process PDCP packets */
909
910    U8 rngBufDeqIndx = 0;
911    U32 rngBufDeqMaxCnt;
912 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
913    U32 rngBufCurrCnt;
914 #endif
915    /* Memory regions different for BRCM and Intel */
916    /*dstProcId,srcProcId,dstEnt,dstInst,srcEnt,srcInst,prior,route,event,region,pool,selector*/
917 #ifdef SS_RBUF
918    PRIVATE Pst rlcDlRbfuPst ={1,1,ENTKW,1,ENTPJ,1,PRIOR0,RTESPEC,KWU_EVT_DAT_REQ,1,1,0,0};
919 #else
920    PRIVATE Pst rlcDlRbfuPst ={1,1,ENTKW,1,ENTPJ,1,PRIOR0,RTESPEC,KWU_EVT_DAT_REQ,2,1,0,0};
921 #endif
922    Void *elmIndx = NULLP;
923    KwuDatReqDetl *kwuDatReqDetl = NULLP;
924    KwuDatReqInfo datReq;
925
926    rngBufDeqMaxCnt = SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT;
927 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
928    rngBufCurrCnt = SGetNumElemInRng(SS_RNG_BUF_DLPDCP_TO_DLRLC);
929    if ( rngBufCurrCnt > (3 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
930    {
931       if ( rngBufCurrCnt > (5 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
932       {
933          /* Restablishment scenario */
934          rngBufDeqMaxCnt = (4 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT);
935       }
936       else
937       {
938          rngBufDeqMaxCnt = (2 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT);
939       }
940    }
941 #endif
942    elmIndx = SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
943    while(NULLP != elmIndx)
944    {
945       kwuDatReqDetl = (KwuDatReqDetl *)elmIndx;
946       datReq.rlcId = kwuDatReqDetl->rlcId;
947       datReq.sduId = kwuDatReqDetl->sduId;
948       datReq.lcType = kwuDatReqDetl->lcType;
949       SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].nPktProc++;;//Number of pkt processed in tti
950       if(kwuDatReqDetl->mBuf != NULLP)
951       {
952          KwUiKwuDatReq(&rlcDlRbfuPst, kwuDatReqDetl->spId, &datReq, kwuDatReqDetl->mBuf);
953       }
954       SRngIncrRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
955       rngBufDeqIndx++;
956
957       if(rngBufDeqIndx >= rngBufDeqMaxCnt)
958       {
959          break;
960       }
961       elmIndx = (Void *)SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
962    }
963
964    RETVALUE(ROK);
965 }
966
967
968 #ifdef ANSI
969 PUBLIC S16 kwUtlDlBatchProcPkts
970 (
971 Void
972 )
973 #else
974 PUBLIC S16 kwUtlDlBatchProcPkts
975 Void;
976 #endif
977 {
978     kwDlBatchProc();
979 #ifdef SS_RBUF
980 #ifdef LTE_L2_MEAS
981     kwUtlDlBatchProcHqStaInd();
982 #endif
983     kwUtlFreeDlMem();
984 #endif
985     RETVALUE(ROK);
986 }   
987
988
989 #ifdef ANSI
990 PUBLIC S16 kwUtlDlFreeRlcRBuf
991 (
992 Void
993 )
994 #else
995 PUBLIC S16 kwUtlDlFreeRlcRBuf
996 Void;
997 #endif
998 {
999 /* Read from Ring Buffer and process PDCP packets */
1000    Void *elmIndx = NULLP;
1001    KwuDatReqDetl *kwuDatReqDetl = NULLP;
1002    /* Free SS_RNG_BUF_DLPDCP_TO_DLRLC  */
1003    elmIndx = SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
1004    while(NULLP != elmIndx)
1005    {
1006       kwuDatReqDetl = (KwuDatReqDetl *)elmIndx;
1007       SRngIncrRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
1008       SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].nPktProc++;
1009       SPutMsg(kwuDatReqDetl->mBuf);
1010       elmIndx = NULLP;
1011       kwuDatReqDetl = NULLP;
1012       if((elmIndx = SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC)) == NULLP)
1013       break;
1014    }
1015    RETVALUE(ROK);
1016 }
1017
1018
1019 #endif 
1020 #ifdef __cplusplus
1021 }
1022 #endif /* __cplusplus */
1023 /********************************************************************30**
1024          End of file
1025 **********************************************************************/