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 /**********************************************************************
25 Desc: Source code for RLC Utility Module
26 This file contains following functions
31 --rlcUtlSendDedLcBoStatus
32 --rlcUtlSendUlDataToDu
37 **********************************************************************/
40 @brief RLC Utility Module
43 /* header (.h) include files */
45 #include "common_def.h"
46 /* kw005.201 added support for L2 Measurement */
50 #include "ckw.h" /* CKW defines */
51 #include "kwu.h" /* CKW defines */
52 #include "lkw.h" /* LKW defines */
53 #include "rgu.h" /* RGU defiens */
55 #include "kw_env.h" /* RLC environment options */
56 #include "kw.h" /* RLC defines */
57 #include "kw_err.h" /* Error defines */
61 /* extern (.x) include files */
62 #include "ckw.x" /* CKW includes */
63 #include "kwu.x" /* KWU includes */
64 #include "lkw.x" /* LKW inlcudes */
65 #include "rgu.x" /* RGU includes */
67 #include "kw.x" /* RLC includes */
68 #include "kw_udx.x" /* UDX interface includes */
69 #include "kw_dl.x" /* RLC downlink includes */
71 #include "rlc_utils.h"
72 #include "rlc_mac_inf.h"
73 #include "du_app_rlc_inf.h"
74 #include "rlc_lwr_inf_api.h"
75 #include "rlc_upr_inf_api.h"
82 #if (defined(MAC_RLC_HARQ_STA_RBUF) && defined(LTE_L2_MEAS))
83 uint32_t isDatReqProcessed;
85 #define RLC_MODULE (RLC_DBGMASK_DUT | RLC_DBGMASK_DL) /* for debugging purpose */
86 #if (defined(MAC_RLC_HARQ_STA_RBUF) && defined(LTE_L2_MEAS)) || defined (SS_RBUF)
87 void rlcUtlDlBatchProcHqStaInd ARGS ((Void));
89 Void ResetRLCStats(Void)
91 RlcCb* dlInst = rlcCb[1];
92 RlcCb* ulInst = rlcCb[0];
93 memset(&gRlcStats, 0, sizeof(RLCStats));
94 memset(&dlInst->genSts,0,sizeof(RlcGenSts));
95 memset(&ulInst->genSts,0,sizeof(RlcGenSts));
99 Void PrintRLCStats(Void)
101 RlcCb* dlInst = rlcCb[1];
102 RlcCb* ulInst = rlcCb[0];
104 DU_LOG("\nINFO --> RLC_DL : RLC Stats: PDUs Sent = (%ld), PdusRext = (%ld), TimeOut = (%ld), SduDiscarded = (%ld)",
105 dlInst->genSts.pdusSent,
106 dlInst->genSts.pdusRetx,
107 dlInst->genSts.protTimeOut,
108 dlInst->genSts.numSduDisc);
109 DU_LOG("\nINFO --> RLC_DL : RLC Stats: PDUs Rcvd = (%ld), unexpPdus = (%ld), errorPdus = (%ld)",
110 ulInst->genSts.pdusRecv,
111 ulInst->genSts.unexpPdusRecv,
112 ulInst->genSts.errorPdusRecv);
113 DU_LOG("\nINFO --> RLC_DL : RLC Stats: AMDL: "
114 "StaPduSent:%lu NacksInStaPdu:%lu BytesUnused:%lu PollTimerExpires SRB:%lu ",
115 gRlcStats.amRlcStats.numDLStaPduSent, gRlcStats.amRlcStats.numDLNacksInStaPdu,
116 gRlcStats.amRlcStats.numDLBytesUnused, gRlcStats.amRlcStats.numDLPollTimerExpiresSrb);
117 DU_LOG("\nINFO --> RLC_DL : RLC Stats: AMDL: "
118 "DRB:%lu MaxRetx:%lu RetransPdus:%lu",
119 gRlcStats.amRlcStats.numDLPollTimerExpiresDrb, gRlcStats.amRlcStats.numDLMaxRetx,
120 gRlcStats.amRlcStats.numDLRetransPdus);
121 DU_LOG("\nINFO --> RLC_DL : RLC Stats: AMUL: "
122 " PdusDiscarded:%lu ReAsmblTimerExpires:%lu StaPduRcvd:%lu NackInStaPduRcvd:%lu ",
123 gRlcStats.amRlcStats.numULPdusDiscarded, gRlcStats.amRlcStats.numULReAsmblTimerExpires,
124 gRlcStats.amRlcStats.numULStaPduRcvd, gRlcStats.amRlcStats.numULNackInStaPduRcvd);
126 RTLIN_DUMP_DEBUG("RLC Stats: PDUs Sent = (%ld), PdusRext = (%ld), TimeOut = (%ld), SduDiscarded = (%ld)\n",
127 dlInst->genSts.pdusSent,
128 dlInst->genSts.pdusRetx,
129 dlInst->genSts.protTimeOut,
130 dlInst->genSts.numSduDisc);
131 RTLIN_DUMP_DEBUG("RLC Stats: PDUs Rcvd = (%ld), unexpPdus = (%ld), errorPdus = (%ld)\n",
132 ulInst->genSts.pdusRecv,
133 ulInst->genSts.unexpPdusRecv,
134 ulInst->genSts.errorPdusRecv);
135 RTLIN_DUMP_DEBUG("RLC Stats:"
136 "RLC_AMDL: StaPduSent:%lu NacksInStaPdu:%lu BytesUnused:%lu PollTimerExpires SRB:%lu DRB:%lu MaxRetx:%lu RetransPdus:%lu \n"
137 "RLC_AMUL: PdusDiscarded:%lu ReAsmblTimerExpires:%lu StaPduRcvd:%lu NackInStaPduRcvd:%lu \n",
138 gRlcStats.amRlcStats.numDLStaPduSent, gRlcStats.amRlcStats.numDLNacksInStaPdu, gRlcStats.amRlcStats.numDLBytesUnused,
139 gRlcStats.amRlcStats.numDLPollTimerExpiresSrb, gRlcStats.amRlcStats.numDLPollTimerExpiresDrb, gRlcStats.amRlcStats.numDLMaxRetx,
140 gRlcStats.amRlcStats.numDLRetransPdus, gRlcStats.amRlcStats.numULPdusDiscarded, gRlcStats.amRlcStats.numULReAsmblTimerExpires,
141 gRlcStats.amRlcStats.numULStaPduRcvd, gRlcStats.amRlcStats.numULNackInStaPduRcvd);
144 Void PrintRLCStats(Void)
146 RlcCb* dlInst = rlcCb[1];
147 RlcCb* ulInst = rlcCb[0];
149 DU_LOG ("\n ================================ RLC STATS ===========================\n");
150 DU_LOG("\nINFO --> RLC_DL : RLC Stats: PDUs Sent = (%d), PdusRext = (%d), TimeOut = (%d), SduDiscarded = (%d)",
151 dlInst->genSts.pdusSent,
152 dlInst->genSts.pdusRetx,
153 dlInst->genSts.protTimeOut,
154 dlInst->genSts.numSduDisc);
155 DU_LOG("\nINFO --> RLC_DL : RLC Stats: PDUs Rcvd = (%d), unexpPdus = (%d), errorPdus = (%d)",
156 ulInst->genSts.pdusRecv,
157 ulInst->genSts.unexpPdusRecv,
158 ulInst->genSts.errorPdusRecv);
159 DU_LOG("\nINFO --> RLC_DL : RLC Stats: AMDL: "
160 "StaPduSent:%u NacksInStaPdu:%u BytesUnused:%u PollTimerExpires SRB:%u ",
161 gRlcStats.amRlcStats.numDLStaPduSent, gRlcStats.amRlcStats.numDLNacksInStaPdu,
162 gRlcStats.amRlcStats.numDLBytesUnused, gRlcStats.amRlcStats.numDLPollTimerExpiresSrb);
163 DU_LOG("\nINFO --> RLC_DL : RLC Stats: AMDL: "
164 "DRB:%u MaxRetx:%u RetransPdus:%u",
165 gRlcStats.amRlcStats.numDLPollTimerExpiresDrb, gRlcStats.amRlcStats.numDLMaxRetx,
166 gRlcStats.amRlcStats.numDLRetransPdus);
167 DU_LOG("\nINFO --> RLC_DL : RLC Stats: AMUL: "
168 " PdusDiscarded:%u ReAsmblTimerExpires:%u StaPduRcvd:%u NackInStaPduRcvd:%u ",
169 gRlcStats.amRlcStats.numULPdusDiscarded, gRlcStats.amRlcStats.numULReAsmblTimerExpires,
170 gRlcStats.amRlcStats.numULStaPduRcvd, gRlcStats.amRlcStats.numULNackInStaPduRcvd);
171 /* RTLIN_DUMP_DEBUG("AM RLC Stats:"
172 "RLC_AMDL: SDUs Tx :(%u) SDU Bytes Tx :(%u) SDUs Retx :(%u) MaxRetx:(%u) WindowStalls: (%u) \n"
173 "RLC_AMUL: DropOutWinRx :(%u) SDUs Rx :(%u) SDU Bytes Rx :(%u) SDUNack Rx :(%u) Duplicate Pdu Rx :(%u) \n",
174 gRlcStats.amRlcStats.numRlcAmCellSduTx, gRlcStats.amRlcStats.numRlcAmCellSduBytesTx,
175 gRlcStats.amRlcStats.numRlcAmCellRetxPdu, gRlcStats.amRlcStats.numRlcAmMaxRetx, gRlcStats.amRlcStats.numRlcAmCellWinStall,
176 gRlcStats.amRlcStats.numRlcAmCellDropOutWinRx, gRlcStats.amRlcStats.numRlcAmCellSduRx,
177 gRlcStats.amRlcStats.numRlcAmCellSduBytesRx, gRlcStats.amRlcStats.numRlcAmCellNackRx, gRlcStats.amRlcStats.numRlcAmCellDupPduRx);
179 RTLIN_DUMP_DEBUG("RLC Stats: PDUs Sent = (%d), PdusRext = (%d), TimeOut = (%d), SduDiscarded = (%d)\n",
180 dlInst->genSts.pdusSent,
181 dlInst->genSts.pdusRetx,
182 dlInst->genSts.protTimeOut,
183 dlInst->genSts.numSduDisc);
184 RTLIN_DUMP_DEBUG("RLC Stats: PDUs Rcvd = (%d), unexpPdus = (%d), errorPdus = (%d)\n",
185 ulInst->genSts.pdusRecv,
186 ulInst->genSts.unexpPdusRecv,
187 ulInst->genSts.errorPdusRecv);
188 RTLIN_DUMP_DEBUG("RLC_AMDL: StaPduSent:%u NacksInStaPdu:%u BytesUnused:%u PollTimerExpires SRB:%u DRB:%u MaxRetx:%u RetransPdus:%u \n"
189 " SDUs Tx :(%u) SDU Bytes Tx :(%u) SDUs Retx :(%u) WindowStalls: (%u) \n"
191 "RLC_AMUL: PdusDiscarded:%u ReAsmblTimerExpires:%u StaPduRcvd:%u NackInStaPduRcvd:%u \n"
192 " DropOutWinRx :(%u) SDUs Rx :(%u) SDU Bytes Rx :(%u) SDUNack Rx :(%u) Duplicate Pdu Rx:(%u) \n",
193 gRlcStats.amRlcStats.numDLStaPduSent, gRlcStats.amRlcStats.numDLNacksInStaPdu, gRlcStats.amRlcStats.numDLBytesUnused,
194 gRlcStats.amRlcStats.numDLPollTimerExpiresSrb, gRlcStats.amRlcStats.numDLPollTimerExpiresDrb,
195 gRlcStats.amRlcStats.numDLMaxRetx, gRlcStats.amRlcStats.numDLRetransPdus,
196 gRlcStats.amRlcStats.numRlcAmCellSduTx, gRlcStats.amRlcStats.numRlcAmCellSduBytesTx,
197 gRlcStats.amRlcStats.numRlcAmCellRetxPdu, gRlcStats.amRlcStats.numRlcAmCellWinStall,
198 gRlcStats.amRlcStats.numULPdusDiscarded, gRlcStats.amRlcStats.numULReAsmblTimerExpires,
199 gRlcStats.amRlcStats.numULStaPduRcvd, gRlcStats.amRlcStats.numULNackInStaPduRcvd,
200 gRlcStats.amRlcStats.numRlcAmCellDropOutWinRx, gRlcStats.amRlcStats.numRlcAmCellSduRx,
201 gRlcStats.amRlcStats.numRlcAmCellSduBytesRx, gRlcStats.amRlcStats.numRlcAmCellNackRx, gRlcStats.amRlcStats.numRlcAmCellDupPduRx);
205 /*******************************************************************
208 * Handler for storing all DL PDU Info into RLC-MAC interface
209 * struct and sending to lower interface
212 * This function stores DL PDU info for all logical channels
213 * of per UE grant per TTI and sends to MAC
215 * Function : rlcSendDedLcDlData
218 * @return ROK - success
221 * ****************************************************************/
222 uint8_t rlcSendDedLcDlData(Pst *post, SpId spId, RguDDatReqInfo *datReqInfo)
224 uint8_t ueIdx; /* UE info list iterator */
225 uint8_t tbIdx; /* TB info list iterator */
226 uint8_t lchIdx; /* Lch info list iterator */
227 uint8_t pduIdx; /* RLC PDU list iterator */
228 RguDDatReqPerUe datPerUe; /* DL data info per UE */
229 RguDatReqTb datPerTb; /* DL data info per TB */
230 RguLchDatReq datPerLch; /* DL data info per Lch */
231 RlcData *dlData = NULLP; /* DL data to be sent to MAC */
232 RlcDlRrcMsgRsp *dlRrcMsgRsp = NULLP; /*DL RRC Rsp to be sent to DU*/
233 Pst pst; /* Post structure */
234 uint16_t pduLen; /* PDU length */
235 uint16_t copyLen; /* Number of bytes copied */
238 RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL,
239 dlData, sizeof(RlcData));
242 DU_LOG("\nERROR --> RLC_DL : rlcSendDedLcDlData: Memory allocation failed for dl data");
243 RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL,
244 datReqInfo, sizeof(RguDDatReqInfo));
247 memset(dlData, 0, sizeof(RlcData));
249 for(ueIdx = 0; ueIdx < datReqInfo->nmbOfUeGrantPerTti; ueIdx++)
251 datPerUe = datReqInfo->datReq[ueIdx];
253 dlData->cellId = datReqInfo->cellId;
254 dlData->rnti = datPerUe.rnti;
255 /* Retrieving sfn/slot from transId. It was filled in RlcProcSchedResultRpt */
256 dlData->slotInfo.sfn = datPerUe.transId >> 16;
257 dlData->slotInfo.slot = datPerUe.transId & 0xffff;
261 for(tbIdx = 0; tbIdx < datPerUe.nmbOfTbs; tbIdx++)
263 datPerTb = datPerUe.datReqTb[tbIdx];
264 for(lchIdx = 0; lchIdx < datPerTb.nmbLch; lchIdx++)
266 datPerLch = datPerTb.lchData[lchIdx];
267 lcId = datPerLch.lcId;
268 for(pduIdx = 0; pduIdx < datPerLch.pdu.numPdu; pduIdx++)
270 dlData->pduInfo[dlData->numPdu].commCh = FALSE;
271 dlData->pduInfo[dlData->numPdu].lcId = datPerLch.lcId;
273 /* Copy Message to fixed buffer to send */
274 ODU_GET_MSG_LEN(datPerLch.pdu.mBuf[pduIdx], (MsgLen *)&pduLen);
275 RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL,
276 dlData->pduInfo[dlData->numPdu].pduBuf, pduLen);
278 if (dlData->pduInfo[dlData->numPdu].pduBuf == NULLP )
280 DU_LOG("\nERROR --> RLC_DL : rlcSendDedLcDlData: Memory allocation failed");
281 for(pduIdx = 0; pduIdx < dlData->numPdu; pduIdx++)
283 RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlData->pduInfo[pduIdx].pduBuf,\
284 dlData->pduInfo[pduIdx].pduLen);
286 RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL,
287 dlData, sizeof(RlcData));
288 RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL,
289 datReqInfo, sizeof(RguDDatReqInfo));
293 ODU_COPY_MSG_TO_FIX_BUF(datPerLch.pdu.mBuf[pduIdx], 0, pduLen, \
294 dlData->pduInfo[dlData->numPdu].pduBuf, (MsgLen *)©Len);
295 dlData->pduInfo[dlData->numPdu].pduLen = pduLen;
298 ODU_PUT_MSG_BUF(datPerLch.pdu.mBuf[pduIdx]);
302 dlData->boStatus[dlData->numLc].cellId = datReqInfo->cellId;
303 GET_UE_IDX(datPerUe.rnti, dlData->boStatus[dlData->numLc].ueIdx);
304 dlData->boStatus[dlData->numLc].commCh = false;
305 dlData->boStatus[dlData->numLc].lcId = datPerLch.lcId;
306 dlData->boStatus[dlData->numLc].bo = datPerLch.boReport.bo + datPerLch.boReport.estRlcHdrSz;
308 }/* For Data per Lch */
309 }/* For Data per Tb */
311 RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL, dlRrcMsgRsp, sizeof(RlcDlRrcMsgRsp));
312 if(dlRrcMsgRsp == NULLP)
314 DU_LOG("\nERROR --> RLC_DL : rlcSendDedLcDlData: Memory allocation failed for dlRrcMsgRsp");
315 for(pduIdx = 0; pduIdx < dlData->numPdu; pduIdx++)
317 RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlData->pduInfo[pduIdx].pduBuf,\
318 dlData->pduInfo[pduIdx].pduLen);
320 RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlData, sizeof(RlcData));
321 RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL,
322 datReqInfo, sizeof(RguDDatReqInfo));
325 dlRrcMsgRsp->cellId = dlData->cellId;
326 dlRrcMsgRsp->crnti = dlData->rnti;
328 /* Sending DL Data per UE to MAC */
329 FILL_PST_RLC_TO_MAC(pst, RLC_DL_INST, EVENT_DL_DATA_TO_MAC);
330 if(RlcSendDlDataToMac(&pst, dlData) != ROK)
332 DU_LOG("\nERROR --> RLC_DL : rlcSendDedLcDlData: Failed to send Dl RRC Msg To Mac");
333 dlRrcMsgRsp->state = TRANSMISSION_FAILED;
334 for(pduIdx = 0; pduIdx < dlData->numPdu; pduIdx++)
336 RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlData->pduInfo[pduIdx].pduBuf,\
337 dlData->pduInfo[pduIdx].pduLen);
339 RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlData, sizeof(RlcData));
340 RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RguDDatReqInfo));
341 RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlRrcMsgRsp, sizeof(RlcDlRrcMsgRsp));
345 dlRrcMsgRsp->state = TRANSMISSION_COMPLETE;
347 FILL_PST_RLC_TO_DUAPP(pst, RLC_DL_INST, EVENT_DL_RRC_MSG_RSP_TO_DU);
348 if(lcId >= SRB1_LCID && lcId <= SRB3_LCID) /* Valid for all RRC messages i.e. SRB1, SRB2, SRB3 */
350 if(rlcSendDlRrcMsgRspToDu(&pst, dlRrcMsgRsp) != ROK)
352 DU_LOG("\nERROR --> RLC_DL : rlcSendDedLcDlData: Failed to send Dl RRC Msg Rsp To Du");
353 RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlRrcMsgRsp, sizeof(RlcDlRrcMsgRsp));
354 RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RguDDatReqInfo));
358 } /* For Data per UE */
359 RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RguDDatReqInfo));
362 }/* End of rlcSendDedLcDlData */
367 * Handler for sending the data to multiple logical channels of a UE
370 * This function sends the data for one or more logical channels
371 * after processing the SDUs and forming the PDUs.It calls
372 * UMM or AMM functions to form the PDUs for the requested sizes
375 * @param[in] gCb RLC instance Control block
376 * @param[in] staIndInfo Status Indication Information containing the
377 * size of PDU(s) for one or more logical channels
384 uint8_t rlcUtlSendToMac(RlcCb *gCb, SuId suId, KwDStaIndInfo *staIndInfo)
388 RlcDlUeCb *ueCb; /* UE control block */
389 uint32_t count; /* Loop Counter */
390 uint32_t numTb; /* Number of Tbs */
391 RlcDlRbCb *rbCb; /* RB Control Block */
392 RlcDatReq datReq; /* PDUs Information */
393 RguDDatReqInfo *datReqInfo; /* Data Request Information */
394 RlcRguSapCb *rguSap; /* MAC SAP CB */
395 uint32_t totNumPdu; /* Total number of PDUS */
396 RguStaIndTb *staIndTb = NULLP;
397 RguDatReqTb *datReqTb = NULLP;
398 RguDStaIndPerUe *staInd = NULLP;
400 uint32_t grantPerLch[RGU_MAX_LC] = {0};
402 /* kw005.201 added support for L2 Measurement */
403 #ifdef LTE_L2_MEAS_LOSS_DELAY
406 #endif /* LTE_L2_MEAS */
410 uint32_t staIndSz=0,datIndSz = 0;
413 RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL,
414 datReqInfo,sizeof(RguDDatReqInfo));
415 #if (ERRCLASS & ERRCLS_ADD_RES)
416 if ( datReqInfo == NULLP )
418 DU_LOG("\nERROR --> RLC_DL : rlcUtlSendToMac: Memory allocation failed");
421 #endif /* ERRCLASS & ERRCLS_ADD_RES */
422 for(idx = 0; idx < staIndInfo->nmbOfUeGrantPerTti; idx++)
424 staInd = &staIndInfo->staInd[idx];
425 /* Fetch Ue control block */
426 GET_UE_IDX(staInd->rnti, ueIdx);
427 if(ROK != rlcDbmFetchDlUeCb(gCb, ueIdx, staIndInfo->cellId,&ueCb))
429 /* Fetch UeCb failed */
430 DU_LOG("\nERROR --> RLC_DL : rlcUtlSendToMac: UeId[%u]:ueCb not found",
432 /* If ueCb is not found for current rnti then continue to look for next rnti*/
435 /* kw002.201 Removed the allocation of RlcDatReq */
436 /* kw004.201 Used SSI function to initialize the variable */
437 memset(&datReq, 0, sizeof(RlcDatReq) );
439 for (numTb = 0; numTb < staInd->nmbOfTbs; numTb++)
441 staIndTb = &(staInd->staIndTb[numTb]);
442 datReqTb = &(datReqInfo->datReq[idx].datReqTb[numTb]);
444 ueCb->tbIdx = (ueCb->tbIdx+1) % RLC_MAX_TB_PER_UE;
446 for (count = 0;count < staIndTb->nmbLch; count++)
449 /*Calculate the total grant size from MAC */
450 if((staIndTb->lchStaInd[count].lcId >= RGU_MAX_LC)
451 || (staIndTb->lchStaInd[count].lcId == 0))
453 /* TODO : Need to figure out why this is happening */
458 grantPerLch[staIndTb->lchStaInd[count].lcId] += staIndTb->lchStaInd[count].totBufSize;
461 rbCb = ueCb->lCh[staIndTb->lchStaInd[count].lcId - 1].dlRbCb;
463 if (rbCb && (!rlcDlUtlIsReestInProgress(rbCb)))
466 staIndSz += staIndTb->lchStaInd[count].totBufSize;
467 datReq.pduSz = staIndTb->lchStaInd[count].totBufSize;
469 datReq.totMacGrant = grantPerLch[staIndTb->lchStaInd[count].lcId];
471 rlcUtlGetCurrTime(&datReq.boRep.oldestSduArrTime);
472 if ( RLC_MODE_UM == rbCb->mode )
474 rlcUmmProcessSdus(gCb,rbCb,&datReq);
476 else if ( RLC_MODE_AM == rbCb->mode )
478 rlcAmmProcessSdus(gCb,rbCb,&datReq,staInd->fillCtrlPdu);
481 grantPerLch[staIndTb->lchStaInd[count].lcId] = datReq.totMacGrant;
483 if ( 0 == datReq.pduInfo.numPdu )
487 totNumPdu += datReq.pduInfo.numPdu;
488 memcpy(&(datReqTb->lchData[count].pdu),
489 &(datReq.pduInfo),sizeof(KwPduInfo));
491 for (;numPdu < datReqTb->lchData[count].pdu.numPdu ; numPdu ++)
494 ODU_GET_MSG_LEN(datReqTb->lchData[count].pdu.mBuf[numPdu],&len);
497 datReqTb->lchData[count].setMaxUlPrio = FALSE;
498 if (RLC_AM_IS_POLL_BIT_SET(RLC_AMDL) &&
499 (RLC_AMDL.sduQ.count > 1))
501 /* Poll bit is set indicate to MAC*/
502 datReqTb->lchData[count].setMaxUlPrio = TRUE;
504 datReqTb->lchData[count].boReport.bo = datReq.boRep.bo;
507 datReqTb->lchData[count].boReport.estRlcHdrSz =
508 datReq.boRep.estHdrSz;
509 datReqTb->lchData[count].boReport.staPduPrsnt =
510 datReq.boRep.staPduPrsnt;
511 #endif /* CCPU_OPT */
512 datReqTb->lchData[count].boReport.staPduBo =
513 datReq.boRep.staPduBo;
514 datReqTb->lchData[count].lcId = staIndTb->lchStaInd[count].lcId;
517 /* Set if Bearer is UM */
518 if ( RLC_MODE_UM == rbCb->mode )
520 datReqTb->lchData[count].freeBuff = TRUE;
524 datReqTb->lchData[count].freeBuff = FALSE;
528 /* kw005.201 added support for L2 Measurement */
529 #ifdef LTE_L2_MEAS_LOSS_DELAY
530 datReqTb->rguSnInfo->lchMap[count].lChId =
531 staIndTb->lchStaInd[count].lcId;
532 /* In some cases L2 Measurement for few of the lcId may be off,
533 * in this case we are assigning snList to 0xffff
535 for(snIdx1 = 0; snIdx1 < RGU_MAX_PDU; snIdx1++)
537 datReqTb->rguSnInfo->lchMap[count].snList[snIdx1] = 0xffff;
539 if(tbSnMap->numSn != 0)
542 for(snIdx1=tbSnMap->prevNumSn;snIdx1 < tbSnMap->numSn;snIdx1++)
544 datReqTb->rguSnInfo->lchMap[count].snList[snIdx2++] =
545 tbSnMap->snSduMap[snIdx1].sn;
547 tbSnMap->prevNumSn = tbSnMap->numSn;
550 datReqTb->lchData[count].boReport.oldestSduArrTime =
551 datReq.boRep.oldestSduArrTime;
552 /* kw004.201 Used SSI function to initialize the variable */
553 memset(&datReq, 0, sizeof(RlcDatReq) );
557 if(ueCb->l2MeasTbCb[ueCb->tbIdx]!= NULLP)
559 datReqTb->tbId = ueCb->tbIdx;
563 datReqTb->tbId = RLC_INVALID_TBID;
566 datReqTb->nmbLch = staIndTb->nmbLch;
567 /*adding the check to make sure that lcId is not sent as 0
568 * when no data is there in datReq */
569 if ( 0 == totNumPdu )
571 datReqTb->lchData[0].lcId = staIndTb->lchStaInd[0].lcId;
573 /* kw005.201 added support for L2 Measurement */
574 #ifdef LTE_L2_MEAS_LOSS_DELAY
575 if(tbSnMap->numSn == 0)
577 RLC_FREE(tbSnMap,sizeof(RlcTbSnMap));
578 RLC_FREE(datReqTb->rguSnInfo,sizeof(RguSnMapInfo));
579 datReqTb->rguSnInfo = NULLP;
580 rlcCb.rlcL2Cb.curTbSnMap = NULLP;
581 datReqTb->snMapPres = FALSE;
585 cmHashListInsert(&(rlcCb.rlcL2Cb.tbHlCp),(PTR)tbSnMap,
586 (uint8_t *) &(tbSnMap->tbId), (uint16_t)sizeof(tbSnMap->tbId));
587 rlcCb.rlcL2Cb.curTbSnMap = NULLP;
589 #endif /* LTE_L2_MEAS */
591 datReqInfo->datReq[idx].nmbOfTbs = staInd->nmbOfTbs;
592 datReqInfo->datReq[idx].transId = staInd->transId;
593 datReqInfo->datReq[idx].rnti = staInd->rnti;
595 datReqInfo->cellId = staIndInfo->cellId;
596 datReqInfo->nmbOfUeGrantPerTti = staIndInfo->nmbOfUeGrantPerTti;
598 rguSap = &(gCb->u.dlCb->rguDlSap[suId]);
599 rlcSendDedLcDlData(&rguSap->pst,rguSap->spId,datReqInfo);
606 * Handler for sending Status Response to MAC.
609 * This function is used by RLC entity for sending
610 * status response to MAC after receiving a SDU from
613 * @param[in] gCb RLC instance Control block
614 * @param[in] rbCb Radio Bearer Control Block
615 * @param[in] bo Buffer Occupancy
616 * @param[in] estHdrSz Estimated Header Size
617 * @param[in] staPduPrsnt Status PDU present or not
623 uint8_t rlcUtlSendDedLcBoStatus(RlcCb *gCb, RlcDlRbCb *rbCb, int32_t bo, \
624 int32_t estHdrSz, bool staPduPrsnt, uint32_t staPduBo)
626 Pst pst; /* Post info */
627 RlcBoStatus *boStatus; /* Buffer occupancy status information */
630 if ((rbCb->lastRprtdBoToMac > (uint32_t)8000) && (rbCb->boUnRprtdCnt < (uint32_t)5)
631 && (!staPduPrsnt) && ((RLC_MODE_AM == rbCb->mode ) && (RLC_AMDL.nxtRetx == NULLP)))
633 rbCb->boUnRprtdCnt++;
637 rbCb->boUnRprtdCnt = (uint32_t)0;
638 rbCb->lastRprtdBoToMac = (uint32_t)bo;
640 RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL, \
641 boStatus, sizeof(RlcBoStatus));
643 boStatus->cellId = rbCb->rlcId.cellId;
644 boStatus->ueIdx = rbCb->rlcId.ueId;
645 boStatus->commCh = FALSE;
646 boStatus->lcId = rbCb->lch.lChId;
647 boStatus->bo = bo + estHdrSz;
649 FILL_PST_RLC_TO_MAC(pst, RLC_DL_INST, EVENT_BO_STATUS_TO_MAC);
650 /* Send Status Response to MAC layer */
651 if(RlcSendBoStatusToMac(&pst, boStatus) != ROK)
653 RLC_FREE_SHRABL_BUF(pst.region, pst.pool, boStatus, sizeof(RlcBoStatus));
662 * Handler for emptying the SDU queue.
665 * This function is used to empty the SDU queue when
666 * a re-establishment request is received from the
669 * @param[in] gCb RLC instance control block
670 * @param[in] rbCb Radio bearer control block
671 * @param[in] sduQ SDU queue to be emptied
675 /* kw005.201 added support for L2 Measurement */
676 #ifdef LTE_L2_MEAS_RLC
691 #ifdef LTE_L2_MEAS_RLC
692 CmLListCp *sduSnMapQ; /* SDU Sequence number map queue */
693 CmLList *firstSduSnMap; /* First Node in SDU SnMap Queue */
694 RlcSduSnMap *sduSnMap; /* SDU Sn Map */
697 firstSduSnMap = NULLP;
701 sduSnMapQ = &rbCb->sduSnMapQ;
702 CM_LLIST_FIRST_NODE(sduSnMapQ, firstSduSnMap);
706 sduSnMap = (RlcSduSnMap *)firstSduSnMap->node;
707 if(sduSnMap != NULLP)
709 cmLListDelFrm(&(rbCb->sduSnMapQ), &(sduSnMap->lstEnt));
710 RLC_FREE(sduSnMap, sizeof(RlcSduSnMap));
711 CM_LLIST_FIRST_NODE(sduSnMapQ, firstSduSnMap);
715 CM_LLIST_NEXT_NODE(sduSnMapQ, firstSduSnMap);
725 * Function to set that re-establishment has started for an RB
728 * This function is used to set the reestInProgress flag to TRUE.
729 * This also sets the estimated header size to 0 and sends bo as
730 * 0 to MAC so that RLC does not need to transmit any data.
731 * If the poll re-transmit timer is running for the RB;
734 * @param[in] gCb RLC instance control block
735 * @param[in] rbCb RB for which re-establishment has started
739 Void rlcDlUtlSetReestInProgressForRB(RlcCb *gCb,RlcDlRbCb *rbCb)
742 rbCb->reestInProgress = TRUE;
744 if(rbCb->mode == RLC_MODE_AM )
746 rbCb->m.amDl.estHdrSz = 0;
748 if(rlcChkTmr(gCb, (PTR)rbCb, EVENT_RLC_AMDL_POLL_RETX_TMR))
750 rlcStopTmr(gCb, (PTR)rbCb, EVENT_RLC_AMDL_POLL_RETX_TMR);
753 rlcUtlSendDedLcBoStatus(gCb, rbCb, 0, 0, FALSE,0);
761 * Function to check if re-establishment is ongoing for an RB
763 * @param[in] rbCb RB for which re-establishment is to be checked
766 * TRUE : Re-establishment is in progress
767 * FALSE : Re-establishment is not in progress
769 bool rlcDlUtlIsReestInProgress(RlcDlRbCb *rbCb)
771 return (rbCb->reestInProgress);
777 * Function to set re-establishment to FALSE
779 * @param[in] rbCb RB for which re-establishment is to be reset
783 Void rlcDlUtlResetReestInProgress(RlcDlRbCb *rbCb)
786 rbCb->reestInProgress = FALSE;
792 * Function to set that re-establishment has started for all the RBs
793 * of an UE; except for SRB1
795 * @detail: For SRB1 only the poll-retransmit timer is stopped
797 * @param[in] gCb RLC instance control block
798 * @param[in] ueCb UE for which re-establishment has started
802 Void rlcDlUtlSetReestInProgressForAllRBs(RlcCb *gCb,RlcDlUeCb *ueCb)
806 for(rbIdx = 0;rbIdx < RLC_MAX_SRB_PER_UE;rbIdx++)
808 if(ueCb->srbCb[rbIdx] != NULLP)
810 if(ueCb->srbCb[rbIdx]->rlcId.rbId != 1)
812 rlcDlUtlSetReestInProgressForRB(gCb,ueCb->srbCb[rbIdx]);
816 /* For SRB we just need to stop the poll re-transmit timer */
817 if(rlcChkTmr(gCb, (PTR)ueCb->srbCb[rbIdx], EVENT_RLC_AMDL_POLL_RETX_TMR))
819 rlcStopTmr(gCb, (PTR)ueCb->srbCb[rbIdx], EVENT_RLC_AMDL_POLL_RETX_TMR);
825 for(rbIdx = 0;rbIdx < RLC_MAX_DRB_PER_UE;rbIdx++)
827 if(ueCb->drbCb[rbIdx] != NULLP)
829 rlcDlUtlSetReestInProgressForRB(gCb,ueCb->drbCb[rbIdx]);
837 * @brief Function to increment number of SDUs transmitted
838 * in KWU SAP statistics
841 * @param[in] rlckwuSap KWU SAP in which to increment the counter
845 void rlcUtlIncrementKwuStsSduTx(RlcKwuSapCb *rlckwuSap)
847 rlckwuSap->sts.sduTx++;
852 * @brief Function to increment number of bytes and PDUs transmitted
853 * in General statistics
856 * @param[in] genSts KWU SAP in which to increment the counter
857 * @param[in] pdu The PDU which is sent
861 void rlcUtlIncrementGenStsBytesAndPdusSent(RlcGenSts *genSts, Buffer *pdu)
864 ODU_GET_MSG_LEN(pdu, &bytesSent);
865 genSts->bytesSent += bytesSent;
871 * @brief Function to initialize the data structures used to free memory
874 * @param[in] gCb RLC instance control block
875 * @param[out] toBeFreed Pointer to the freeing structure. This is
880 Void rlcUtlInitToBeFreed(RlcCb *gCb,RlcDlDataToBeFreed *toBeFreed)
882 cmLListInit(&(toBeFreed->sduLst));
883 cmLListInit(&(toBeFreed->rbLst));
884 cmLListInit(&(toBeFreed->reTxLst));
885 cmLListInit(&(toBeFreed->txLst));
891 * @brief Function to initialize the DL self Pst structure
894 * @param[in] gCb RLC instance control block
898 Void rlcUtlInitializeSelfPst(RlcCb *gCb)
900 Pst *selfPst = &gCb->u.dlCb->selfPst;
902 RLC_MEM_SET(selfPst, 0, sizeof(Pst));
903 selfPst->srcProcId = SFndProcId();
904 selfPst->dstProcId = SFndProcId();
905 selfPst->dstEnt = gCb->init.ent;
906 selfPst->dstInst = gCb->init.inst; /* this is for the DL instance */
907 selfPst->srcEnt = gCb->init.ent;
908 selfPst->srcInst = gCb->init.inst; /* DL instance will send to itself */
909 selfPst->prior = PRIOR3;
910 selfPst->event = UDX_EVT_DL_CLEANUP_MEM;
914 * @brief Function to send a DL cleanup event
917 * @param[in] gCb RLC instance control block
921 void rlcUtlRaiseDlCleanupEvent(RlcCb *gCb)
923 #ifdef KWSELFPSTDLCLEAN
924 if(!gCb->u.dlCb->eventInQueue)
926 ODU_POST_TASK(&gCb->u.dlCb->selfPst, gCb->u.dlCb->selfPstMBuf);
927 gCb->u.dlCb->eventInQueue = TRUE;
934 * @brief Function to add a SDU to the to be freed sdu list
937 * @param[in] gCb RLC instance control block
938 * @param[in] sdu SDU to be added to the list
942 void rlcUtlAddSduToBeFreedQueue(RlcCb *gCb, RlcSdu *sdu)
944 cmLListAdd2Tail(&(gCb->u.dlCb->toBeFreed.sduLst), &(sdu->lstEnt));
949 * @brief Function to add a re-transmitted pdu to the to be freed list
952 * @param[in] gCb RLC instance control block
953 * @param[in] retx Re-transmitted pdu to be added to the list
957 Void rlcUtlAddReTxPduToBeFreedQueue(RlcCb *gCb,RlcRetx *retx)
959 cmLListAdd2Tail(&(gCb->u.dlCb->toBeFreed.reTxLst), &(retx->lstEnt));
964 * @brief Function to add a transmitted pdu to the to be freed list
967 * @param[in] gCb RLC instance control block
968 * @param[in] pdu PDU to be added to the list
972 Void rlcUtlAddTxPduToBeFreedQueue(RlcCb *gCb,RlcTx *pdu)
974 pdu->rlsLnk.node = (PTR)pdu;
975 cmLListAdd2Tail(&(gCb->u.dlCb->toBeFreed.txLst), &(pdu->rlsLnk));
981 * function to free/release the Acknowledged mode RBCB buffers
984 * This primitive Frees the Acknowledged Mode RbCb transmission Buffer,
985 * retransmission Buffer and reciption Buffers
987 * @param [in] gCb - RLC instance control block
988 * @param [in] rbCb - Downlink RB Control Block
989 * @param [in,out] toBeFreed - Number of buffers to be freed
992 * - TRUE if more data to be freed
993 * - FALSE if all the data has been freed
995 static Bool rlcUtlFreeDlAmRbMemory(RlcCb *gCb,RlcDlRbCb *rbCb,uint32_t *toBeFreed)
997 RlcRetx *retx; /* retransmission buffer */
998 RlcSn mTxNext; /* send state variable */
1001 MODAMT(RLC_AMDL.txNext, mTxNext, RLC_AMDL.txNextAck,RLC_AMDL.snModMask);
1003 /* TODO : to be checked changed from <= to < */
1004 while ((0 < mTxNext) && *toBeFreed)
1006 txBuf = rlcUtlGetTxBuf(RLC_AMDL.txBufLst, RLC_AMDL.txNextAck);
1007 if (txBuf && txBuf->pduLst.first)
1009 while(txBuf->pduLst.first)
1011 RlcDlPduInfo *pduInfo = (RlcDlPduInfo *)(txBuf->pduLst.first->node);
1012 ODU_PUT_MSG_BUF(pduInfo->pdu);
1013 /* Delete node from the txBuf Pdu lst */
1014 cmLListDelFrm(&txBuf->pduLst, txBuf->pduLst.first);
1015 RLC_FREE(gCb, pduInfo, sizeof(RlcDlPduInfo));
1017 rlcUtlDelTxBuf(RLC_AMDL.txBufLst, txBuf, gCb);
1018 if(gCb->u.dlCb->shutdownReceived == 0)
1023 RLC_AMDL.txNextAck = (RLC_AMDL.txNextAck + 1) & RLC_AMDL.snModMask;
1024 MODAMT(RLC_AMDL.txNext, mTxNext, RLC_AMDL.txNextAck,RLC_AMDL.snModMask);
1032 RLC_FREE(gCb,RLC_AMDL.txBufLst, (RLC_TX_BUF_BIN_SIZE * sizeof(CmLListCp)));
1035 RLC_LLIST_FIRST_RETX(RLC_AMDL.retxLst, retx);
1036 while (retx && (*toBeFreed)) /* Till to be freed becomes 0 */
1039 ODU_PUT_MSG_BUF(retx->seg);
1041 cmLListDelFrm(&RLC_AMDL.retxLst, &retx->lstEnt);
1042 RLC_FREE(gCb, retx, sizeof(RlcRetx));
1044 RLC_LLIST_FIRST_RETX(RLC_AMDL.retxLst, retx);
1045 if(gCb->u.dlCb->shutdownReceived == 0)
1052 RLC_AMDL.nxtRetx = NULLP;
1054 /* clean up if there is info about STATUS PDU to be sent */
1055 if(RLC_AMDL.pStaPdu)
1058 udxPst = &gCb->u.dlCb->udxDlSap->pst;
1059 RLC_FREE_SHRABL_BUF_WC(udxPst->region,
1062 sizeof(RlcUdxDlStaPdu));
1063 RLC_AMDL.pStaPdu = NULLP;
1070 if(gCb->u.dlCb->shutdownReceived)
1079 * @brief Function to free memory from the DL instance
1082 * @param[in] gCb RLC instance control block
1086 Void rlcUtlFreeDlMemory(RlcCb *gCb)
1090 /* safety check, in case some event was still lying in the queue after
1091 the dlCb was deleted*/
1097 RlcDlDataToBeFreed* pToBeFreed = &gCb->u.dlCb->toBeFreed;
1099 if(gCb->u.dlCb->shutdownReceived)
1101 toBeFreed = pToBeFreed->txLst.count + pToBeFreed->reTxLst.count + pToBeFreed->sduLst.count + pToBeFreed->rbLst.count;
1105 if ((pToBeFreed->txLst.count + pToBeFreed->reTxLst.count + pToBeFreed->sduLst.count) > (3 * RLC_MAX_TO_BE_FREED))
1107 #if !defined(KWSELFPSTDLCLEAN) && defined(MAC_RLC_HARQ_STA_RBUF) && defined(LTE_L2_MEAS)
1108 if (isDatReqProcessed)
1110 toBeFreed = (2 *RLC_MAX_TO_BE_FREED);
1115 toBeFreed = (3 *RLC_MAX_TO_BE_FREED)/2;
1120 toBeFreed = RLC_MAX_TO_BE_FREED;
1125 gCb->u.dlCb->eventInQueue = FALSE; /* reset as we have received the event
1126 and are processing it */
1128 /* Free from the ReTx list */
1129 lst = &pToBeFreed->reTxLst;
1131 while((lst->first) && toBeFreed && (pToBeFreed->reTxLst.count > 100))
1133 while((lst->first) && toBeFreed)
1136 RlcRetx* seg = (RlcRetx *)(lst->first->node);
1137 cmLListDelFrm(lst, lst->first);
1138 ODU_PUT_MSG_BUF(seg->seg);
1139 RLC_FREE(gCb,seg, sizeof(RlcRetx));
1143 /* Free from the Tx list */
1144 lst = &pToBeFreed->txLst;
1146 while((lst->first) && toBeFreed && (pToBeFreed->txLst.count > 100))
1148 while((lst->first) && toBeFreed)
1151 RlcTx* pdu = (RlcTx *)(lst->first->node);
1152 cmLListDelFrm(lst, lst->first);
1153 while(pdu->pduLst.first)
1155 RlcDlPduInfo *pduInfo = (RlcDlPduInfo *)(pdu->pduLst.first->node);
1157 cmLListDelFrm(&pdu->pduLst, pdu->pduLst.first);
1158 ODU_PUT_MSG_BUF(pduInfo->pdu);
1159 RLC_FREE(gCb, pduInfo, sizeof(RlcDlPduInfo));
1161 RLC_FREE(gCb,pdu, sizeof(RlcTx));
1165 /* Free from the SDU queue */
1166 lst = &pToBeFreed->sduLst;
1168 while((lst->first) && toBeFreed && (pToBeFreed->sduLst.count > 100))
1170 while((lst->first) && toBeFreed)
1173 RlcSdu* sdu = (RlcSdu *)(lst->first->node);
1174 RLC_RMV_SDU(gCb, lst, sdu);
1178 /* Free from the RBs */
1179 lst = &pToBeFreed->rbLst;
1181 while((lst->first) && toBeFreed && (pToBeFreed->rbLst.count > 100))
1183 while((lst->first) && toBeFreed)
1186 RlcDlRbCb* rbCb = (RlcDlRbCb *)(lst->first->node);
1187 Bool moreToBeFreed = rlcUtlFreeDlAmRbMemory(gCb, rbCb,&toBeFreed);
1190 cmLListDelFrm(lst, lst->first);
1191 RLC_FREE(gCb, rbCb, sizeof(RlcDlRbCb));
1195 if ((toBeFreed == 0) && !(gCb->u.dlCb->shutdownReceived))
1197 rlcUtlRaiseDlCleanupEvent(gCb);
1207 * @brief Function to initialise measurement
1211 * @param[in] gCb RLC Instance Control Block
1216 S16 rlcUtlL2MeasDlInit(RlcCb *gCb)
1220 gCb->u.dlCb->rlcL2Cb.rlcNumMeas=0;
1221 for(cntr = 0; cntr < LKW_MAX_L2MEAS; cntr++)
1223 memset(&(gCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[cntr]), 0, sizeof(RlcL2MeasEvtCb));
1225 gCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[RLC_L2MEAS_DL_DISC].measCb.measType = LKW_L2MEAS_DL_DISC;
1226 gCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[RLC_L2MEAS_DL_IP].measCb.measType = LKW_L2MEAS_DL_IP;
1227 gCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[RLC_L2MEAS_DL_DELAY].measCb.measType= LKW_L2MEAS_DL_DELAY;
1228 gCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[RLC_L2MEAS_UU_LOSS].measCb.measType= LKW_L2MEAS_UU_LOSS;
1229 gCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[RLC_L2MEAS_ACT_UE].measCb.measType= LKW_L2MEAS_ACT_UE;
1235 * @brief Function to detect the data Burst start Condition in a DTCH
1239 * @param[in] rbCb RB control block
1240 * @param[in] contSduLst Array of Contained SDUs in the DTCH
1241 * @param[in] dataVol Available data in the DTCH
1242 * @param[in] schPduSz Total grant Size given by MAC
1247 Void rlcUtlUpdateBurstSdus
1251 RlcContSduLst *contSduLst,
1257 RlcL2MeasDlIpTh *l2MeasDlIpThruput = NULLP;
1258 RlcL2MeasTb *l2MeasTb = NULLP;
1261 volatile uint32_t startTime = 0;
1262 RlcContSduLst *dstContSduLst;
1266 SStartTask(&startTime, PID_RLC_DLIP_TPT_BURSTCALC);
1268 l2MeasDlIpThruput = &rbCb->l2MeasIpThruput.dlIpTh;
1270 if(RLC_MEAS_IS_DL_IP_MEAS_ON_FOR_RB(gCb, rbCb))
1272 if(dataVol > schPduSz)
1274 if(l2MeasDlIpThruput->isBurstAct == FALSE)
1276 l2MeasDlIpThruput->burstStartTime = glblTtiCnt;
1277 l2MeasDlIpThruput->isBurstAct = TRUE;
1278 l2MeasDlIpThruput->burstEndSduId = 0;
1281 { /* This is the case when another burst started before RLC gets the
1282 l2MeasDlIpThruput->burstEndSduId = 0; */
1286 { /* Store the burstEndSduId here */
1287 if((l2MeasDlIpThruput->isBurstAct == TRUE) &&
1288 (!l2MeasDlIpThruput->burstEndSduId))
1290 l2MeasDlIpThruput->burstEndSduId =
1291 l2MeasDlIpThruput->outStngSduArr[l2MeasDlIpThruput->lastSduIdx].sduId;
1294 if(l2MeasDlIpThruput->isBurstAct == TRUE)
1296 l2MeasTb = rlcUtlGetCurMeasTb(gCb,rbCb);
1297 /* Get the lChId from index 0, because index 0 is always for DL */
1298 if(l2MeasTb->numLcId >= RLC_MAX_ACTV_DRB)
1303 l2MeasTb->sduInfo[l2MeasTb->numLcId].lcId = rbCb->lch.lChId;
1304 /* Copy all the sduIdx from sduInfo to tb sduInfo */
1305 currTbIdx = l2MeasTb->sduInfo[l2MeasTb->numLcId].numSdus;
1306 dstContSduLst = &l2MeasTb->sduInfo[l2MeasTb->numLcId];
1308 for(idx = 0; ((idx < contSduLst->numSdus)
1309 && (currTbIdx < RLC_L2MEAS_MAX_OUTSTNGSDU)) ; idx++)
1311 dstContSduLst->sduIdx[currTbIdx++] = contSduLst->sduIdx[idx];
1313 l2MeasTb->sduInfo[l2MeasTb->numLcId].numSdus += idx;
1314 l2MeasTb->numLcId++;
1315 }/* End of isBurstAct */
1316 }/* End of if measOn */
1319 SStopTask(startTime, PID_RLC_DLIP_TPT_BURSTCALC);
1324 * This function is used to store locally the sduIdx of the sdu in the
1325 * outstanding SDU array
1328 * Stores the Sdu Idx in the contained SDU Array and increments
1329 * the num contained Sdus
1331 * @param[in] sduIdx the Index of the SDU in the outstanding SDU array
1332 * @param[out] contSduLst This stores the indices of the SDUs
1336 Void rlcUtlUpdateContainedSduLst(uint8_t sduIdx,RlcContSduLst *contSduLst)
1338 if (contSduLst->numSdus < RLC_L2MEAS_MAX_OUTSTNGSDU)
1340 contSduLst->sduIdx[contSduLst->numSdus] = sduIdx;
1341 contSduLst->numSdus++;
1348 * This function is used to store the sduId of the sdu in the
1349 * outstanding SDU array
1352 * Stores the Sdu Id in the outstanding SDU Array and increments
1353 * the num contained Sdus
1355 * @param[out] dlIpThPut The structure in which the outstanding sdus are
1357 * @param[in] sduIdx The Idx at which the sdu ID is stored
1358 * @param[in] sduLen The size if sdu in bytes
1359 * @param[in] newIdx Indicates if the sdu is already present in the
1364 Void rlcUtlUpdateOutStandingSduLst
1366 RlcL2MeasDlIpTh *dlIpThPut,
1373 if (sduIdx < RLC_L2MEAS_MAX_OUTSTNGSDU)
1377 dlIpThPut->outStngSduArr[sduIdx].numTb = 0;
1379 dlIpThPut->outStngSduArr[sduIdx].numTb++;
1380 dlIpThPut->outStngSduArr[sduIdx].sduId = sduId;
1381 dlIpThPut->outStngSduArr[sduIdx].sduLen = sduLen;
1385 RlcL2MeasTb * rlcUtlGetCurMeasTb(RlcCb *gCb,RlcDlRbCb *rbCb)
1387 RlcL2MeasTb *curL2MeasTb;
1390 if((curL2MeasTb = rbCb->ueCb->l2MeasTbCb[rbCb->ueCb->tbIdx]) == NULLP)
1392 /* Intentionally avoiding the RLC_ALLOC macro to avoid memset */
1393 if (SGetSBuf(gCb->init.region,
1395 (Data **)&curL2MeasTb,
1396 (Size)sizeof(RlcL2MeasTb)) != ROK)
1400 rbCb->ueCb->l2MeasTbCb[rbCb->ueCb->tbIdx] = curL2MeasTb;
1401 /* Initialize the Meas Tb details */
1402 curL2MeasTb->numLcId = 0;
1403 curL2MeasTb->numLchInfo = 0;
1404 curL2MeasTb->txSegSduCnt = 0;
1405 for (idx = 0; idx < RLC_MAX_ACTV_DRB; idx++)
1407 curL2MeasTb->sduInfo[idx].numSdus = 0;
1409 for (idx = 0; idx < RLC_MAX_ACTV_DRB; idx++)
1411 curL2MeasTb->lchInfo[idx].numSdus = 0;
1414 return (curL2MeasTb);
1420 * @brief Handler for Processing harq status indication
1424 * This function is called when the MAC sends a harq ind Mesage.
1425 * This is used only for UuLoss and Dl Delay and DL Ipthoughput
1428 * @param[in] staInd Harq status indication received from MAC.
1429 * @param[in] ueCb UeCb corresponding to the Tb Id.
1430 * @param[in] tbIdx TB index, 0 for SISO and 0,1 for MIMO.
1437 S16 rlcUtlProcHarqInd
1440 RguHarqStatusInd *hqStaInd,
1446 RlcDlRbCb *rlcRbCb; /* KW Control Block */
1447 RlcL2MeasTb *l2MeasTb = NULLP; /* Measurement TbCb */
1448 uint8_t lcIdx; /* Logical channel id index */
1449 uint8_t sduIndx; /* sdu index to out standing sdu list in rbCb */
1450 uint32_t numSdus; /* number of sdus in the outstanding sdu list */
1451 RlcOutStngSduInfo *outStngSduArr; /* Outstanding sdu list */
1454 uint32_t totlSduCnt = 0;
1456 uint8_t timeAddedFlag;
1458 volatile uint32_t startTime = 0;
1459 /*kw005.201 Code added for DL IP thruput measurement*/
1462 SStartTask(&startTime, PID_RLC_DLIP_TPT_PRCHARQIND);
1465 if(hqStaInd->tbId[tbIdx] >= RLC_INVALID_TBID)
1470 /* Find the L2 measurement tbCb to process DL Ip thruput*/
1471 l2MeasTb = ueCb->l2MeasTbCb[hqStaInd->tbId[tbIdx]];
1472 if(l2MeasTb == NULLP)
1476 /* For each logical channel in the tbCb, process
1477 * and get the DL IP thruput */
1478 ackTime = SGetTtiCount();
1479 for(lcIdx = 0; ((lcIdx < l2MeasTb->numLcId) && (lcIdx < RLC_MAX_ACTV_DRB)); lcIdx++)
1481 timeAddedFlag = FALSE;
1482 if((rlcRbCb = ueCb->lCh[l2MeasTb->sduInfo[lcIdx].lcId - 1].dlRbCb)
1487 /* fix for DL IP stop*/
1488 if (!gCb->u.dlCb->rlcL2Cb.measOn[rlcRbCb->qci]
1489 || (rlcRbCb->rlcId.rbType == CM_LTE_SRB))
1494 /* Get the outstanding SDUs using sdu index stored in Container sduList
1495 * and check for HARQ ACK/NACK */
1496 numSdus = l2MeasTb->sduInfo[lcIdx].numSdus;
1498 if ((numSdus >= RLC_L2MEAS_MAX_OUTSTNGSDU) || (numSdus == 0))
1502 totlSduCnt += numSdus;
1504 if (RLC_MEAS_IS_DL_IP_MEAS_ON_FOR_RB(gCb,rlcRbCb))
1506 for(sduIndx = 0; sduIndx < numSdus; sduIndx++)
1508 outStngSduArr =&(rlcRbCb->l2MeasIpThruput.dlIpTh.outStngSduArr[\
1509 l2MeasTb->sduInfo[lcIdx].sduIdx[sduIndx]]);
1510 if(hqStaInd->status[tbIdx] == TRUE)
1512 /* If ACK is for burst End Sdu Id set burstActive
1513 * to FALSE and accumulate time */
1514 if((rlcRbCb->l2MeasIpThruput.dlIpTh.burstEndSduId ==
1515 outStngSduArr->sduId) && (outStngSduArr->numTb == 1))
1517 rlcRbCb->l2MeasIpThruput.dlIpTh.isBurstAct = FALSE;
1518 /*Update the l2Sts structure for calculating throughput*/
1519 rlcRbCb->rbL2Cb.l2Sts[RLC_L2MEAS_DL_IP]->dlIpThruput.volSummation
1520 += outStngSduArr->sduLen;
1522 rlcRbCb->rbL2Cb.l2Sts[RLC_L2MEAS_DL_IP]->dlIpThruput.timeSummation
1523 += glblTtiCnt - rlcRbCb->l2MeasIpThruput.dlIpTh.burstStartTime;
1524 outStngSduArr->sduId = 0;
1525 outStngSduArr->sduLen = 0;
1526 outStngSduArr->numTb = 0;
1527 rlcRbCb->l2MeasIpThruput.dlIpTh.burstEndSduId = 0;
1530 /* If burst is active and this sdu is only transmitted in single TB then
1531 * accumulate volume and clear the outstanding sduList */
1532 if((rlcRbCb->l2MeasIpThruput.dlIpTh.isBurstAct == TRUE) &&
1533 (--(outStngSduArr->numTb) == 0))
1535 rlcRbCb->rbL2Cb.l2Sts[RLC_L2MEAS_DL_IP]->dlIpThruput.volSummation
1536 += outStngSduArr->sduLen;
1538 if(timeAddedFlag == FALSE)
1540 rlcRbCb->rbL2Cb.l2Sts[RLC_L2MEAS_DL_IP]->dlIpThruput.timeSummation
1541 += glblTtiCnt - rlcRbCb->l2MeasIpThruput.dlIpTh.burstStartTime;
1542 rlcRbCb->l2MeasIpThruput.dlIpTh.burstStartTime = glblTtiCnt;
1543 timeAddedFlag = TRUE;
1545 outStngSduArr->sduId = 0;
1546 outStngSduArr->sduLen = 0;
1548 }/* End of status == TRUE */
1551 if(rlcRbCb->l2MeasIpThruput.dlIpTh.isBurstAct == TRUE)
1553 if((rlcRbCb->l2MeasIpThruput.dlIpTh.burstEndSduId ==
1554 outStngSduArr->sduId))
1556 rlcRbCb->l2MeasIpThruput.dlIpTh.isBurstAct = FALSE;
1557 rlcRbCb->l2MeasIpThruput.dlIpTh.burstEndSduId = 0;
1559 /* Clear the outstanding sdu list */
1560 outStngSduArr->sduId = 0;
1561 outStngSduArr->sduLen = 0;
1562 outStngSduArr->numTb = 0;
1569 for(lcIdx = 0; ((lcIdx < l2MeasTb->numLchInfo) && (lcIdx < RLC_MAX_ACTV_DRB)); lcIdx++)
1571 if((rlcRbCb = ueCb->lCh[l2MeasTb->lchInfo[lcIdx].lcId - 1].dlRbCb)
1576 numSdus = l2MeasTb->lchInfo[lcIdx].numSdus;
1582 if ((numSdus > RLC_L2MEAS_MAX_OUTSTNGSDU) || (numSdus == 0))
1587 if(hqStaInd->status[tbIdx] == TRUE)
1589 for(sduIndx = 0; sduIndx < numSdus; sduIndx++)
1591 delay = RLC_TIME_DIFF(ackTime,l2MeasTb->lchInfo[lcIdx].sduInfo[sduIndx].arvlTime);
1592 RLC_UPD_PDCP_L2_DLDELAY_STS(gCb,rlcRbCb, delay);
1594 /* Case of sduInfo not updated */
1595 if (totlSduCnt == 0)
1597 totlSduCnt = numSdus;
1599 RLC_UPD_L2_UU_LOSS_POS_PKTS(gCb,rlcRbCb, (totlSduCnt + l2MeasTb->txSegSduCnt));
1603 /* Case of sduInfo not updated */
1604 if (totlSduCnt == 0)
1606 totlSduCnt = numSdus;
1608 RLC_UPD_L2_UU_LOSS_PKTS(gCb,rlcRbCb, (totlSduCnt + l2MeasTb->txSegSduCnt));
1611 /* Free this tb, deallocate the memory */
1612 RLC_FREE(gCb, l2MeasTb, sizeof(RlcL2MeasTb));
1613 ueCb->l2MeasTbCb[hqStaInd->tbId[tbIdx]] = NULLP;
1616 SStopTask(startTime, PID_RLC_DLIP_TPT_PRCHARQIND);
1619 }/* end of rlcUtlProcHarqInd */
1623 * @brief Handler for Sending L2 Measurement confirm.
1627 * This function sends a consolidates the mesaurements taken during
1628 * this time and sends the confirm .
1630 * @param[in] measEvtCb Measurement Event Control Block.
1637 S16 rlcUtlSndDlL2MeasCfm(RlcCb *gCb,RlcL2MeasEvtCb *measEvtCb)
1640 RlcL2MeasCb *measCb = NULLP;
1641 RlcL2MeasCfmEvt measCfmEvt;
1647 /* Discard new changes starts */
1650 /* Discard new changes ends */
1652 /* kw006.201 ccpu00120058 emoved 64 bit compilation warning */
1654 DU_LOG("\nDEBUG --> RLC_DL : rlcUtlSndL2MeasCfm(transId(%ld))", measEvtCb->transId);
1656 DU_LOG("\nDEBUG --> RLC_DL : rlcUtlSndL2MeasCfm(transId(%d))", measEvtCb->transId);
1659 /* Clean up the RB data structures */
1660 measCb = &measEvtCb->measCb;
1662 memset(&measCfmEvt, 0, sizeof(RlcL2MeasCfmEvt));
1663 measCfmEvt.transId = measEvtCb->transId;
1665 measCfmEvt.measType = measCb->measType;
1666 measCfmEvt.status.status = LCM_PRIM_OK;
1667 measCfmEvt.status.reason = LCM_REASON_NOT_APPL;
1669 if(measCb->measType & LKW_L2MEAS_DL_IP)
1671 RlcL2MeasCbUeMeasInfo *pUeInfoLstCb = measCb->val.ipThMeas.ueInfoLst;
1672 RlcL2MeasCfmUeInfoLst *pUeInfoLstCfm = measCfmEvt.val.ipThMeas.ueInfoLst;
1674 for(cntr = 0;(cntr < measCb->val.ipThMeas.numUes) && (cntr < gCb->genCfg.maxUe);cntr++)
1676 pUeInfoLstCfm[cfmIdx].numCfm = 0;
1677 if (pUeInfoLstCb[cntr].isValid == TRUE)
1679 pUeInfoLstCfm[cfmIdx].ueId = pUeInfoLstCb[cntr].ueId;
1680 pUeInfoLstCfm[cfmIdx].cellId = pUeInfoLstCb[cntr].cellId;
1681 for(qciIdx = 0; qciIdx < pUeInfoLstCb[cntr].numQci; qciIdx++)
1683 qci = pUeInfoLstCb[cntr].qci[qciIdx];
1684 pUeInfoLstCfm[cfmIdx].measCfm[pUeInfoLstCfm[cfmIdx].numCfm].qci = qci;
1686 dlDataVol = pUeInfoLstCb[cntr].measData[qci].dlIpThruput.volSummation;
1687 dlTime = pUeInfoLstCb[cntr].measData[qci].dlIpThruput.timeSummation;
1689 if((0 == dlTime) || !(gCb->u.dlCb->rlcL2Cb.measOn[qci] & LKW_L2MEAS_DL_IP) )
1691 pUeInfoLstCfm[cfmIdx].measCfm[pUeInfoLstCfm[cfmIdx].numCfm].val.ipThrput.dlIpThPut = 0;
1695 pUeInfoLstCfm[cfmIdx].measCfm[pUeInfoLstCfm[cfmIdx].numCfm].val.ipThrput.dlIpThPut =
1696 (dlDataVol / dlTime);
1698 pUeInfoLstCfm[cfmIdx].measCfm[pUeInfoLstCfm[cfmIdx].numCfm].val.ipThrput.dlIpThPut *= 8;
1700 /* Reset the values after reporting to Application */
1701 pUeInfoLstCb[cntr].measData[qci].dlIpThruput.volSummation = 0;
1702 pUeInfoLstCb[cntr].measData[qci].dlIpThruput.timeSummation = 0;
1704 measCfmEvt.val.ipThMeas.ueInfoLst[cfmIdx].numCfm++;
1709 measCfmEvt.val.ipThMeas.numUes = cfmIdx;
1713 RlcL2Cntr *pMeasData = measCb->val.nonIpThMeas.measData;
1714 RlcL2MeasCfmNonIpThMeas *pMeasCfmNonIp = &measCfmEvt.val.nonIpThMeas;
1716 pMeasCfmNonIp->numCfm = 0;
1718 for(qciIdx = 0; qciIdx < LKW_MAX_QCI; qciIdx++)
1720 qci = measCb->val.nonIpThMeas.qci[qciIdx];
1723 pMeasCfmNonIp->measCfm[pMeasCfmNonIp->numCfm].qci = qci;
1725 if(measCb->measType & LKW_L2MEAS_UU_LOSS)
1727 dLoss = pMeasData[qci].uuLoss.dLoss;
1728 posPkts = pMeasData[qci].uuLoss.posPkts;
1729 if(((posPkts + dLoss) != 0))
1731 pMeasCfmNonIp->measCfm[pMeasCfmNonIp->numCfm].val.nonIpThrput.uuLoss =
1732 ((dLoss * 1000000) / (posPkts + dLoss));
1734 pMeasData[qci].uuLoss.dLoss = 0;
1735 pMeasData[qci].uuLoss.posPkts = 0;
1737 if(measCb->measType & LKW_L2MEAS_DL_DISC)
1740 pMeasCfmNonIp->measCfm[pMeasCfmNonIp->numCfm].val.nonIpThrput.dlDiscRate = 0;
1741 if(pMeasData[qci].dlDisc.totSdus != 0)
1743 pMeasCfmNonIp->measCfm[pMeasCfmNonIp->numCfm].val.nonIpThrput.dlDiscRate =
1744 (((pMeasData[qci].dlDisc.discSdus) * 1000000) / (pMeasData[qci].dlDisc.totSdus));
1747 pMeasData[qci].dlDisc.totSdus = 0;
1748 pMeasData[qci].dlDisc.discSdus = 0;
1750 if(measCb->measType & LKW_L2MEAS_DL_DELAY)
1752 if (pMeasData[qci].dlPjSduDelay.numSdus > 0)
1754 pMeasCfmNonIp->measCfm[pMeasCfmNonIp->numCfm].val.nonIpThrput.dlSduDelay =
1755 (pMeasData[qci].dlPjSduDelay.sduDelay / pMeasData[qci].dlPjSduDelay.numSdus);
1756 pMeasData[qci].dlPjSduDelay.sduDelay = 0;
1757 pMeasData[qci].dlPjSduDelay.numSdus = 0;
1760 pMeasCfmNonIp->numCfm++;
1764 /* Fix Klock warning */
1765 RlcMiLkwL2MeasCfm(&gCb->genCfg.lmPst, &measCfmEvt);
1767 } /* rlcUtlSndL2MeasCfm */
1770 * @brief Handler for Sending Negative confirm .
1774 * This function is called when the l2 measurement cannot be started
1775 * This function sends negative confirm for all the requests
1777 * @param[in] measReqEvt Measurement Req Structure
1784 S16 rlcUtlSndDlL2MeasNCfm(RlcCb *gCb,RlcL2MeasReqEvt *measReqEvt,RlcL2MeasCfmEvt *measCfmEvt)
1787 RlcMiLkwL2MeasCfm(&gCb->genCfg.lmPst, measCfmEvt);
1789 } /* kwUtlSndL2MeasNCfm */
1792 * @brief Handler for resetting the RB data structures
1796 * This function resets the RB data structure after the expiry of
1797 * measurement timer.
1799 * @param[in] measCb Measurement Control Block.
1805 Void rlcUtlResetDlL2MeasInRlcRb(RlcCb *gCb,RlcL2MeasCb *measCb,uint8_t measType)
1809 RlcDlUeCb *ueCb = NULL;
1813 if (measCb->measType & LKW_L2MEAS_DL_IP)
1815 for(ueIdx = 0; ueIdx < measCb->val.ipThMeas.numUes; ueIdx++)
1817 if (measCb->val.ipThMeas.ueInfoLst[ueIdx].isValid == TRUE)
1819 for (qciIdx =0; qciIdx < measCb->val.ipThMeas.ueInfoLst[ueIdx].numQci; qciIdx++)
1821 if (measType & LKW_L2MEAS_DL_IP)
1823 measCb->val.ipThMeas.ueInfoLst[ueIdx].measData[qciIdx].dlIpThruput.volSummation = 0;
1824 measCb->val.ipThMeas.ueInfoLst[ueIdx].measData[qciIdx].dlIpThruput.timeSummation = 0;
1825 gCb->u.dlCb->rlcL2Cb.measOn[qciIdx] &= ~measType;
1829 if(ROK != rlcDbmFetchDlUeCb(gCb,measCb->val.ipThMeas.ueInfoLst[ueIdx].ueId,
1830 measCb->val.ipThMeas.ueInfoLst[ueIdx].cellId, &ueCb))
1840 /* for now the only meas should be DL discard in this case */
1841 if (measCb->measType & LKW_L2MEAS_DL_DISC)
1844 for(i = 0; i < measCb->val.nonIpThMeas.numQci; i++)
1846 uint8_t qciVal = measCb->val.nonIpThMeas.qci[i];
1848 measCb->val.nonIpThMeas.measData[qciVal].dlDisc.discSdus = 0;
1849 measCb->val.nonIpThMeas.measData[qciVal].dlDisc.totSdus = 0;
1853 if (measCb->measType & LKW_L2MEAS_DL_DELAY)
1856 for(i = 0; i < measCb->val.nonIpThMeas.numQci; i++)
1858 uint8_t qciVal = measCb->val.nonIpThMeas.qci[i];
1860 measCb->val.nonIpThMeas.measData[qciVal].dlPjSduDelay.sduDelay = 0;
1863 measCb->val.nonIpThMeas.numQci = 0;
1865 } /* rlcUtlResetDlL2MeasInRlcRb */
1868 static Void dumpRLCDlRbInformation(RlcDlRbCb* dlRbCb)
1870 if(dlRbCb->mode == RLC_MODE_UM)
1872 DU_LOG("\nDEBUG --> RLC_DL : UM Downlink UEID:%d CELLID:%d Q size = %d",
1874 dlRbCb->rlcId.cellId,
1875 (int)dlRbCb->m.umDl.sduQ.count);
1877 else if(dlRbCb->mode == RLC_MODE_AM)
1879 uint32_t j, numTxPdus=0;
1880 for(j = 0; j <= (RLC_AM_GET_WIN_SZ(dlRbCb->m.amDl.snLen)); j++)
1882 RlcTx *txBuf = rlcUtlGetTxBuf(dlRbCb->m.amDl.txBufLst, j);
1888 DU_LOG("\nDEBUG --> RLC_DL : AM Downlink UEID:%d CELLID:%d Sizes SDU Q = %d TX Q = %d ",
1890 dlRbCb->rlcId.cellId,
1891 (int)dlRbCb->m.amDl.sduQ.count,
1893 DU_LOG("\nDEBUG --> RLC_DL : AM Downlink UEID:%d CELLID:%d RETX Q= %d",
1895 dlRbCb->rlcId.cellId,
1896 (int)dlRbCb->m.amDl.retxLst.count);
1900 Void DumpRLCDlDebugInformation(Void)
1902 RlcCb* dlInst = rlcCb[1]; /* TODO : Check whether DL is 0 or 1 */
1904 RlcDlCb *dlCb = dlInst->u.dlCb;
1906 RlcDlUeCb *ueCb = NULLP;
1907 RTLIN_DUMP_DEBUG("RLC Information\n");
1908 RTLIN_DUMP_DEBUG("===============\n");
1909 /* Until no more ueCb is ueLstCp hash list get and delete ueCb */
1910 while (ROK == cmHashListGetNext(&dlCb->ueLstCp,
1915 for(i = 0; i< RLC_MAX_SRB_PER_UE; i++)
1917 RlcDlRbCb* dlRbCb = ueCb->srbCb[i];
1918 if( dlRbCb != NULLP)
1920 dumpRLCDlRbInformation(dlRbCb);
1923 for(i = 0; i< RLC_MAX_DRB_PER_UE; i++)
1925 RlcDlRbCb* dlRbCb = ueCb->drbCb[i];
1926 if( dlRbCb != NULLP)
1928 dumpRLCDlRbInformation(dlRbCb);
1933 RlcDlDataToBeFreed* pToBeFreed = &dlCb->toBeFreed;
1935 RTLIN_DUMP_DEBUG("toBeFreed RETX list size = %d\n",(int)pToBeFreed->reTxLst.count);
1936 RTLIN_DUMP_DEBUG("toBeFreed TX list size = %d\n",(int)pToBeFreed->txLst.count);
1937 RTLIN_DUMP_DEBUG("toBeFreed SDU list size = %d\n",(int)pToBeFreed->sduLst.count);
1938 RTLIN_DUMP_DEBUG("toBeFreed RB list size = %d\n",(int)pToBeFreed->rbLst.count);
1944 * This function frees downlink memory
1952 void rlcUtlFreeDlMem( Void)
1954 rlcUtlFreeDlMemory(RLC_GET_RLCCB(RLC_DL_INST));
1960 * This function returns current time
1962 * @param[in] uint32_t
1968 void rlcUtlGetCurrTime(uint32_t *currTime)
1970 /* Need t define else part for PAL */
1971 *currTime = SGetTtiCount();
1974 #if defined(MAC_RLC_HARQ_STA_RBUF) || defined (SS_RBUF)
1976 void rlcUtlDlBatchProcHqStaInd( Void)
1978 /* Read from Ring Buffer and process PDCP packets */
1981 Void *elmIndx = NULLP;
1982 RguHarqStaInd *staInd = NULLP;
1984 #if defined(MAC_RLC_HARQ_STA_RBUF) && defined(LTE_L2_MEAS)
1985 isDatReqProcessed = TRUE;
1987 elmIndx = (Void *)SRngGetRIndx(SS_RNG_BUF_MAC_HARQ);
1988 while(NULLP != elmIndx)
1990 staInd = (RguHarqStaInd *)elmIndx;
1991 RlcLiRguHqStaInd(&(staInd->pst), 0, &(staInd->hqStatusInd));
1995 SRngIncrRIndx(SS_RNG_BUF_MAC_HARQ);
1997 if((elmIndx = (Void *)SRngGetRIndx(SS_RNG_BUF_MAC_HARQ)) == NULLP)
1999 #if defined(MAC_RLC_HARQ_STA_RBUF) && defined(LTE_L2_MEAS)
2000 isDatReqProcessed = FALSE;
2010 * @brief evaluate and trigger PDB based flow control to PDCP
2014 * @param[in] rbCb RB control block
2020 Void rlcUtlTrigPdbFlowCntrl(RlcCb *gCb,RlcDlRbCb *rbCb,uint32_t pktAdmitCnt)
2022 KwuFlowCntrlIndInfo *flowCntrlInfo;
2023 RlcKwuSapCb* rlckwuSap;
2025 rlckwuSap = gCb->u.dlCb->rlcKwuDlSap + RLC_UI_PDCP;
2027 RLC_SHRABL_STATIC_BUF_ALLOC(rlckwuSap->pst.region,
2028 rlckwuSap->pst.pool,
2030 sizeof(KwuFlowCntrlIndInfo));
2031 flowCntrlInfo->rlcId = rbCb->rlcId;
2032 flowCntrlInfo->pktAdmitCnt = pktAdmitCnt;
2033 RlcUiKwuFlowCntrlInd(&rlckwuSap->pst, rlckwuSap->suId, flowCntrlInfo);
2038 * @brief Store the DL buffer in hashList
2043 * Use the SN % binSize as key and store the received UL buffer
2044 * @param[in] txBufLst List CP array
2045 * @param[in] txBuf transmitted buffer
2046 * @param[in] sn sn of the received buffer
2051 void rlcUtlStoreTxBuf(CmLListCp *txBufLst, RlcTx *txBuf, RlcSn sn)
2055 hashKey = (sn % RLC_TX_BUF_BIN_SIZE );
2057 txBuf->lnk.node = (PTR)txBuf;
2058 cmLListAdd2Tail(&(txBufLst[hashKey]), &txBuf->lnk);
2061 } /* rlcUtlStoreRecBuf */
2065 * @brief Retrieve the DL buffer from the list
2070 * Use the SN % binSize as key and retrieve the DL buffer
2071 * @param[in] txBufLst List CP array
2072 * @param[in] sn sn of the transmitted buffer
2077 RlcTx* rlcUtlGetTxBuf(CmLListCp *txBufLst, RlcSn sn)
2080 CmLListCp *txBufLstCp;
2082 CmLList *node = NULLP;
2084 hashKey = (sn % RLC_TX_BUF_BIN_SIZE );
2086 txBufLstCp = &txBufLst[hashKey];
2087 CM_LLIST_FIRST_NODE(txBufLstCp, node);
2090 txBuf = (RlcTx *) node->node;
2095 CM_LLIST_NEXT_NODE(txBufLstCp, node);
2098 } /* rlcUtlStoreTxBuf */
2101 * @brief Delete the DL buffer from the list
2106 * Use the SN % binSize as key and retrieve the DL buffer
2107 * @param[in] txBufLst List CP array
2108 * @param[in] sn sn of the transmitted bffer
2113 Void rlcUtlDelTxBuf (CmLListCp *txBufLst,RlcTx *txBuf,RlcCb *gCb)
2116 CmLListCp *txBufLstCp;
2118 hashKey = (txBuf->sn % RLC_TX_BUF_BIN_SIZE );
2120 txBufLstCp = &txBufLst[hashKey];
2121 //DU_LOG("\nINFO --> RLC_DL : D-sn(%d)\n", txBuf->hdr.sn);
2122 cmLListDelFrm(txBufLstCp, &txBuf->lnk);
2123 RLC_FREE(gCb, txBuf, sizeof(RlcTx));
2125 } /* rlcUtlDelTxBuf */
2129 * @brief Remove the DL buffer from the list
2134 * Use the SN % binSize as key and retrieve the DL buffer
2135 * @param[in] txBufLst List CP array
2136 * @param[in] sn sn of the transmitted bffer
2141 Void rlcUtlRemovTxBuf(CmLListCp *txBufLst,RlcTx *txBuf,RlcCb *gCb)
2144 CmLListCp *txBufLstCp;
2146 hashKey = (txBuf->sn % RLC_TX_BUF_BIN_SIZE );
2148 txBufLstCp = &txBufLst[hashKey];
2149 //DU_LOG("\nINFO --> RLC_DL : D-sn(%d)\n", txBuf->hdr.sn);
2150 cmLListDelFrm(txBufLstCp, &txBuf->lnk);
2152 } /* rlcUtlRemovTxBuf */
2156 /********************************************************************30**
2158 **********************************************************************/