a1e49fbb8743e2b511993055be79faf3edafeddb
[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 KwuDatIndInfo     *datInd,
345 Buffer            *mBuf
346 )
347 #else
348 PUBLIC S16 KwUiKwuDatInd(pst, datInd, mBuf)
349 Pst               *pst;
350 KwuDatIndInfo     *datInd;
351 Buffer            *mBuf;
352 #endif
353 {
354    TRC3(KwUiKwuDatInd)
355
356    /* jump to specific primitive depending on configured selector */
357    (*kwUiKwuDatIndMt[pst->selector])(pst, datInd, mBuf);
358
359    RETVALUE(ROK);
360
361 } /* end of KwUiKwuDatInd */
362
363    PUBLIC int rlcDatCfmsSent = 0;
364 \f
365 #ifndef KW_PDCP
366 /**
367  *
368  * @brief 
369  *
370  *        Handler for sending the data confirmation to upper layer. 
371  *
372  * @b Description:
373  *
374  *        This function is used to send a confirmation to the service
375  *        user about the data received by the peer RLC entity. 
376  *
377  *  @param[in] pst         Post structure  
378  *  @param[in] suId        Service User SAP ID 
379  *  @param[in] datCfmInfo  Data Confirmation Information
380  *
381  *  @return  S16
382  *      -# ROK 
383  *      -# RFAILED
384  */
385 #ifdef ANSI
386 PUBLIC S16 KwUiKwuDatCfm
387 (
388 Pst               *pst,
389 SuId              suId,
390 KwuDatCfmInfo     *datCfm
391 )
392 #else
393 PUBLIC S16 KwUiKwuDatCfm(pst, suId, datCfm)
394 Pst               *pst;
395 SuId              suId;
396 KwuDatCfmInfo     *datCfm;
397 #endif
398 {
399    rlcDatCfmsSent++;
400    TRC3(KwUiKwuDatCfm)
401
402    /* jump to specific primitive depending on configured selector */
403    (*kwUiKwuDatCfmMt[pst->selector])(pst, suId, datCfm);
404
405    RETVALUE(ROK);
406
407 } /* end of KwUiKwuDatCfm */
408
409 \f
410 /**
411  *
412  * @brief 
413  *
414  *        Handler for sending the Status Indication to the upper layer. 
415  *
416  * @b Description:
417  *
418  *        This function is used only by RLC AM entity.It send status 
419  *        indication to the upper layer about the maximum number of 
420  *        re-transmissions reached for a RLC AM entity. 
421  *
422  *  @param[in] pst         Post structure  
423  *  @param[in] suId        Service User SAP ID 
424  *  @param[in] staInd      RLC Entity Id  
425  *
426  *  @return  S16
427  *      -# ROK 
428  *      -# RFAILED
429  */
430 #ifdef ANSI
431 PUBLIC S16 KwUiKwuStaInd
432 (
433 Pst               *pst,
434 SuId              suId,
435 KwuStaIndInfo     *staInd
436 )
437 #else
438 PUBLIC S16 KwUiKwuStaInd(pst, suId, staInd)
439 Pst               *pst;
440 SuId              suId;
441 KwuStaIndInfo     *staInd;
442 #endif
443 {
444    TRC3(KwUiKwuStaInd)
445
446    /* jump to specific primitive depending on configured selector */
447    (*kwUiKwuStaIndMt[pst->selector])(pst, suId, staInd);
448
449    RETVALUE(ROK);
450
451 } /* end of KwUiKwuStaInd */
452
453 \f
454 /**
455  *
456  * @brief 
457  *
458  *        Handler for sending the Status Indication to the upper layer. 
459  *
460  * @b Description:
461  *
462  *        This function is used only by RLC AM entity.It send status 
463  *        indication to the upper layer about the maximum number of 
464  *        re-transmissions reached for a RLC AM entity. 
465  *
466  *  @param[in] pst         Post structure  
467  *  @param[in] suId        Service User SAP ID 
468  *  @param[in] staInd      RLC Entity Id  
469  *
470  *  @return  S16
471  *      -# ROK 
472  *      -# RFAILED
473  */
474 #ifdef ANSI
475 PUBLIC S16 KwUiKwuReEstCmpInd
476 (
477 Pst               *pst,
478 SuId              suId,
479 CmLteRlcId        rlcId
480 )
481 #else
482 PUBLIC S16 KwUiKwuReEstCmpInd(pst, suId, rlcId)
483 Pst               *pst;
484 SuId              suId;
485 CmLteRlcId        rlcId;
486 #endif
487 {
488    TRC3(KwUiKwuReEstCmpInd)
489    RLOG0(L_DEBUG, "In KwUiKwuReEstCmpInd");
490
491    /* jump to specific primitive depending on configured selector */
492    (*kwUiKwuReEstCmpIndMt[pst->selector])(pst, suId, rlcId);
493
494    RETVALUE(ROK);
495
496 } /* end of KwUiKwuReEstCmpInd */
497 /* kw005.201 added support for L2 Measurement */
498 \f
499 /**
500  *
501  * @brief 
502  *
503  *        Handler for sending the Sdu Disc Cfm  to the upper layer. 
504  *
505  * @b Description:
506  *       
507  *       This function confirms the discard of an SDU .
508  *
509  *  @param[in] pst         Post structure  
510  *  @param[in] suId        Service User SAP ID 
511  *  @param[in] discCfm     Disc information.
512  *
513  *  @return  S16
514  *      -# ROK 
515  *      -# RFAILED
516  */
517 #ifdef ANSI
518 PUBLIC S16 KwUiKwuDiscSduCfm
519 (
520 Pst               *pst,
521 SuId              suId,
522 KwuDiscSduInfo    *discCfm
523 )
524 #else
525 PUBLIC S16 KwUiKwuDiscSduCfm(pst, suId, discCfm)
526 Pst               *pst;
527 SuId              suId;
528 KwuDiscSduInfo    *discCfm;
529 #endif
530 {
531    TRC3(KwUiKwuDiscSduCfm)
532
533    /* jump to specific primitive depending on configured selector */
534    (*kwUiKwuDiscSduCfmMt[pst->selector])(pst, suId, discCfm);
535
536    RETVALUE(ROK);
537
538 } /* end of KwUiKwuDiscSduCfm */ 
539
540 /**
541  *
542  * @brief 
543  *
544  *        Handler for sending Flow indication to the upper layer. 
545  *
546  * @b Description:
547  *       
548  *       This function indicates to PDCP if packets need to be stopped or
549  *       started for a particular RB
550  *
551  *  @param[in] pst                Post structure  
552  *  @param[in] suId               Service User SAP ID 
553  *  @param[in] flowCntrlIndInfo   Flow control information.
554  *
555  *  @return  S16
556  *      -# ROK 
557  *      -# RFAILED
558  */
559 #ifdef ANSI
560 PUBLIC S16 KwUiKwuFlowCntrlInd
561 (
562 Pst                   *pst,
563 SuId                  suId,
564 KwuFlowCntrlIndInfo   *flowCntrlIndInfo
565 )
566 #else
567 PUBLIC S16 KwUiKwuFlowCntrlInd(pst, suId, flowCntrlIndInfo)
568 Pst                   *pst;
569 SuId                  suId;
570 KwuFlowCntrlIndInfo   *flowCntrlIndInfo;
571 #endif
572 {
573    TRC3(KwUiKwuFlowCntrlInd)
574
575    /* jump to specific primitive depending on configured selector */
576    (*kwUiKwuFlowCntrlIndMt[pst->selector])(pst, suId, flowCntrlIndInfo);
577
578    RETVALUE(ROK);
579
580 } /* end of KwUiKwuFlowCntrlInd */ 
581 #ifdef LTE_L2_MEAS
582 \f
583 /**
584  *
585  * @brief 
586  *
587  *        Handler for sending the Data ack indication  to the upper layer. 
588  *
589  * @b Description:
590  *       
591  *       This function confirms the succesfull transmission of SDU
592  *
593  *  @param[in] pst         Post structure  
594  *  @param[in] suId        Service User SAP ID 
595  *  @param[in] datAckInd   DatAckInd
596  *
597  *  @return  S16
598  *      -# ROK 
599  *      -# RFAILED
600  */
601 #ifdef ANSI
602 PUBLIC S16 KwUiKwuDatAckInd
603 (
604 Pst               *pst,
605 SuId              suId,
606 KwuDatAckInfo     *datAckInd
607 )
608 #else
609 PUBLIC S16 KwUiKwuDatAckInd(pst, suId, datAckInd)
610 Pst               *pst;
611 SuId              suId;
612 KwuDatAckInfo     *datAckInd;
613 #endif
614 {
615    TRC3(KwUiKwuDatAckInd)
616
617    /* jump to specific primitive depending on configured selector */
618    (*kwUiKwuDatAckIndMt[pst->selector])(pst, suId, datAckInd);
619
620    RETVALUE(ROK);
621
622 } /* end of KwUiKwuDatAckInd */ 
623 #endif /* LTE_L2_MEAS */
624 #endif /* KW_PDCP */
625
626
627 \f  
628 /*********************************************************************
629  *             Primitives for CKW interface 
630  ********************************************************************/
631
632 /* CKW Bind Confirm primitive */
633
634 PUBLIC CkwBndCfm kwUiCkwBndCfmMt[] =
635 {
636 #ifdef LCKWUICKW
637    cmPkCkwBndCfm,            /* 0 - loosely coupled */
638 #endif /* LCCKUICKW */
639 #ifdef NH
640    NhLiCkwBndCfm,            /* 1 - tightly coupled, RRC  */
641 #endif /* NH */
642 };
643
644 /* CKW Configuration confirm primitive */
645
646 PUBLIC CkwCfgCfm kwUiCkwCfgCfmMt[] =
647 {
648 #ifdef LCKWUICKW
649    cmPkCkwCfgCfm,            /* 0 - loosely coupled */
650 #endif /* LCKWUICKW */
651 #ifdef NH
652    NhLiCkwCfgCfm,            /* 1 - tightly coupled, RRC  */
653 #endif /* NH */
654 };
655
656 PUBLIC CkwUeIdChgCfm kwUiCkwUeIdChgCfmMt[] =
657 {
658 #ifdef LCKWUICKW
659    cmPkCkwUeIdChgCfm,            /* 0 - loosely coupled */
660 #endif /* LCKWUICKW */
661 #ifdef NH
662    NhLiCkwUeIdChgCfm,            /* 1 - tightly coupled, RRC  */
663 #endif /* NH */
664 };
665
666
667 \f  
668 /****************************************************************************
669  *                         CKW Interface Mt functions
670  ***************************************************************************/
671 /**
672  *
673  * @brief 
674  *
675  *        Handler for confirming  the bind request received from CKW
676  *        interface.
677  *
678  * @b Description:
679  *
680  *        This function send the bind confirm primitive to the RLC user,
681  *        when it receives a bind request from its service user.
682  *
683  *  @param[in] pst      - Post structure  
684  *  @param[in] suId     - Service user SAP ID 
685  *  @param[in] status   - Status
686  *
687  *  @return  S16
688  *      -# ROK 
689  */
690 #ifdef ANSI
691 PUBLIC S16 KwUiCkwBndCfm
692 (
693 Pst *pst,                       /* post structure */
694 SuId suId,                      /* Service User Id */
695 U8   status                     /* Status */
696 )
697 #else
698 PUBLIC S16 KwUiCkwBndCfm(pst, suId, status)
699 Pst *pst;                       /* post structure */
700 SuId suId;                      /* Service User Id */
701 U8   status;                    /* Status */
702 #endif
703 {
704    TRC3(KwUiCkwBndCfm)
705
706    /* jump to specific primitive depending on configured selector */
707    (*kwUiCkwBndCfmMt[pst->selector])(pst, suId, status);
708
709    RETVALUE(ROK);
710
711 } /* end of KwUiCkwBndCfm */
712
713 \f
714 /**
715  *
716  * @brief 
717  *
718  *        Handler for sending a configuration confirm to RRC.
719  *
720  * @b Description:
721  *
722  *        This function is used by RLC user to send a configuration
723  *        confirmation to RRC after configuring(add/delete/modify)
724  *        the RLC entities. 
725  *
726  *  @param[in] pst      Post structure  
727  *  @param[in] transId  Transaction Id 
728  *  @param[in] cfmInfo  Config Confirmation Info 
729  *
730  *  @return  S16
731  *      -# ROK 
732  *
733  */
734 #ifdef ANSI
735 PUBLIC S16 KwUiCkwCfgCfm
736 (
737 Pst            *pst,                      /* post structure */
738 SuId           suId,                      /* Service User Id */
739 CkwCfgCfmInfo  *cfmInfo                    /* Configuration Confirm */
740 )
741 #else
742 PUBLIC S16 KwUiCkwCfgCfm(pst, suId, cfmInfo)
743 Pst            *pst;                      /* post structure */
744 SuId           suId;                      /* Service User Id */
745 CkwCfgCfmInfo  *cfmInfo;                   /* Configuration Confirm */
746 #endif
747 {
748    TRC3(KwUiCkwCfgCfm)
749
750    /* jump to specific primitive depending on configured selector */
751    (*kwUiCkwCfgCfmMt[pst->selector])(pst, suId, cfmInfo);
752
753    RETVALUE(ROK);
754
755 } /* end of KwUiCkwCfgCfm */
756
757 \f
758 /**
759  *
760  * @brief 
761  *
762  *        Handler for sending a configuration for UE ID change.
763  *
764  * @b Description:
765  *
766  *        This function is used by RLC to send a configuration
767  *        confirm for UE ID change.
768  *
769  *  @param[in] pst      Post structure  
770  *  @param[in] suId     Service User Id
771  *  @param[in] transId  Transaction Id 
772  *  @param[in] cfmInfo  Config Confirmation Info 
773  *
774  *  @return  S16
775  *      -# ROK 
776  *
777  */
778 #ifdef ANSI
779 PUBLIC S16 KwUiCkwUeIdChgCfm 
780 (
781 Pst            *pst,                      /* post structure */
782 SuId           suId,                      /* Service User Id */
783 U32            transId,
784 CkwUeInfo      *ueInfo,
785 CmStatus       status
786 )
787 #else
788 PUBLIC S16 KwUiCkwUeIdChgCfm(pst, suId, transId,ueInfo,status)
789 Pst            *pst;                      /* post structure */
790 SuId           suId;                      /* Service User Id */
791 U32            transId;
792 CkwUeInfo      *ueInfo;
793 CmStatus       status;
794 #endif
795 {
796    TRC3(KwUiCkwUeIdChgCfm)
797
798    /* jump to specific primitive depending on configured selector */
799    (*kwUiCkwUeIdChgCfmMt[pst->selector])(pst, suId, transId, ueInfo, status);
800
801    RETVALUE(ROK);
802
803 } /* end of KwUiCkwCfgCfm */
804
805
806 #if (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF))
807 /**
808  *
809  * @brief 
810  *
811  *        kwDlBatchProcSplit- process rbug messages
812  *
813  *  @return  S16
814  *      -# ROK 
815  */
816 #ifdef ANSI
817 PUBLIC S16 kwDlBatchProcSplit 
818 (
819 Void
820 )
821 #else
822 PUBLIC S16 kwDlBatchProcSplit()
823 Void;
824 #endif
825 {
826
827 /* Read from Ring Buffer and process PDCP packets */
828    Void *elmIndx = NULLP;
829    RxmBufReq *datReq = NULLP;
830 #ifdef LTE_ADV
831    U32 dlPktCount = 0;
832 #endif
833    U8 rngBufDeqIndx = 0;
834    U32 rngBufDeqMaxCnt;
835    U32 rngBufCurrCnt;
836
837    rngBufDeqMaxCnt = SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT;
838 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
839    rngBufCurrCnt = SGetNumElemInRng(SS_RNG_BUF_RX_TO_DLRLC);
840    if ( rngBufCurrCnt > (3 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
841    {
842       if ( rngBufCurrCnt > (6 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
843       {
844          /* Restablishment scenario */
845          rngBufDeqMaxCnt = (4 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT);
846       }
847       else
848       {
849          rngBufDeqMaxCnt = (3 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT)/2;
850       }
851    }
852 #endif
853    elmIndx = SRngGetRIndx(SS_RNG_BUF_RX_TO_DLRLC);
854    while(NULLP != elmIndx)
855    {
856       datReq = (RxmBufReq *)elmIndx;
857       if(datReq->mBuf != NULLP)
858       {
859         cmUnpkKwuDatReq(KwUiKwuDatReq, &datReq->pst, datReq->mBuf);
860       }
861       else
862       {
863          RLOG0(L_ERROR, "mBuf is NULL");
864          if(datReq->mBuf)
865           cmUnpkKwuDatReq(KwUiKwuDatReq, &datReq->pst, datReq->mBuf);
866
867       }
868       SsRngInfoTbl[SS_RNG_BUF_RX_TO_DLRLC].nPktProc++;//Number of pkt processed in tti
869       datReq->mBuf = NULLP;
870       SRngIncrRIndx(SS_RNG_BUF_RX_TO_DLRLC);
871       rngBufDeqIndx++;
872       if(rngBufDeqIndx >= rngBufDeqMaxCnt)
873       {
874          break;
875       }
876 #ifdef LTE_ADV
877       {
878         dlPktCount++;
879         if(dlPktCount > 75)
880         {
881            break;
882         }
883       }
884 #endif
885       if((elmIndx = SRngGetRIndx(SS_RNG_BUF_RX_TO_DLRLC)) == NULLP)
886       {
887          break;
888       }
889    }
890
891    RETVALUE(ROK);
892 }
893 #endif
894
895 #if defined(PDCP_RLC_DL_RBUF) || defined(SS_RBUF)
896 #ifdef ANSI
897 PUBLIC S16 kwDlBatchProc
898 (
899 Void
900 )
901 #else
902 PUBLIC S16 kwDlBatchProc()
903 Void;
904 #endif
905 {
906 /* Read from Ring Buffer and process PDCP packets */
907
908    U8 rngBufDeqIndx = 0;
909    U32 rngBufDeqMaxCnt;
910 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
911    U32 rngBufCurrCnt;
912 #endif
913    /* Memory regions different for BRCM and Intel */
914    /*dstProcId,srcProcId,dstEnt,dstInst,srcEnt,srcInst,prior,route,event,region,pool,selector*/
915 #ifdef SS_RBUF
916    PRIVATE Pst rlcDlRbfuPst ={1,1,ENTKW,1,ENTPJ,1,PRIOR0,RTESPEC,KWU_EVT_DAT_REQ,1,1,0,0};
917 #else
918    PRIVATE Pst rlcDlRbfuPst ={1,1,ENTKW,1,ENTPJ,1,PRIOR0,RTESPEC,KWU_EVT_DAT_REQ,2,1,0,0};
919 #endif
920    Void *elmIndx = NULLP;
921    KwuDatReqDetl *kwuDatReqDetl = NULLP;
922    KwuDatReqInfo datReq;
923
924    rngBufDeqMaxCnt = SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT;
925 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
926    rngBufCurrCnt = SGetNumElemInRng(SS_RNG_BUF_DLPDCP_TO_DLRLC);
927    if ( rngBufCurrCnt > (3 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
928    {
929       if ( rngBufCurrCnt > (5 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
930       {
931          /* Restablishment scenario */
932          rngBufDeqMaxCnt = (4 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT);
933       }
934       else
935       {
936          rngBufDeqMaxCnt = (2 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT);
937       }
938    }
939 #endif
940    elmIndx = SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
941    while(NULLP != elmIndx)
942    {
943       kwuDatReqDetl = (KwuDatReqDetl *)elmIndx;
944       datReq.rlcId = kwuDatReqDetl->rlcId;
945       datReq.sduId = kwuDatReqDetl->sduId;
946       datReq.lcType = kwuDatReqDetl->lcType;
947       SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].nPktProc++;;//Number of pkt processed in tti
948       if(kwuDatReqDetl->mBuf != NULLP)
949       {
950          KwUiKwuDatReq(&rlcDlRbfuPst, kwuDatReqDetl->spId, &datReq, kwuDatReqDetl->mBuf);
951       }
952       SRngIncrRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
953       rngBufDeqIndx++;
954
955       if(rngBufDeqIndx >= rngBufDeqMaxCnt)
956       {
957          break;
958       }
959       elmIndx = (Void *)SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
960    }
961
962    RETVALUE(ROK);
963 }
964
965
966 #ifdef ANSI
967 PUBLIC S16 kwUtlDlBatchProcPkts
968 (
969 Void
970 )
971 #else
972 PUBLIC S16 kwUtlDlBatchProcPkts
973 Void;
974 #endif
975 {
976     kwDlBatchProc();
977 #ifdef SS_RBUF
978 #ifdef LTE_L2_MEAS
979     kwUtlDlBatchProcHqStaInd();
980 #endif
981     kwUtlFreeDlMem();
982 #endif
983     RETVALUE(ROK);
984 }   
985
986
987 #ifdef ANSI
988 PUBLIC S16 kwUtlDlFreeRlcRBuf
989 (
990 Void
991 )
992 #else
993 PUBLIC S16 kwUtlDlFreeRlcRBuf
994 Void;
995 #endif
996 {
997 /* Read from Ring Buffer and process PDCP packets */
998    Void *elmIndx = NULLP;
999    KwuDatReqDetl *kwuDatReqDetl = NULLP;
1000    /* Free SS_RNG_BUF_DLPDCP_TO_DLRLC  */
1001    elmIndx = SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
1002    while(NULLP != elmIndx)
1003    {
1004       kwuDatReqDetl = (KwuDatReqDetl *)elmIndx;
1005       SRngIncrRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
1006       SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].nPktProc++;
1007       SPutMsg(kwuDatReqDetl->mBuf);
1008       elmIndx = NULLP;
1009       kwuDatReqDetl = NULLP;
1010       if((elmIndx = SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC)) == NULLP)
1011       break;
1012    }
1013    RETVALUE(ROK);
1014 }
1015
1016
1017 #endif 
1018 #ifdef __cplusplus
1019 }
1020 #endif /* __cplusplus */
1021 /********************************************************************30**
1022          End of file
1023 **********************************************************************/