1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
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 #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
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 *******************************************************************************/
19 /********************************************************************20**
21 Name: NR RLC Layer - Lower Interface
25 Desc: C source code for the lower interface of NR RLC
29 *********************************************************************21*/
31 /** @file rlc_portable_functions.c
32 @brief RLC Lower Interface
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 */
43 #include "cpj.h" /* CPJ defines */
44 #include "pju.h" /* PJU defines */
45 #include "lpj.h" /* LPJ defines */
48 #include "rlc_env.h" /* RLC environment options */
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 */
56 #include "cpj.x" /* CPJ defines */
57 #include "pju.x" /* PJU defines */
58 #include "lpj.x" /* LPJ defines */
61 #include "rlc_utils.h" /* RLC defines */
63 #if defined(MAC_RLC_UL_RBUF) || (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF)) || defined(SS_RBUF)
70 #if defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF)
71 #include "mt_plat_t33.h"
72 #include "mt_plat_t33.x"
85 #endif /* __cplusplus */
88 #define MAXKWMI 2 /* max. layer management interfaces */
90 #ifdef RLC_MAC_DAT_REQ_RBUF
91 S16 rlcLiRguDatReqRbuf(Pst *Post,SpId spId,Void *datReq);
94 #ifdef RLC_MAC_STA_RSP_RBUF
95 S16 rlcLiRguStaRspRbuf(Pst *Post,SpId spId,Void *staRsp);
97 #if defined(MAC_RLC_HARQ_STA_RBUF) && defined(LTE_L2_MEAS)
98 S16 RlcDlHarqStaBatchProc (Void);
102 /*********************************************************************
103 * Primitives for RGU interface
104 ********************************************************************/
106 /* RGU Bind Request primitive */
108 RguBndReq kwLiRguBndReqMt[] =
111 cmPkRguBndReq, /* 0 - loosely coupled */
112 #endif /* LCRGUIRGU */
114 RgUiRguBndReq, /* 1 - tightly coupled, MAC */
117 cmPkRguBndReq, /* 0 - loosely coupled */
118 #endif /* LCRGUIRGU */
121 /* RGU Unbind Request primitive */
123 RguBndReq kwLiRguUbndReqMt[] =
126 cmPkRguUbndReq, /* 0 - loosely coupled */
127 #endif /* LCRGUIRGU */
129 RgUiRguUbndReq, /* 1 - tightly coupled, MAC */
132 cmPkRguUbndReq, /* 0 - loosely coupled */
133 #endif /* LCRGUIRGU */
136 /* kw005.201 added support for L2 Measurement */
139 /* RGU L2 Measurement Ul Ip Throughput Measurement Request primitive */
141 RguL2MUlThrpMeasReq kwLiRguL2MUlThrpMeasReqMt[] =
144 cmPkRguL2MUlThrpMeasReq, /* 0 - loosely coupled */
145 #endif /* LCRGUIRGU */
147 RgUiRguL2MUlThrpMeasReq, /* 1 - tightly coupled, MAC */
150 #endif /* LTE_RLC_R9 */
151 #endif /* LTE_L2_MEAS */
153 /*********************************************************************
154 * Primitives for LKW interface
155 ********************************************************************/
156 /* Configuration confirmation primitive */
158 static RlcConfigCfm rlcMiRlcConfigCfmMt[MAXKWMI] =
161 packRlcConfigCfm, /* 0 - loosely coupled - fc */
162 #endif /* LCRLMILKW */
164 SmMiRlcConfigCfm, /* 1 - tightly coupled layer management*/
168 /* control confirmation primitives */
170 static LkwCntrlCfm kwMiLkwCntrlCfmMt[MAXKWMI] =
173 cmPkLkwCntrlCfm, /* 0 - loosely coupled - fc */
174 #endif /* LCRLMILKW */
176 SmMiLkwCntrlCfm, /* 1 - tightly coupled layer management*/
180 /* Status Indication primitive */
182 static LkwStaInd kwMiLkwStaIndMt[MAXKWMI] =
185 cmPkLkwStaInd, /* 0 - loosely coupled */
186 #endif /* LCKWMILKW */
188 SmMiLkwStaInd, /* 1 - tightly coupled, layer management */
192 /* Status confirm primitive */
194 static LkwStaCfm kwMiLkwStaCfmMt[MAXKWMI] =
197 cmPkLkwStaCfm, /* 0 - loosely coupled */
198 #endif /* LCKWMILKW */
200 SmMiLkwStaCfm, /* 1 - tightly coupled, layer management */
204 /* Statistics confirm primitive */
206 static LkwStsCfm kwMiLkwStsCfmMt[MAXKWMI] =
209 cmPkLkwStsCfm, /* 0 - loosely coupled */
210 #endif /* LCRLMILKW */
212 SmMiLkwStsCfm, /* 1 - tightly coupled, layer management */
216 /* Trace indication primitive */
218 static LkwTrcInd kwMiLkwTrcIndMt[MAXKWMI] =
221 cmPkLkwTrcInd, /* 0 - loosely coupled */
222 #endif /* LCKWMILKW */
224 SmMiLkwTrcInd, /* 1 - tightly coupled, layer management */
228 /* kw005.201 added support for L2 Measurement */
230 static const LkwL2MeasCfm rlcMiLkwL2MeasCfmMt[] =
239 static const LkwL2MeasStopCfm RlcMiLkwL2MeasStopCfmMt[] =
242 cmPkLkwL2MeasStopCfm,
245 SmMiLkwL2MeasStopCfm,
248 #endif /* LTE_L2_MEAS */
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));
259 S16 rlcUtlDlBatchProcPkts ARGS((Void));
262 #if (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF))
263 S16 rlcDlBatchProcSplit ARGS((Void));
267 /*********************************************************************
268 * Primitives for KWU interface
269 ********************************************************************/
271 /* KWU Bind Confirm primitive */
273 KwuBndCfm kwUiKwuBndCfmMt[] =
276 cmPkKwuBndCfm, /* 0 - loosely coupled */
277 #endif /* LCKWUIKWU */
279 NhLiKwuBndCfm, /* 1 - tightly coupled, RRC */
283 PjLiKwuBndCfm, /* 2 - tightly coupled, PDCP */
288 cmPkKwuBndCfm, /* 3 - light weight loosely coupled */
289 #endif /* LCKWUIKWU */
293 /* KWU Data Indication primitive */
295 KwuDatInd kwUiKwuDatIndMt[] =
298 cmPkKwuDatInd, /* 0 - loosely coupled */
299 #endif /* LCKWUIKWU */
301 NhLiKwuDatInd, /* 1 - tightly coupled, RRC */
306 PjLiKwuDatInd, /* 2 - tightly coupled, PDCP */
310 cmPkKwuDatInd, /* 3 - light weight loosely coupled */
311 #endif /* LCKWUIKWU */
317 KwuDatCfm kwUiKwuDatCfmMt[] =
320 cmPkKwuDatCfm, /* 0 - loosely coupled */
321 #endif /* LCKWUIKWU */
323 PjLiKwuDatCfm, /* 2 - tightly coupled, PDCP */
327 cmPkKwuDatCfm, /* 3 - light weight loosely coupled */
328 #endif /* LCKWUIKWU */
332 /* KWU AM Status Indication primitive */
334 KwuStaInd kwUiKwuStaIndMt[] =
337 cmPkKwuStaInd, /* 0 - loosely coupled */
338 #endif /* LCKWUIKWU */
340 PjLiKwuStaInd, /* 2 - tightly coupled, PDCP */
344 cmPkKwuStaInd, /* 3 - light weight loosely coupled */
345 #endif /* LCKWUIKWU */
349 KwuReEstCmpInd kwUiKwuReEstCmpIndMt[] =
352 cmPkKwuReEstCmpInd, /* 0 - loosely coupled */
353 #endif /* LCKWUIKWU */
355 PjLiKwuReEstCmpInd, /* 2 - tightly coupled, PDCP */
360 cmPkKwuReEstCmpInd, /* 3 - light weight loosely coupled */
361 #endif /* LCKWUIKWU */
365 /* kw005.201 added support for L2 measurement */
366 KwuDiscSduCfm kwUiKwuDiscSduCfmMt[] =
369 cmPkKwuDiscSduCfm, /* 0 - loosely coupled */
370 #endif /* LCKWUIKWU */
372 PjLiKwuDiscSduCfm, /* 2 - tightly coupled, PDCP */
376 cmPkKwuDiscSduCfm, /* 3 - light weight loosely coupled */
380 KwuFlowCntrlInd kwUiKwuFlowCntrlIndMt[] =
383 cmPkKwuFlowCntrlInd, /* 0 - loosely coupled */
384 #endif /* LCKWUIKWU */
386 PjLiKwuFlowCntrlInd, /* 2 - tightly coupled, PDCP */
389 cmPkKwuFlowCntrlInd, /* 3 - light weight loosely coupled */
390 #endif /* LCKWUIKWU */
393 KwuDatAckInd kwUiKwuDatAckIndMt[] =
396 cmPkKwuDatAckInd, /* 0 - loosely coupled */
397 #endif /* LCKWUIKWU */
399 PjLiKwuDatAckInd, /* 2 - tightly coupled, PDCP */
403 cmPkKwuDatAckInd, /* 3 - light weight loosely coupled, portable */
407 #endif /* LTE_L2_MEAS */
408 /* KWU AM Data confirm primitive */
412 /****************************************************************************
413 * LKW Interface Mt functions
414 ***************************************************************************/
417 This function is called by the RlcMiRlcConfigReq function for responding
418 to configuration requests.The cfm field in the RlcMngmt structure contains
421 - This function calls the mapping matrix for sending the configuration
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.
431 S16 RlcMiRlcConfigCfm
433 Pst *pst, /* post structure */
434 RlcMngmt *cfm /* Layer Management structure */
438 /* jump to specific primitive depending on configured selector */
439 (*rlcMiRlcConfigCfmMt[pst->selector])(pst, cfm);
447 This function is called by the RlcMiLkwCntrlReq function to send a control confirm to the layer management module.
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.
460 Pst *pst, /* post structure */
461 RlcMngmt *cfm /* configure */
465 /* jump to specific primitive depending on configured selector */
466 (*kwMiLkwCntrlCfmMt[pst->selector])(pst, cfm);
470 } /* end of RlcMiLkwCntrlCfm */
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.
479 - This function calls the mapping matrix for sending the unsolicited status
480 indication.The actual function called depends on the coupling of the
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.
487 - For a tightly coupled interface, the actual function called depends on
488 the layer manager API provided.
492 Pst *pst, /* post structure */
493 RlcMngmt *usta /* unsolicited status */
496 /* jump to specific primitive depending on configured selector */
497 (*kwMiLkwStaIndMt[pst->selector])(pst, usta);
500 } /* end of RlcMiLkwStaInd */
505 - This function is called by the RlcMiLkwStaReq function to send
506 the requested status information to the layer manager.
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.
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.
516 - For a tightly coupled interface, the actual function called depends
517 on the layer manager API provided.
522 Pst *pst, /* post structure */
523 RlcMngmt *cfm /* solicited status confirmation */
527 /* jump to specific primitive depending on configured selector */
528 (*kwMiLkwStaCfmMt[pst->selector])(pst, cfm);
532 } /* end of RlcMiLkwStaCfm */
537 - This function is called by the RlcMiLkwStsReq function for responding
538 to statistics requests.
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.
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.
548 - For a tightly coupled interface, the actual function called depends
549 on the layer manager API provided.
554 Pst *pst, /* post structure */
555 Action action, /* action */
556 RlcMngmt *cfm /* statistics confirmation */
559 /* jump to specific primitive depending on configured selector */
560 (*kwMiLkwStsCfmMt[pst->selector])(pst, action, cfm);
564 } /* end of RlcMiLkwStsCfm */
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.
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.
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.
579 - For a tightly coupled interface, the actual function called depends on
580 the layer manager API provided.
585 Pst *pst, /* post structure */
586 RlcMngmt *trc, /* trace indication */
587 Buffer *mBuf /* message buffer */
590 /* jump to specific primitive depending on configured selector */
591 (*kwMiLkwTrcIndMt[pst->selector])(pst, trc, mBuf);
595 } /* end of RlcMiLkwTrcInd */
598 /* kw005.201 added support for L2 Measurement */
600 S16 RlcMiLkwL2MeasCfm(Pst * pst,RlcL2MeasCfmEvt *measEvt)
603 (*rlcMiLkwL2MeasCfmMt[pst->selector])(pst, measEvt);
608 S16 RlcMiLkwL2MeasStopCfm(Pst *pst,uint8_t measType,uint8_t status)
611 (*RlcMiLkwL2MeasStopCfmMt[pst->selector])(pst, measType,status);
616 #endif /* LTE_L2_MEAS */
619 /****************************************************************************
620 * RGU Interface Mt functions
621 ***************************************************************************/
626 * Handler for RGU SAP bind Request.
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).
635 * @param[in] pst Post structure
636 * @param[in] suId Service user SAP ID
637 * @param[in] spId Service provider ID
645 Pst *post, /* post structure */
646 SuId suId, /* Service User Id */
647 SpId spId /* Service Provider Id */
651 /* jump to specific primitive depending on configured selector */
652 (*kwLiRguBndReqMt[post->selector])(post, suId, spId);
656 } /* end of RlcLiRguBndReq */
663 * Handler for bind confirmation from MAC.
667 * This function handles the bind confirmation received
670 * @param[in] post - Post structure
671 * @param[in] suId - Service provider SAP ID
672 * @param[in] reason - Reason of confirmation
678 S16 RlcLiRguUbndReq(Pst *post,SpId spId,Reason reason)
681 /* jump to specific primitive depending on configured selector */
682 (*kwLiRguUbndReqMt[post->selector])(post, spId, reason);
686 } /* end of RlcLiRguUbndReq */
688 /* kw005.201 added support for L2 Measurement */
696 * Handler for sending ulThrpMeasReqInfo from RLC to MAC for UL ip throughput measurement.
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.
704 * @param[in] post Post structure
705 * @param[in] spId Service Provider ID
706 * @param[in] ulThrpMeasReqInfo Ul ip measurement request info
713 S16 RlcLiRguL2MUlThrpMeasReq(Pst *post,SpId spId,RguL2MUlThrpMeasReqInfo *l2mUlThrpMeasReq)
716 /* jump to specific primitive depending on configured selector */
717 (*kwLiRguL2MUlThrpMeasReqMt[post->selector])(post, spId, l2mUlThrpMeasReq);
721 } /* end of RlcLiRguL2MUlThrpMeasReq */
723 #endif /* LTE_RLC_R9 */
724 #endif /* LTE_L2_MEAS */
727 #ifdef MAC_RLC_UL_RBUF
728 S16 rlcUlBatchProc ARGS ((Void));
729 Void rlcUtlFreeUlRBuf ARGS((void));
731 S16 rlcUlBatchProc(Void)
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 */
740 RguDedDatInd1 *rguDatInd = NULLP;
741 uint8_t rngBufDeqIndx = 0;
743 elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
744 while(NULLP != elmIndx)
746 rguDatInd = (RguDedDatInd1 *)elmIndx;
747 datInd = (RguDDatIndInfo*) rguDatInd->msg;
748 SsRngInfoTbl[SS_RNG_BUF_ULMAC_TO_ULRLC].nPktProc++;//Number of pkt processed in tti
751 RlcProcDedLcUlData(&rlcUlRbfuPst, 0, datInd);
755 DU_LOG("\nERROR --> RLC UL : Received NULL buffer");
757 rguDatInd->msg=NULLP;
758 SRngIncrRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
764 //if(rngBufDeqIndx >= SS_RNG_MAX_ULMAC_TO_ULRLC_DQ_CNT)
767 if((elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC)) == NULLP)
771 elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
772 while(NULLP != elmIndx)
774 datInd = (RguDDatIndInfo *)elmIndx;
775 RlcProcDedLcUlData(&rlcUlRbfuPst, 0, datInd);
779 SRngIncrRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
781 if((elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC)) == NULLP)
792 * Handler to clear Ring buffer from UL RLC
795 * This function clears all the ring buffer content from UL RLC
802 Void rlcUtlFreeUlRBuf(void)
804 RguDDatIndInfo *datInd;
809 /* Free SS_RNG_BUF_ULMAC_TO_ULRLC */
810 while((SDeqSRngBuf (SS_RNG_BUF_ULMAC_TO_ULRLC, &elem) == ROK))
812 datInd = (RguDDatIndInfo *)elem;
813 for(numLch = 0; numLch< datInd->numLch; numLch++)
815 for(numPdu = 0; numPdu < datInd->lchData[numLch].pdu.numPdu; numPdu++)
817 if(datInd->lchData[numLch].pdu.mBuf[numPdu])
819 ODU_PUT_MSG_BUF(datInd->lchData[numLch].pdu.mBuf[numPdu]);
823 RLC_PST_FREE(0, 0, datInd, sizeof(RguDDatIndInfo));
827 #ifdef RLC_MAC_STA_RSP_RBUF
828 S16 rlcLiRguStaRspRbuf(Pst *post,SpId spId,Void *staRsp)
834 RguDStaRspInfo *staRspInfo = NULL;
835 elem = SRngGetWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
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++;
846 DU_LOG("\nERROR --> RLC_DL : RLC DL STA RSP RBUF is FULL!!! ");
847 SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC].pktDrop++;
851 } /* cmPkRlcDatReq */
854 #ifdef RLC_MAC_DAT_REQ_RBUF
855 S16 rlcLiRguDatReqRbuf(Pst *post,SpId spId,Void *datReq)
860 RguInfoRingElem *datReqRing=NULLP;
861 elem = SRngGetWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ);
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++;
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++;
878 } /* cmPkRlcDatReq */
882 /****************************************************************************
883 * KWU Interface Mt functions
884 ***************************************************************************/
\f
889 * Handler for confirming the bind request received from KWU
894 * This function send the bind confirm primitive to the RLC user,
895 * when it receives a bind request from its service user.
897 * @param[in] pst Post structure
898 * @param[in] suId Service user SAP ID
899 * @param[in] status Status of Confirmation
907 Pst *pst, /* post structure */
908 SuId suId, /* Service User Id */
909 uint8_t status /* Status */
913 /* jump to specific primitive depending on configured selector */
914 (*kwUiKwuBndCfmMt[pst->selector])(pst, suId, status);
918 } /* end of RlcUiKwuBndCfm */
925 * Handler for sending the data(SDU) from upper layer.
929 * This function is used to transfer a SDU received from the peer
930 * RLC entity to the service user(RRC/PDCP).
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)
941 S16 rlcSendUlDataToDu
944 KwuDatIndInfo *datInd,
949 /* jump to specific primitive depending on configured selector */
950 (*kwUiKwuDatIndMt[pst->selector])(pst, datInd, mBuf);
954 } /* end of rlcSendUlDataToDu */
956 int rlcDatCfmsSent = 0;
963 * Handler for sending the data confirmation to upper layer.
967 * This function is used to send a confirmation to the service
968 * user about the data received by the peer RLC entity.
970 * @param[in] pst Post structure
971 * @param[in] suId Service User SAP ID
972 * @param[in] datCfmInfo Data Confirmation Information
982 KwuDatCfmInfo *datCfm
987 /* jump to specific primitive depending on configured selector */
988 (*kwUiKwuDatCfmMt[pst->selector])(pst, suId, datCfm);
992 } /* end of RlcUiKwuDatCfm */
999 * Handler for sending the Status Indication to the upper layer.
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.
1007 * @param[in] pst Post structure
1008 * @param[in] suId Service User SAP ID
1009 * @param[in] staInd RLC Entity Id
1019 KwuStaIndInfo *staInd
1023 /* jump to specific primitive depending on configured selector */
1024 (*kwUiKwuStaIndMt[pst->selector])(pst, suId, staInd);
1028 } /* end of RlcUiKwuStaInd */
1035 * Handler for sending the Status Indication to the upper layer.
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.
1043 * @param[in] pst Post structure
1044 * @param[in] suId Service User SAP ID
1045 * @param[in] staInd RLC Entity Id
1051 S16 RlcUiKwuReEstCmpInd
1058 DU_LOG("\nINFO --> RLC : In RlcUiKwuReEstCmpInd");
1060 /* jump to specific primitive depending on configured selector */
1061 (*kwUiKwuReEstCmpIndMt[pst->selector])(pst, suId, rlcId);
1065 } /* end of RlcUiKwuReEstCmpInd */
1066 /* kw005.201 added support for L2 Measurement */
1072 * Handler for sending the Sdu Disc Cfm to the upper layer.
1076 * This function confirms the discard of an SDU .
1078 * @param[in] pst Post structure
1079 * @param[in] suId Service User SAP ID
1080 * @param[in] discCfm Disc information.
1086 S16 RlcUiKwuDiscSduCfm
1090 KwuDiscSduInfo *discCfm
1094 /* jump to specific primitive depending on configured selector */
1095 (*kwUiKwuDiscSduCfmMt[pst->selector])(pst, suId, discCfm);
1099 } /* end of RlcUiKwuDiscSduCfm */
1105 * Handler for sending Flow indication to the upper layer.
1109 * This function indicates to PDCP if packets need to be stopped or
1110 * started for a particular RB
1112 * @param[in] pst Post structure
1113 * @param[in] suId Service User SAP ID
1114 * @param[in] flowCntrlIndInfo Flow control information.
1120 S16 RlcUiKwuFlowCntrlInd(Pst *pst,SuId suId,KwuFlowCntrlIndInfo *flowCntrlIndInfo)
1123 /* jump to specific primitive depending on configured selector */
1124 (*kwUiKwuFlowCntrlIndMt[pst->selector])(pst, suId, flowCntrlIndInfo);
1128 } /* end of RlcUiKwuFlowCntrlInd */
1135 * Handler for sending the Data ack indication to the upper layer.
1139 * This function confirms the succesfull transmission of SDU
1141 * @param[in] pst Post structure
1142 * @param[in] suId Service User SAP ID
1143 * @param[in] datAckInd DatAckInd
1149 S16 RlcUiKwuDatAckInd(Pst *pst,SuId suId,KwuDatAckInfo *datAckInd)
1152 /* jump to specific primitive depending on configured selector */
1153 (*kwUiKwuDatAckIndMt[pst->selector])(pst, suId, datAckInd);
1157 } /* end of RlcUiKwuDatAckInd */
1158 #endif /* LTE_L2_MEAS */
1159 #endif /* KW_PDCP */
1163 /*********************************************************************
1164 * Primitives for CKW interface
1165 ********************************************************************/
1167 /* CKW Bind Confirm primitive */
1169 CkwBndCfm kwUiCkwBndCfmMt[] =
1172 cmPkCkwBndCfm, /* 0 - loosely coupled */
1173 #endif /* LCCKUICKW */
1175 NhLiCkwBndCfm, /* 1 - tightly coupled, RRC */
1179 /* CKW Configuration confirm primitive */
1181 RlcCfgCfm kwUiRlcCfgCfmMt[] =
1184 cmPkRlcCfgCfm, /* 0 - loosely coupled */
1185 #endif /* LCKWUICKW */
1187 NhLiRlcCfgCfm, /* 1 - tightly coupled, RRC */
1191 CkwUeIdChgCfm kwUiCkwUeIdChgCfmMt[] =
1194 cmPkCkwUeIdChgCfm, /* 0 - loosely coupled */
1195 #endif /* LCKWUICKW */
1197 NhLiCkwUeIdChgCfm, /* 1 - tightly coupled, RRC */
1203 /****************************************************************************
1204 * CKW Interface Mt functions
1205 ***************************************************************************/
1210 * Handler for confirming the bind request received from CKW
1215 * This function send the bind confirm primitive to the RLC user,
1216 * when it receives a bind request from its service user.
1218 * @param[in] pst - Post structure
1219 * @param[in] suId - Service user SAP ID
1220 * @param[in] status - Status
1227 Pst *pst, /* post structure */
1228 SuId suId, /* Service User Id */
1229 uint8_t status /* Status */
1233 /* jump to specific primitive depending on configured selector */
1234 (*kwUiCkwBndCfmMt[pst->selector])(pst, suId, status);
1238 } /* end of RlcUiCkwBndCfm */
1245 * Handler for sending a configuration confirm to RRC.
1249 * This function is used by RLC user to send a configuration
1250 * confirmation to RRC after configuring(add/delete/modify)
1253 * @param[in] pst Post structure
1254 * @param[in] transId Transaction Id
1255 * @param[in] cfmInfo Config Confirmation Info
1263 Pst *pst, /* post structure */
1264 SuId suId, /* Service User Id */
1265 RlcCfgCfmInfo *cfmInfo /* Configuration Confirm */
1269 /* jump to specific primitive depending on configured selector */
1270 (*kwUiRlcCfgCfmMt[pst->selector])(pst, suId, cfmInfo);
1274 } /* end of RlcUiRlcCfgCfm */
1281 * Handler for sending a configuration for UE ID change.
1285 * This function is used by RLC to send a configuration
1286 * confirm for UE ID change.
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
1297 S16 RlcUiCkwUeIdChgCfm
1299 Pst *pst, /* post structure */
1300 SuId suId, /* Service User Id */
1307 /* jump to specific primitive depending on configured selector */
1308 (*kwUiCkwUeIdChgCfmMt[pst->selector])(pst, suId, transId, ueInfo, status);
1312 } /* end of RlcUiRlcCfgCfm */
1315 #if (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF))
1320 * rlcDlBatchProcSplit- process rbug messages
1325 S16 rlcDlBatchProcSplit(Void)
1328 /* Read from Ring Buffer and process PDCP packets */
1329 Void *elmIndx = NULLP;
1330 RxmBufReq *datReq = NULLP;
1332 uint32_t dlPktCount = 0;
1334 uint8_t rngBufDeqIndx = 0;
1335 uint32_t rngBufDeqMaxCnt;
1336 uint32_t rngBufCurrCnt;
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))
1343 if ( rngBufCurrCnt > (6 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
1345 /* Restablishment scenario */
1346 rngBufDeqMaxCnt = (4 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT);
1350 rngBufDeqMaxCnt = (3 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT)/2;
1354 elmIndx = SRngGetRIndx(SS_RNG_BUF_RX_TO_DLRLC);
1355 while(NULLP != elmIndx)
1357 datReq = (RxmBufReq *)elmIndx;
1358 if(datReq->mBuf != NULLP)
1360 cmUnpkKwuDatReq(rlcProcDlData, &datReq->pst, datReq->mBuf);
1364 DU_LOG("\nERROR --> RLC : mBuf is NULL");
1366 cmUnpkKwuDatReq(rlcProcDlData, &datReq->pst, datReq->mBuf);
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);
1373 if(rngBufDeqIndx >= rngBufDeqMaxCnt)
1386 if((elmIndx = SRngGetRIndx(SS_RNG_BUF_RX_TO_DLRLC)) == NULLP)
1396 #if defined(PDCP_RLC_DL_RBUF) || defined(SS_RBUF)
1397 S16 rlcDlBatchProc(Void)
1399 /* Read from Ring Buffer and process PDCP packets */
1401 uint8_t rngBufDeqIndx = 0;
1402 uint32_t rngBufDeqMaxCnt;
1403 #ifdef TENB_T2K3K_SPECIFIC_CHANGES
1404 uint32_t rngBufCurrCnt;
1406 /* Memory regions different for BRCM and Intel */
1407 /*dstProcId,srcProcId,dstEnt,dstInst,srcEnt,srcInst,prior,route,event,region,pool,selector*/
1409 static Pst rlcDlRbfuPst ={1,1,ENTRLC,1,ENTPJ,1,PRIOR0,RTESPEC,KWU_EVT_DAT_REQ,1,1,0,0};
1411 static Pst rlcDlRbfuPst ={1,1,ENTRLC,1,ENTPJ,1,PRIOR0,RTESPEC,KWU_EVT_DAT_REQ,2,1,0,0};
1413 Void *elmIndx = NULLP;
1414 KwuDatReqDetl *kwuDatReqDetl = NULLP;
1415 RlcDatReqInfo datReq;
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))
1422 if ( rngBufCurrCnt > (5 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT))
1424 /* Restablishment scenario */
1425 rngBufDeqMaxCnt = (4 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT);
1429 rngBufDeqMaxCnt = (2 * SS_RNG_MAX_DLPDCP_TO_DLRLC_DQ_CNT);
1433 elmIndx = SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
1434 while(NULLP != elmIndx)
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)
1443 rlcProcDlData(&rlcDlRbfuPst, kwuDatReqDetl->spId, &datReq, kwuDatReqDetl->mBuf);
1445 SRngIncrRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
1448 if(rngBufDeqIndx >= rngBufDeqMaxCnt)
1452 elmIndx = (Void *)SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
1459 S16 rlcUtlDlBatchProcPkts(Void)
1464 rlcUtlDlBatchProcHqStaInd();
1472 S16 rlcUtlDlFreeRlcRBuf(Void)
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)
1481 kwuDatReqDetl = (KwuDatReqDetl *)elmIndx;
1482 SRngIncrRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
1483 SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].nPktProc++;
1484 SPutMsg(kwuDatReqDetl->mBuf);
1486 kwuDatReqDetl = NULLP;
1487 if((elmIndx = SRngGetRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC)) == NULLP)
1497 #endif /* __cplusplus */
1499 /************************************************************************
1501 **********************************************************************/