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: LTE RLC file for uplink and non real time tasks
25 Desc: This file contains all the data structures and
26 prototypes for LTE RLC in the uplink.
30 *********************************************************************21*/
33 * @brief RLC uplink structures, prototypes
41 #endif /* __cplusplus */
43 typedef struct rlcUlUeCb RlcUlUeCb;
46 * @brief Structure to hold a RLC UM PDU segment
49 * - lstEnt : This is required for the linked list in which the segments
51 * - seg : Holds the segment data
52 * - segSz : The length of the segment in bytes
54 * - umHdr : The UM Header for the PDU segment
57 typedef struct rlcUmSeg
59 CmLList lstEnt; /*!< List entry for PDU segment */
60 Buffer *seg; /*!< PDU segment */
61 MsgLen segSz; /*!< Buffer Size */
62 uint16_t soEnd; /*!< Segment Offset End */
63 RlcUmHdr umHdr; /*!<Um Header */
67 * @brief Structure to hold a UM PDU
70 * - pdu : Buffer holding the UM PDU data
71 * - umHdr : UM PDU Header Information
72 * - pduSz : Length of the PDU excluding the header
74 typedef struct rlcUmRecBuf
76 RlcSn sn; /*!< Sequence Number */
77 CmLList lnk; /*!< Link to the receive buffer list */
78 Bool allSegRcvd; /*!< Flag to check whether all seg are received */
79 Bool noMissingSeg; /*!< Flag to check all the bytes are received before the last byte of segment */
80 CmLListCp segLst; /*!< PDU Segments list */
81 uint16_t expSo; /*!< Next expected seg offset */
82 Bool allRcvd; /*!< All bytes received or not */
83 RlcUmSeg *expByteSeg; /*!< Next expected byte segment */
84 Buffer *pdu; /**< Buffer holding the UM PDU */
85 RlcUmHdr umHdr; /**< UM PDU Header Information */
86 MsgLen pduSz; /**< PDU Size */
90 * @brief Structure to hold uplink information in UM mode for a particular RB
93 * - snLen : The sequence number length can be 5 bits or 10 bits.
94 * Here it is stored as 1 or 2 (as the number of bytes)
95 * - recBuf : Holds all the received PDUs. PDU's are removed from this
96 * after a SDU is formed or during restablishment
97 * - umWinSz : The window size is 512 for 10 bits sequence number and 16
98 * for 5 bits sequence number
99 * - partialSdu : This is used to store the partially completed SDU.
100 * It remains till complete SDU is received
102 typedef struct rlcUmUl
104 uint8_t snLen; /**< Sequence number length */
105 uint8_t reAsmblTmrInt; /**< Timer Interval */
106 CmLListCp *recBufLst; /**!<Reception Buffer List */
107 RlcSn umWinSz; /**< UM window size */
108 uint16_t modBitMask; /**< Bitmask for modulus to wrap around variables */
109 RlcSn sn; /**< Sequence number */
110 RlcSn vrUr; /**< VR(UR) - Receive state variable */
111 RlcSn vrUh; /**< VR(UH) - Highest received state variable */
112 RlcSn vrUx; /**< VR(UX) - Reordering state variable */
113 CmTimer reAsmblTmr; /**< Reordering Timer */
114 Buffer *assembleSdu; /**< Assemble Sdu - Remains till the complete SDU is received */
115 uint16_t expSo; /*!< Expected SO for reassembly */
116 RlcSn expSn; /*!< Expected Sn */
121 * @brief Structure to hold a RLC AM PDU segment
124 * - lstEnt : This is required for the linked list in which the segments
126 * - seg : Holds the segment data
127 * - segSz : The length of the segment in bytes
129 * - amHdr : The AM Header for the PDU segment
132 typedef struct rlcSeg
134 CmLList lstEnt; /**< List entry for PDU segment */
135 Buffer *seg; /**< PDU segment */
136 MsgLen segSz; /**< Buffer Size */
137 uint16_t soEnd; /**< Segment Offset End */
138 RlcAmHdr amHdr; /**< AM header */
144 * @brief Structure to hold a received AM PDU or segments of a PDU
147 * - pdu : Holds the PDU data
148 * - pduSz : Length of the PDU in bytes
149 * - amHdr : The AM Header for the PDU
150 * - segLst : The length of the segment in bytes
151 * - expByteSeg : The next expected segment for re-ordering
152 * - expSo : The next expected SO so to be in sequence
153 * - allRcvd : Whether all the segments for this PDU has been recevied
156 typedef struct rlcAmRecBuf
158 CmLList lnk; /**< Link to the receive buffer list */
159 Buffer *pdu; /**< PDU buffer */
160 MsgLen pduSz; /**< Buffer Size */
161 RlcAmHdr amHdr; /**< AM header Info */
162 CmLListCp segLst; /**< PDU Segments list */
163 RlcSeg *expByteSeg; /**< Next expected byte segment */
164 uint16_t expSo; /**< Next expected seg offset */
165 Bool allRcvd; /**< All bytes received or not */
166 Bool isDelvUpperLayer; /**< Is it sent to upper layer */
169 /** @addtogroup ammode */
173 * @brief Structure to hold information about an uplink AM Radio Bearer
176 * - recBuf : Reception buffer
177 * - rxNext : RX_Next - Receive state variable
178 * - rxNextHighestRcvd : RX_Next_Highest_Rcvd - Highest received state variable
179 * - rxNextStatusTrig : RX_Next_Status_Trigger - reorderig state variable
180 * - vrMr : VR(MR) - Maximum acceptable receive state variable
181 * - rxHighestStatus : RX_Highest_Status - Maximum STATUS transmit state variable
182 * - staTrg : Flag to indicate if status trigger occured
183 * - partialSdu : Partial SDU - Remains till the complete SDU
185 * - expSn : The expected sequence number for reassembly
186 * - expSo : The expected SO for reassembly
187 * - staProhTmr : The Status Probihit Timer
188 * - staProhTmrInt : Status Prohibit Timer interval (in ??)
189 * - reOrdTmr : The Reordering Timer
190 * - reOrdTmrInt : Re-ordering timer interval
191 * - gatherStaPduInfo : Whether to gather information required to create
195 typedef struct rlcAmUl
198 CmLListCp *recBufLst;
200 // RlcAmRecBuf *recBuf[1024]; /**< Reception buffer */
202 RlcSn rxNext; /**< RX_Next:Equvalent to VR(R) in 4G */
203 RlcSn rxNextHighestRcvd; /**< RX_Next_Highest_Rcvd: Equvalent to VR(H) in 4G */
204 RlcSn rxNextStatusTrig; /**< rxNextStatusTrig: Equvalent to VR(X) in 4G*/
205 RlcSn vrMr; /**< VR(MR) */
206 RlcSn rxHighestStatus; /**< rxHighestStatus: Eqvalent to VR(MS) in 4G*/
207 Bool staTrg; /**< Whether status trigger occured */
208 Buffer *partialSdu; /**< Partially received SDU */
209 RlcSn expSn; /**< Expected SN for reassembly */
210 uint16_t expSo; /**< Expected SO for reassembly */
211 CmTimer staProhTmr; /**< T_status_prohibit Timer */
212 uint16_t staProhTmrInt; /**< Timer Interval */
213 CmTimer reOrdTmr; /**< T_reordering Timer */
214 uint8_t reOrdTmrInt; /**< Timer Interval */
215 Bool gatherStaPduInfo; /**< Gather STATUS PDU creation info*/
216 Bool isOutOfSeq; /**< To identify whether packets are Out-Of-Seq or not */
217 uint8_t snLen; /*!< Sequence number length:12 bit or 18 bit : 5GNR RLC */
218 uint32_t snModMask; /*!< (2 Pwr SnLen - 1): 5GNR RLC */
224 * @brief Structure to hold uplink information about a Radio Bearer
227 * - rlcId : RLC identifier, uniquely identifies a Radio Bearer
228 * - lch : Information (type and id) of the logical channel associated
229 * with this Radio Bearer.
230 * - mode : The mode of the Radio Bearer; UM or AM
231 * - dir : The direction of the Radio Bearer, downlink or uplink or both
232 * - inst : Id of RLC instance where this Radio Bearer is present. Used
233 * to find the instance from the Radio Bearer for memory needs
234 * as different instances might have different memory.
235 * - k1wuSapId : KWU SAP identifier
236 * - udxSapId : UDX SAP idenrifier
237 * - transId : Stores the transaction identifier used to communicate
238 * with MAC, the same value as sent by MAC is passed back
239 * for it to be able to corelate
240 * - m : Mode of the RB (TM/UM/AM)
241 * - umDl : Unacknowledged Mode downlink information
242 * - amDl : Acknowledged Mode downlink information
244 typedef struct _rlcUlRbCb
246 /* kw005.201 added support for L2 Measurement */
248 RlcL2MeasRbCb rbL2Cb; /**< RB measurement L2 Cb */
249 RlcUlUeCb *ueCb; /*!< Pointer to UeCb */
250 uint8_t qci; /**< qci of the RB */
251 RlcL2MeasIpThruput l2MeasIpThruput; /**< Holds related parameter for
252 DL/Ul ip throughput>*/
253 #endif /* LTE_L2_MEAS */
254 CmLteRlcId rlcId; /**< RLC Identifier */
255 RlcLchInfo lch; /**< Logical Channel Info */
256 CmLteRlcMode mode; /**< Entity Mode */
257 uint8_t dir; /**< Direction for UL/DL */
258 Inst inst; /**< Tapa where Rb created Instance id */
259 SpId k1wuSapId; /**< KWU sap Id, to get the KwuSapCb */
260 SpId udxSapId; /**< KWU sap Id, to get the KwuSapCb */
261 uint32_t transId; /**< Transaction Id for RLC */
264 RlcUmUl umUl; /**< UM mode Ul elements */
265 RlcAmUl amUl; /**< AM mode uplink elements */
266 }m; /**< RLC mode specific Info */
270 * @brief Structure to hold mapping between logical channel and Radio Bearer
273 * - ulRbCb : Pointer to the uplink Radio Bearer
275 typedef struct rlcUlLch
277 RlcUlRbCb *ulRbCb; /**< Pointer to Uplink RbCb */
281 * @brief Structure to hold uplink information about the Cells
284 * - cellHlEnt : Information about cells are stored in a hash table. This is
286 * - cellId : Identity of the cell
287 * - rbCb : Radio Bearers in the cell
288 * - lCh : Logical Channels in the cell
289 * - selfPstUl : Pst structure for sending messages to self
291 typedef struct rlcUlCellCb
293 CmHashListEnt cellHlEnt; /**< Hash list entry for CellCb */
294 CmLteCellId cellId; /**< Cell Id */
295 RlcUlRbCb *rbCb[RLC_MAX_RB_PER_CELL]; /**< RbCbs within a Cell */
296 RlcUlLch lCh[RLC_MAX_LCH_PER_CELL]; /**< Logical channels in a cell */
301 * @brief Structure to hold uplink information about the UEs
304 * - ueHlEnt : Information about cells are stored in a hash table. This is
306 * - key : Key to store/find the UE in the hashtable
307 * - srbCb : Signaling Radio Bearers configured for the UE
308 * - drbCb : Data Radio Bearers configured for the UE
309 * - lCh : Logical Channels in the UE
313 CmHashListEnt ueHlEnt; /**< Hash list entry for UeCb */
314 CmLteRnti ueId; /*!< UE Id */
315 CmLteCellId cellId; /*!< Cell Id */
316 RlcUlRbCb *srbCb[RLC_MAX_SRB_PER_UE]; /**< SRB RbCbs within an UE */
317 RlcUlRbCb *drbCb[RLC_MAX_DRB_PER_UE]; /**< DRB RbCbs within an UE */
318 RlcUlLch lCh[RLC_MAX_LCH_PER_UE]; /**< Logical channels of an UE*/
319 /* kw005.201 added support for L2 Measurement */
321 uint32_t firstPacketTTI; /*!< is first packet of the burst */
322 uint16_t numActRb[LKW_MAX_QCI]; /**< number of RBs Active */
323 Bool isUlBurstActive; /*!<Has the Burst started for UL IP Thrpt meas */
324 #endif /* LTE_L2_MEAS */
328 * @brief Structure to hold temporary data of configuration
331 * - entUlCfgCfm : Holds the UL configuration status
334 typedef struct rlcUlEntTmpData
336 RlcEntCfgCfmInfo entUlCfgCfm; /**< Ul Configuration status*/
337 RlcUlRbCb *rbCb; /**< Rb Block */
341 * @brief Structure to hold transaction information in configuration request
344 * - transHlEnt : List entry for transaction block.
345 * - transId : Transaction Id
349 * - cellCb : Cell Block
350 * - cfgInfo : Configuration Information
351 * - ueInfo : UE Information
352 * - newUeInfo : New Ue Information
353 * - cfgTmpData : Temporary data per Configuration entity
355 typedef struct rlcUlCfgTmpData
357 CmHashListEnt transHlEnt; /**< List Entry of
359 uint32_t transId; /**< Locally generated Transaction Id */
360 uint32_t uprLyrTransId; /**< Transaction Id generated by upper layer.
361 This is used while sending confirm to the User Layer */
362 CmLteCellId cellId; /**< Cell Id */
363 CmLteRnti ueId; /**< Ue Id */
364 RlcUlUeCb *ueCb; /**< Ue Block */
365 RlcUlCellCb *cellCb; /**< Cell Block */
366 RlcCfgInfo *cfgInfo; /**< Config Information*/
367 CkwUeInfo *ueInfo; /**< Ue Information */
368 CkwUeInfo *newUeInfo; /**< New Ue Information */
369 RlcUlEntTmpData cfgEntData[CKW_MAX_ENT_CFG]; /**< Entity Data */
371 /****************************************************************************
373 ***************************************************************************/
374 /****************************************************************************
375 * Configuration Functions
376 ***************************************************************************/
378 S16 rlcValidateRbCfgParams ARGS ((RlcCb *gCb,
381 RlcEntCfgInfo *cfgToValidate,
383 S16 rlcCfgValidateUlRb ARGS (( RlcCb *gCb,
384 RlcEntCfgInfo *cfgToValidate,
385 RlcUlEntTmpData *cfgInfo,
386 RlcUlCfgTmpData *cfg));
388 S16 rlcCfgRollBackUlRb ARGS ((RlcCb *gCb,
390 RlcEntCfgInfo *cfgToValidate,
391 RlcUlEntTmpData *cfgTempData));
393 Void rlcCfgApplyUlRb ARGS ((RlcCb *gCb,
394 RlcEntCfgInfo *cfgToAply,
395 RlcUlEntTmpData *cfgTmpData,
396 RlcUlCfgTmpData *cfgTmpInfo));
398 S16 rlcCfgValidateReEstRb ARGS ((RlcCb *gCb,
401 RlcEntCfgInfo *cfgToValidate,
402 RlcUlEntTmpData *cfgTmpData));
404 Void rlcCfgApplyReEstUlRb ARGS ((RlcCb *gCb,
408 RlcUlEntTmpData *cfgTmpData));
410 Void rlcCfgApplyDelUlCell ARGS ((RlcCb *gCb,
411 RlcUlCfgTmpData *cfgTmpData));
413 S16 rlcCfgValidateDelUlCell ARGS ((RlcCb *gCb,
415 RlcEntCfgInfo *cfgToValidate,
416 RlcUlEntTmpData *cfgTmpData,
417 RlcUlCfgTmpData *cfgInfo));
419 S16 rlcCfgValidateDelUlUe ARGS ((RlcCb *gCb,
420 RlcEntCfgInfo *cfgToValidate,
421 RlcUlEntTmpData *cfgTmpData,
422 RlcUlCfgTmpData *cfgInfo));
424 Void rlcCfgApplyDelUlUe ARGS ((RlcCb *gCb,
425 RlcUlCfgTmpData *cfgTmpData));
427 Void rlcUlHdlCfgReq ARGS ((RlcCb *gCb,
428 RlcUlCfgTmpData *cfgInfo,
431 Void rlcCfgApplyUlUeIdChng ARGS ((RlcCb *gCb,
433 CkwUeInfo *newUeInfo,
434 RlcUlCfgTmpData *cfgTmpInfo));
436 S16 rlcCfgValidateUeIdChng ARGS ((RlcCb *gCb,
438 CkwUeInfo *newUeInfo,
439 RlcUlCfgTmpData *cfgTmpInfo));
441 /****************************************************************************
442 * DBM module Functions
443 ***************************************************************************/
444 S16 rlcDbmUlInit ARGS ((RlcCb *gCb));
446 Void rlcDbmUlDeInit ARGS ((RlcCb *gCb));
448 S16 rlcDbmAddUlUeCb ARGS ((RlcCb *gCb,
453 uint8_t rlcDbmFetchUlUeCb ARGS ((RlcCb *gCb,
458 Void rlcDbmDelUlUeCb ARGS ((RlcCb *gCb,
462 Void rlcDbmDelAllUlUe ARGS ((RlcCb *gCb));
464 S16 rlcDbmAddUlCellCb ARGS ((RlcCb *gCb,
466 RlcUlCellCb *cellCb));
468 Void rlcDbmFetchUlCellCb ARGS ((RlcCb *gCb,
470 RlcUlCellCb **cellCb));
472 Void rlcDbmDelUlCellCb ARGS ((RlcCb *gCb,
473 RlcUlCellCb *cellCb));
475 Void rlcDbmDelAllUlCell ARGS ((RlcCb *gCb));
477 Void rlcDbmFetchUlRbCbByRbId ARGS ((RlcCb *gCb,
481 Void rlcDbmFetchUlRbCbFromLchId ARGS ((RlcCb *gCb,
487 Void rlcDbmDelAllUlRb ARGS ((RlcCb *gCb,
491 S16 rlcDbmAddUlTransaction ARGS((RlcCb *gCb, RlcUlCfgTmpData *cfg));
493 S16 rlcDbmFindUlTransaction ARGS((RlcCb *gCb,
495 RlcUlCfgTmpData **cfg));
497 S16 rlcDbmDelUlTransaction ARGS((RlcCb *gCb, RlcUlCfgTmpData *cfg));
499 S16 rlcDbmDelAllUlTransactions ARGS((RlcCb *gCb));
501 Void rlcDbmUlShutdown ARGS ((RlcCb *gCb));
503 /****************************************************************************
504 * Transparent Mode Functions
505 ***************************************************************************/
507 void rlcTmmRcvFrmMac ARGS ((RlcCb *gCb,
513 void rlcTmmRcvFrmMac ARGS ((RlcCb *gCb,
518 Void rlcTmmUlReEstablish ARGS ((RlcCb *gCb, RlcUlRbCb *rbCb));
520 /****************************************************************************
521 * Unacknowledged Mode Functions
522 ***************************************************************************/
524 Void rlcUmmProcessPdus ARGS((RlcCb *gCb,
529 Void rlcUmmProcessPdus ARGS ((RlcCb *gCb,
531 KwPduInfo *pduInfo));
533 Void rlcUmmUlReEstablish ARGS ((RlcCb *gCb,
537 Void rlcUmmReAsmblTmrExp ARGS((RlcCb *gCb, RlcUlRbCb *rbCb));
540 Void rlcUmmFreeUlRbCb ARGS ((RlcCb *gCb, RlcUlRbCb *rbCb));
542 /****************************************************************************
543 * Acknowledged Mode Functions
544 ***************************************************************************/
545 Void rlcAmmUlReEstablish ARGS((RlcCb *gCb,
550 Void rlcAmmProcessPdus ARGS((RlcCb *gCb,
555 Void rlcAmmProcessPdus ARGS((RlcCb *gCb,
557 KwPduInfo *pduInfo));
560 Void rlcAmmReOrdTmrExp ARGS((RlcCb *gCb, RlcUlRbCb *rbCb));
562 Void rlcAmmStaProTmrExp ARGS((RlcCb *gCb, RlcUlRbCb *rbCb));
564 Void rlcAmmFreeUlRbCb ARGS ((RlcCb *gCb, RlcUlRbCb *rbCb));
566 /****************************************************************************
568 ***************************************************************************/
570 void rlcUtlStoreUmRecBuf ARGS ((CmLListCp *recBufLst,
574 RlcUmRecBuf* rlcUtlGetUmRecBuf ARGS ((CmLListCp *recBufLst,
577 void rlcUtlDelUmRecBuf(RlcCb *gCb, CmLListCp *recBufLst, RlcUmRecBuf *recBuf);
579 Void rlcUtlStoreRecBuf ARGS ((CmLListCp *recBufLst,
583 RlcAmRecBuf* rlcUtlGetRecBuf ARGS ((CmLListCp *recBufLst,
586 Void rlcUtlDelRecBuf ARGS ((CmLListCp *recBufLst,
591 uint8_t rlcUtlRcvFrmMac ARGS ((RlcCb *gCb, KwDatIndInfo *datIndInfo));
593 uint8_t rlcUtlSendUlDataToDu ARGS ((RlcCb *gCb,RlcUlRbCb *rbCb, Buffer *sdu));
596 S16 rlcUtlHdlL2TmrExp ARGS (( RlcCb *gCb, RlcL2MeasEvtCb *measEvtCb));
598 Void rlcUtlCalUlIpThrPutIncTTI ARGS ((RlcCb *gCb,
602 Void rlcUtlCalUlIpThrPut ARGS((RlcCb *gCb,
607 S16 rlcUtlSndUlL2MeasCfm ARGS ((RlcCb *gCb, RlcL2MeasEvtCb *measEvtCb));
609 S16 rlcUtlSndUlL2MeasNCfm ARGS ((RlcCb *gCb,
610 RlcL2MeasReqEvt *measReqEvt,
611 RlcL2MeasCfmEvt *measCfmEvt));
613 S16 rlcUtlL2MeasUlInit ARGS((RlcCb *gCb));
615 Void rlcUtlResetUlL2MeasInRlcRb ARGS((RlcCb *gCb,
619 S16 rlcUtlValidateIpThL2Meas ARGS ((RlcL2MeasReqEvt *measReqEvt,
620 RlcL2MeasCfmEvt *measCfmEvt));
622 #endif /* LTE_L2_MEAS */
623 /****************************************************************************
624 * Activation Functions
625 ***************************************************************************/
626 S16 rlcUlActvInit ARGS ((Ent ent,
631 S16 rlcUlActvTsk ARGS ((Pst *pst, Buffer *mBuf));
633 /****************************************************************************
635 ***************************************************************************/
636 Void DumpRLCUlDebugInformation ARGS((Void));
638 uint8_t rlcProcCommLcUlData(Pst *pst, SuId suId, RguCDatIndInfo *datInd);
639 uint8_t rlcProcDedLcUlData(Pst *pst, SuId suId, RguDDatIndInfo *datInd);
643 #endif /* __cplusplus */
645 #endif /* __KW_ULX__ */
648 /********************************************************************30**
651 **********************************************************************/