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 /**********************************************************************
21 Name: NR RLC file for uplink and non real time tasks
25 Desc: This file contains helper macros for RLC uplink
26 and non real time tasks
30 **********************************************************************/
33 * @brief RLC uplink helper macros
41 #endif /* __cplusplus */
44 * @def RLC_MEAS_IS_UL_IP_MEAS_ON_FOR_RB
46 * This macro is used to check if UL IP throughput measurement is ON
47 * or off for the passed rb
49 * Returns TRUE(non-zero) if measurement is ON else FALSE (zero)
51 * @param[in] _gCb RLC UL Cb
52 * @param[in] _rbCb RLC uplink control block
55 #define RLC_MEAS_IS_UL_IP_MEAS_ON_FOR_RB(_gCb, _rbCb) \
56 ((_rbCb->rlcId.rbType == CM_LTE_DRB) && \
57 (_gCb->u.ulCb->rlcL2Cb.measOn[_rbCb->qci] & LKW_L2MEAS_UL_IP) && \
58 (_rbCb->rbL2Cb.measOn & LKW_L2MEAS_UL_IP))
60 typedef struct rlcUlUeCb RlcUlUeCb;
63 * @brief Structure to hold a RLC UM PDU segment
66 * - lstEnt : This is required for the linked list in which the segments
68 * - seg : Holds the segment data
69 * - segSz : The length of the segment in bytes
71 * - umHdr : The UM Header for the PDU segment
74 typedef struct rlcUmSeg
76 CmLList lstEnt; /*!< List entry for PDU segment */
77 Buffer *seg; /*!< PDU segment */
78 MsgLen segSz; /*!< Buffer Size */
79 uint16_t soEnd; /*!< Segment Offset End */
80 RlcUmHdr umHdr; /*!<Um Header */
84 * @brief Structure to hold a UM PDU
87 * - pdu : Buffer holding the UM PDU data
88 * - umHdr : UM PDU Header Information
89 * - pduSz : Length of the PDU excluding the header
91 typedef struct rlcUmRecBuf
93 RlcSn sn; /*!< Sequence Number */
94 CmLList lnk; /*!< Link to the receive buffer list */
95 Bool allSegRcvd; /*!< Flag to check whether all seg are received */
96 Bool noMissingSeg; /*!< Flag to check all the bytes are received before the last byte of segment */
97 CmLListCp segLst; /*!< PDU Segments list */
98 uint16_t expSo; /*!< Next expected seg offset */
99 Bool allRcvd; /*!< All bytes received or not */
100 RlcUmSeg *expByteSeg; /*!< Next expected byte segment */
101 Buffer *pdu; /**< Buffer holding the UM PDU */
102 RlcUmHdr umHdr; /**< UM PDU Header Information */
103 MsgLen pduSz; /**< PDU Size */
107 * @brief Structure to hold uplink information in UM mode for a particular RB
110 * - snLen : The sequence number length can be 5 bits or 10 bits.
111 * Here it is stored as 1 or 2 (as the number of bytes)
112 * - recBuf : Holds all the received PDUs. PDU's are removed from this
113 * after a SDU is formed or during restablishment
114 * - umWinSz : The window size is 512 for 10 bits sequence number and 16
115 * for 5 bits sequence number
116 * - partialSdu : This is used to store the partially completed SDU.
117 * It remains till complete SDU is received
119 typedef struct rlcUmUl
121 uint8_t snLen; /**< Sequence number length */
122 uint8_t reAsmblTmrInt; /**< Timer Interval */
123 CmLListCp *recBufLst; /**!<Reception Buffer List */
124 RlcSn umWinSz; /**< UM window size */
125 uint16_t modBitMask; /**< Bitmask for modulus to wrap around variables */
126 RlcSn sn; /**< Sequence number */
127 RlcSn vrUr; /**< VR(UR) - Receive state variable */
128 RlcSn vrUh; /**< VR(UH) - Highest received state variable */
129 RlcSn vrUx; /**< VR(UX) - Reordering state variable */
130 CmTimer reAsmblTmr; /**< Reordering Timer */
131 Buffer *assembleSdu; /**< Assemble Sdu - Remains till the complete SDU is received */
132 uint16_t expSo; /*!< Expected SO for reassembly */
133 RlcSn expSn; /*!< Expected Sn */
138 * @brief Structure to hold a RLC AM PDU segment
141 * - lstEnt : This is required for the linked list in which the segments
143 * - seg : Holds the segment data
144 * - segSz : The length of the segment in bytes
146 * - amHdr : The AM Header for the PDU segment
149 typedef struct rlcSeg
151 CmLList lstEnt; /**< List entry for PDU segment */
152 Buffer *seg; /**< PDU segment */
153 MsgLen segSz; /**< Buffer Size */
154 uint16_t soEnd; /**< Segment Offset End */
155 RlcAmHdr amHdr; /**< AM header */
161 * @brief Structure to hold a received AM PDU or segments of a PDU
164 * - pdu : Holds the PDU data
165 * - pduSz : Length of the PDU in bytes
166 * - amHdr : The AM Header for the PDU
167 * - segLst : The length of the segment in bytes
168 * - expByteSeg : The next expected segment for re-ordering
169 * - expSo : The next expected SO so to be in sequence
170 * - allRcvd : Whether all the segments for this PDU has been recevied
173 typedef struct rlcAmRecBuf
175 CmLList lnk; /**< Link to the receive buffer list */
176 Buffer *pdu; /**< PDU buffer */
177 MsgLen pduSz; /**< Buffer Size */
178 RlcAmHdr amHdr; /**< AM header Info */
179 CmLListCp segLst; /**< PDU Segments list */
180 RlcSeg *expByteSeg; /**< Next expected byte segment */
181 uint16_t expSo; /**< Next expected seg offset */
182 Bool allRcvd; /**< All bytes received or not */
183 Bool isDelvUpperLayer; /**< Is it sent to upper layer */
184 Bool noMissingSeg; /*!< Flag to check all the bytes are received before the last byte of segment */
187 /** @addtogroup ammode */
191 * @brief Structure to hold information about an uplink AM Radio Bearer
194 * - recBuf : Reception buffer
195 * - rxNext : RX_Next - Receive state variable
196 * - rxNextHighestRcvd : RX_Next_Highest_Rcvd - Highest received state variable
197 * - rxNextStatusTrig : RX_Next_Status_Trigger - reorderig state variable
198 * - vrMr : VR(MR) - Maximum acceptable receive state variable
199 * - rxHighestStatus : RX_Highest_Status - Maximum STATUS transmit state variable
200 * - staTrg : Flag to indicate if status trigger occured
201 * - partialSdu : Partial SDU - Remains till the complete SDU
203 * - expSn : The expected sequence number for reassembly
204 * - expSo : The expected SO for reassembly
205 * - staProhTmr : The Status Probihit Timer
206 * - staProhTmrInt : Status Prohibit Timer interval (in ??)
207 * - reAsmblTmr : The Reordering Timer
208 * - reAsmblTmrInt : Re-ordering timer interval
209 * - gatherStaPduInfo : Whether to gather information required to create
213 typedef struct rlcAmUl
216 CmLListCp *recBufLst;
218 // RlcAmRecBuf *recBuf[1024]; /**< Reception buffer */
220 RlcSn rxNext; /**< RX_Next:Equvalent to VR(R) in 4G */
221 RlcSn rxNextHighestRcvd; /**< RX_Next_Highest_Rcvd: Equvalent to VR(H) in 4G */
222 RlcSn rxNextStatusTrig; /**< rxNextStatusTrig: Equvalent to VR(X) in 4G*/
223 RlcSn vrMr; /**< VR(MR) */
224 RlcSn rxHighestStatus; /**< rxHighestStatus: Eqvalent to VR(MS) in 4G*/
225 Bool staTrg; /**< Whether status trigger occured */
226 Buffer *partialSdu; /**< Partially received SDU */
227 RlcSn expSn; /**< Expected SN for reassembly */
228 uint16_t expSo; /**< Expected SO for reassembly */
229 CmTimer staProhTmr; /**< T_status_prohibit Timer */
230 uint16_t staProhTmrInt; /**< Timer Interval */
231 CmTimer reAsmblTmr; /**< T_reordering Timer */
232 uint8_t reAsmblTmrInt; /**< Timer Interval */
233 Bool gatherStaPduInfo; /**< Gather STATUS PDU creation info*/
234 Bool isOutOfSeq; /**< To identify whether packets are Out-Of-Seq or not */
235 uint8_t snLen; /*!< Sequence number length:12 bit or 18 bit : 5GNR RLC */
236 uint32_t snModMask; /*!< (2 Pwr SnLen - 1): 5GNR RLC */
242 * @brief Structure to hold uplink information about a Radio Bearer
245 * - rlcId : RLC identifier, uniquely identifies a Radio Bearer
246 * - lch : Information (type and id) of the logical channel associated
247 * with this Radio Bearer.
248 * - mode : The mode of the Radio Bearer; UM or AM
249 * - dir : The direction of the Radio Bearer, downlink or uplink or both
250 * - inst : Id of RLC instance where this Radio Bearer is present. Used
251 * to find the instance from the Radio Bearer for memory needs
252 * as different instances might have different memory.
253 * - k1wuSapId : KWU SAP identifier
254 * - udxSapId : UDX SAP idenrifier
255 * - transId : Stores the transaction identifier used to communicate
256 * with MAC, the same value as sent by MAC is passed back
257 * for it to be able to corelate
258 * - m : Mode of the RB (TM/UM/AM)
259 * - umDl : Unacknowledged Mode downlink information
260 * - amDl : Acknowledged Mode downlink information
262 typedef struct _rlcUlRbCb
264 /* kw005.201 added support for L2 Measurement */
266 RlcL2MeasRbCb rbL2Cb; /**< RB measurement L2 Cb */
267 RlcUlUeCb *ueCb; /*!< Pointer to UeCb */
268 uint8_t qci; /**< qci of the RB */
269 RlcL2MeasIpThruput l2MeasIpThruput; /**< Holds related parameter for
270 DL/Ul ip throughput>*/
271 #endif /* LTE_L2_MEAS */
272 CmLteRlcId rlcId; /**< RLC Identifier */
273 RlcLchInfo lch; /**< Logical Channel Info */
274 Snssai *snssai; /**< Snssai Info */
275 CmLteRlcMode mode; /**< Entity Mode */
276 uint8_t dir; /**< Direction for UL/DL */
277 Inst inst; /**< Tapa where Rb created Instance id */
278 SpId k1wuSapId; /**< KWU sap Id, to get the KwuSapCb */
279 SpId udxSapId; /**< KWU sap Id, to get the KwuSapCb */
280 uint32_t transId; /**< Transaction Id for RLC */
283 RlcUmUl umUl; /**< UM mode Ul elements */
284 RlcAmUl amUl; /**< AM mode uplink elements */
285 }m; /**< RLC mode specific Info */
289 * @brief Structure to hold mapping between logical channel and Radio Bearer
292 * - ulRbCb : Pointer to the uplink Radio Bearer
294 typedef struct rlcUlLch
296 RlcUlRbCb *ulRbCb; /**< Pointer to Uplink RbCb */
300 * @brief Structure to hold ue delete information
304 * - ueDelTmr : Ue delete timer
306 typedef struct rlcUeDeleteInfo
309 CmTimer ueDelTmr; /*Ue delete timer*/
313 * @brief Structure to hold uplink information about the Cells
316 * - cellHlEnt : Information about cells are stored in a hash table. This is
318 * - cellId : Identity of the cell
319 * - rbCb : Radio Bearers in the cell
320 * - lCh : Logical Channels in the cell
321 * - selfPstUl : Pst structure for sending messages to self
323 typedef struct rlcUlCellCb
325 CmHashListEnt cellHlEnt; /**< Hash list entry for CellCb */
326 CmLteCellId cellId; /**< Cell Id */
327 RlcUlRbCb *rbCb[RLC_MAX_RB_PER_CELL]; /**< RbCbs within a Cell */
328 RlcUlLch lCh[RLC_MAX_LCH_PER_CELL]; /**< Logical channels in a cell */
333 * @brief Structure to hold uplink information about the UEs
336 * - ueHlEnt : Information about cells are stored in a hash table. This is
338 * - key : Key to store/find the UE in the hashtable
339 * - srbCb : Signaling Radio Bearers configured for the UE
340 * - drbCb : Data Radio Bearers configured for the UE
341 * - lCh : Logical Channels in the UE
345 CmHashListEnt ueHlEnt; /**< Hash list entry for UeCb */
346 CmLteRnti ueId; /*!< UE Id */
347 CmLteCellId cellId; /*!< Cell Id */
348 RlcUlRbCb *srbCb[RLC_MAX_SRB_PER_UE]; /**< SRB RbCbs within an UE */
349 RlcUlRbCb *drbCb[RLC_MAX_DRB_PER_UE]; /**< DRB RbCbs within an UE */
350 RlcUlLch lCh[RLC_MAX_LCH_PER_UE]; /**< Logical channels of an UE*/
351 /* kw005.201 added support for L2 Measurement */
353 uint32_t firstPacketTTI; /*!< is first packet of the burst */
354 uint16_t numActRb[LKW_MAX_QCI]; /**< number of RBs Active */
355 Bool isUlBurstActive; /*!<Has the Burst started for UL IP Thrpt meas */
356 #endif /* LTE_L2_MEAS */
357 RlcUeDeleteInfo ueDeleteInfo; /*!<Ue Delete Info */
361 * @brief Structure to hold temporary data of configuration
364 * - entUlCfgCfm : Holds the UL configuration status
367 typedef struct rlcUlEntTmpData
369 RlcEntCfgCfmInfo entUlCfgCfm; /**< Ul Configuration status*/
370 RlcUlRbCb *rbCb; /**< Rb Block */
374 * @brief Structure to hold transaction information in configuration request
377 * - transHlEnt : List entry for transaction block.
378 * - transId : Transaction Id
382 * - cellCb : Cell Block
383 * - cfgInfo : Configuration Information
384 * - ueInfo : UE Information
385 * - newUeInfo : New Ue Information
386 * - cfgTmpData : Temporary data per Configuration entity
388 typedef struct rlcUlCfgTmpData
390 CmHashListEnt transHlEnt; /**< List Entry of
392 uint32_t transId; /**< Locally generated Transaction Id */
393 uint32_t uprLyrTransId; /**< Transaction Id generated by upper layer.
394 This is used while sending confirm to the User Layer */
395 CmLteCellId cellId; /**< Cell Id */
396 CmLteRnti ueId; /**< Ue Id */
397 RlcUlUeCb *ueCb; /**< Ue Block */
398 RlcUlCellCb *cellCb; /**< Cell Block */
399 RlcCfgInfo *cfgInfo; /**< Config Information*/
400 CkwUeInfo *ueInfo; /**< Ue Information */
401 CkwUeInfo *newUeInfo; /**< New Ue Information */
402 RlcUlEntTmpData cfgEntData[CKW_MAX_ENT_CFG]; /**< Entity Data */
404 /****************************************************************************
406 ***************************************************************************/
407 /****************************************************************************
408 * Configuration Functions
409 ***************************************************************************/
411 S16 rlcValidateRbCfgParams ARGS ((RlcCb *gCb,
414 RlcEntCfgInfo *cfgToValidate,
416 S16 rlcCfgValidateUlRb ARGS (( RlcCb *gCb,
417 RlcEntCfgInfo *cfgToValidate,
418 RlcUlEntTmpData *cfgInfo,
419 RlcUlCfgTmpData *cfg));
421 S16 rlcCfgRollBackUlRb ARGS ((RlcCb *gCb,
423 RlcEntCfgInfo *cfgToValidate,
424 RlcUlEntTmpData *cfgTempData));
426 Void rlcCfgApplyUlRb ARGS ((RlcCb *gCb,
427 RlcEntCfgInfo *cfgToAply,
428 RlcUlEntTmpData *cfgTmpData,
429 RlcUlCfgTmpData *cfgTmpInfo));
431 S16 rlcCfgValidateReEstRb ARGS ((RlcCb *gCb,
434 RlcEntCfgInfo *cfgToValidate,
435 RlcUlEntTmpData *cfgTmpData));
437 Void rlcCfgApplyReEstUlRb ARGS ((RlcCb *gCb,
441 RlcUlEntTmpData *cfgTmpData));
443 Void rlcCfgApplyDelUlCell ARGS ((RlcCb *gCb,
444 RlcUlCfgTmpData *cfgTmpData));
446 S16 rlcCfgValidateDelUlCell ARGS ((RlcCb *gCb,
448 RlcEntCfgInfo *cfgToValidate,
449 RlcUlEntTmpData *cfgTmpData,
450 RlcUlCfgTmpData *cfgInfo));
452 S16 rlcCfgValidateDelUlUe ARGS ((RlcCb *gCb,
453 RlcEntCfgInfo *cfgToValidate,
454 RlcUlEntTmpData *cfgTmpData,
455 RlcUlCfgTmpData *cfgInfo));
457 Void rlcCfgApplyDelUlUe ARGS ((RlcCb *gCb,
458 RlcUlCfgTmpData *cfgTmpData));
460 Void rlcUlHdlCfgReq ARGS ((RlcCb *gCb,
461 RlcUlCfgTmpData *cfgInfo,
464 Void rlcCfgApplyUlUeIdChng ARGS ((RlcCb *gCb,
466 CkwUeInfo *newUeInfo,
467 RlcUlCfgTmpData *cfgTmpInfo));
469 S16 rlcCfgValidateUeIdChng ARGS ((RlcCb *gCb,
471 CkwUeInfo *newUeInfo,
472 RlcUlCfgTmpData *cfgTmpInfo));
474 /****************************************************************************
475 * DBM module Functions
476 ***************************************************************************/
477 S16 rlcDbmUlInit ARGS ((RlcCb *gCb));
479 Void rlcDbmUlDeInit ARGS ((RlcCb *gCb));
481 S16 rlcDbmAddUlUeCb ARGS ((RlcCb *gCb,
486 uint8_t rlcDbmFetchUlUeCb ARGS ((RlcCb *gCb,
491 Void rlcDbmDelUlUeCb ARGS ((RlcCb *gCb,
495 Void rlcDbmDelAllUlUe ARGS ((RlcCb *gCb));
497 S16 rlcDbmAddUlCellCb ARGS ((RlcCb *gCb,
499 RlcUlCellCb *cellCb));
501 Void rlcDbmFetchUlCellCb ARGS ((RlcCb *gCb,
503 RlcUlCellCb **cellCb));
505 Void rlcDbmDelUlCellCb ARGS ((RlcCb *gCb,
506 RlcUlCellCb *cellCb));
508 Void rlcDbmDelAllUlCell ARGS ((RlcCb *gCb));
510 Void rlcDbmFetchUlRbCbByRbId ARGS ((RlcCb *gCb,
514 Void rlcDbmFetchUlRbCbFromLchId ARGS ((RlcCb *gCb,
520 Void rlcDbmDelAllUlRb ARGS ((RlcCb *gCb,
524 S16 rlcDbmAddUlTransaction ARGS((RlcCb *gCb, RlcUlCfgTmpData *cfg));
526 S16 rlcDbmFindUlTransaction ARGS((RlcCb *gCb,
528 RlcUlCfgTmpData **cfg));
530 S16 rlcDbmDelUlTransaction ARGS((RlcCb *gCb, RlcUlCfgTmpData *cfg));
532 S16 rlcDbmDelAllUlTransactions ARGS((RlcCb *gCb));
534 Void rlcDbmUlShutdown ARGS ((RlcCb *gCb));
536 /****************************************************************************
537 * Transparent Mode Functions
538 ***************************************************************************/
540 void rlcTmmRcvFrmMac ARGS ((RlcCb *gCb,
546 void rlcTmmRcvFrmMac ARGS ((RlcCb *gCb,
551 Void rlcTmmUlReEstablish ARGS ((RlcCb *gCb, RlcUlRbCb *rbCb));
553 /****************************************************************************
554 * Unacknowledged Mode Functions
555 ***************************************************************************/
557 Void rlcUmmProcessPdus ARGS((RlcCb *gCb,
562 Void rlcUmmProcessPdus ARGS ((RlcCb *gCb,
564 KwPduInfo *pduInfo));
566 Void rlcUmmUlReEstablish ARGS ((RlcCb *gCb,
570 Void rlcUmmReAsmblTmrExp ARGS((RlcCb *gCb, RlcUlRbCb *rbCb));
573 Void rlcUmmFreeUlRbCb ARGS ((RlcCb *gCb, RlcUlRbCb *rbCb));
575 /****************************************************************************
576 * Acknowledged Mode Functions
577 ***************************************************************************/
578 Void rlcAmmUlReEstablish ARGS((RlcCb *gCb,
583 Void rlcAmmProcessPdus ARGS((RlcCb *gCb,
588 Void rlcAmmProcessPdus ARGS((RlcCb *gCb,
590 KwPduInfo *pduInfo));
593 Void rlcAmmReAsmblTmrExp ARGS((RlcCb *gCb, RlcUlRbCb *rbCb));
595 Void rlcAmmStaProTmrExp ARGS((RlcCb *gCb, RlcUlRbCb *rbCb));
597 Void rlcAmmFreeUlRbCb ARGS ((RlcCb *gCb, RlcUlRbCb *rbCb));
599 /****************************************************************************
601 ***************************************************************************/
603 void rlcUtlStoreUmRecBuf ARGS ((CmLListCp *recBufLst,
607 RlcUmRecBuf* rlcUtlGetUmRecBuf ARGS ((CmLListCp *recBufLst,
610 void rlcUtlDelUmRecBuf(RlcCb *gCb, CmLListCp *recBufLst, RlcUmRecBuf *recBuf);
612 Void rlcUtlStoreRecBuf ARGS ((CmLListCp *recBufLst,
616 RlcAmRecBuf* rlcUtlGetRecBuf ARGS ((CmLListCp *recBufLst,
619 Void rlcUtlDelRecBuf ARGS ((CmLListCp *recBufLst,
624 uint8_t rlcUtlRcvFrmMac ARGS ((RlcCb *gCb, KwDatIndInfo *datIndInfo));
626 uint8_t rlcUtlSendUlDataToDu ARGS ((RlcCb *gCb,RlcUlRbCb *rbCb, Buffer *sdu));
629 S16 rlcUtlHdlL2TmrExp ARGS (( RlcCb *gCb, RlcL2MeasEvtCb *measEvtCb));
631 Void rlcUtlCalUlIpThrPutIncTTI ARGS ((RlcCb *gCb,
635 Void rlcUtlCalUlIpThrPut ARGS((RlcCb *gCb,
640 S16 rlcUtlSndUlL2MeasCfm ARGS ((RlcCb *gCb, RlcL2MeasEvtCb *measEvtCb));
642 S16 rlcUtlSndUlL2MeasNCfm ARGS ((RlcCb *gCb,
643 RlcL2MeasReqEvt *measReqEvt,
644 RlcL2MeasCfmEvt *measCfmEvt));
646 S16 rlcUtlL2MeasUlInit ARGS((RlcCb *gCb));
648 Void rlcUtlResetUlL2MeasInRlcRb ARGS((RlcCb *gCb,
652 S16 rlcUtlValidateIpThL2Meas ARGS ((RlcL2MeasReqEvt *measReqEvt,
653 RlcL2MeasCfmEvt *measCfmEvt));
655 #endif /* LTE_L2_MEAS */
656 /****************************************************************************
657 * Activation Functions
658 ***************************************************************************/
659 S16 rlcUlActvInit ARGS ((Ent ent,
664 S16 rlcUlActvTsk ARGS ((Pst *pst, Buffer *mBuf));
666 /****************************************************************************
668 ***************************************************************************/
669 Void DumpRLCUlDebugInformation ARGS((Void));
671 uint8_t rlcProcCommLcUlData(Pst *pst, SuId suId, RguCDatIndInfo *datInd);
672 uint8_t rlcProcDedLcUlData(Pst *pst, SuId suId, RguDDatIndInfo *datInd);
676 #endif /* __cplusplus */
679 #endif /* __RLC_ULH__ */
680 /**********************************************************************
683 **********************************************************************/