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 CmLteRlcMode mode; /**< Entity Mode */
275 uint8_t dir; /**< Direction for UL/DL */
276 Inst inst; /**< Tapa where Rb created Instance id */
277 SpId k1wuSapId; /**< KWU sap Id, to get the KwuSapCb */
278 SpId udxSapId; /**< KWU sap Id, to get the KwuSapCb */
279 uint32_t transId; /**< Transaction Id for RLC */
282 RlcUmUl umUl; /**< UM mode Ul elements */
283 RlcAmUl amUl; /**< AM mode uplink elements */
284 }m; /**< RLC mode specific Info */
288 * @brief Structure to hold mapping between logical channel and Radio Bearer
291 * - ulRbCb : Pointer to the uplink Radio Bearer
293 typedef struct rlcUlLch
295 RlcUlRbCb *ulRbCb; /**< Pointer to Uplink RbCb */
299 * @brief Structure to hold uplink information about the Cells
302 * - cellHlEnt : Information about cells are stored in a hash table. This is
304 * - cellId : Identity of the cell
305 * - rbCb : Radio Bearers in the cell
306 * - lCh : Logical Channels in the cell
307 * - selfPstUl : Pst structure for sending messages to self
309 typedef struct rlcUlCellCb
311 CmHashListEnt cellHlEnt; /**< Hash list entry for CellCb */
312 CmLteCellId cellId; /**< Cell Id */
313 RlcUlRbCb *rbCb[RLC_MAX_RB_PER_CELL]; /**< RbCbs within a Cell */
314 RlcUlLch lCh[RLC_MAX_LCH_PER_CELL]; /**< Logical channels in a cell */
319 * @brief Structure to hold uplink information about the UEs
322 * - ueHlEnt : Information about cells are stored in a hash table. This is
324 * - key : Key to store/find the UE in the hashtable
325 * - srbCb : Signaling Radio Bearers configured for the UE
326 * - drbCb : Data Radio Bearers configured for the UE
327 * - lCh : Logical Channels in the UE
331 CmHashListEnt ueHlEnt; /**< Hash list entry for UeCb */
332 CmLteRnti ueId; /*!< UE Id */
333 CmLteCellId cellId; /*!< Cell Id */
334 RlcUlRbCb *srbCb[RLC_MAX_SRB_PER_UE]; /**< SRB RbCbs within an UE */
335 RlcUlRbCb *drbCb[RLC_MAX_DRB_PER_UE]; /**< DRB RbCbs within an UE */
336 RlcUlLch lCh[RLC_MAX_LCH_PER_UE]; /**< Logical channels of an UE*/
337 /* kw005.201 added support for L2 Measurement */
339 uint32_t firstPacketTTI; /*!< is first packet of the burst */
340 uint16_t numActRb[LKW_MAX_QCI]; /**< number of RBs Active */
341 Bool isUlBurstActive; /*!<Has the Burst started for UL IP Thrpt meas */
342 #endif /* LTE_L2_MEAS */
346 * @brief Structure to hold temporary data of configuration
349 * - entUlCfgCfm : Holds the UL configuration status
352 typedef struct rlcUlEntTmpData
354 RlcEntCfgCfmInfo entUlCfgCfm; /**< Ul Configuration status*/
355 RlcUlRbCb *rbCb; /**< Rb Block */
359 * @brief Structure to hold transaction information in configuration request
362 * - transHlEnt : List entry for transaction block.
363 * - transId : Transaction Id
367 * - cellCb : Cell Block
368 * - cfgInfo : Configuration Information
369 * - ueInfo : UE Information
370 * - newUeInfo : New Ue Information
371 * - cfgTmpData : Temporary data per Configuration entity
373 typedef struct rlcUlCfgTmpData
375 CmHashListEnt transHlEnt; /**< List Entry of
377 uint32_t transId; /**< Locally generated Transaction Id */
378 uint32_t uprLyrTransId; /**< Transaction Id generated by upper layer.
379 This is used while sending confirm to the User Layer */
380 CmLteCellId cellId; /**< Cell Id */
381 CmLteRnti ueId; /**< Ue Id */
382 RlcUlUeCb *ueCb; /**< Ue Block */
383 RlcUlCellCb *cellCb; /**< Cell Block */
384 RlcCfgInfo *cfgInfo; /**< Config Information*/
385 CkwUeInfo *ueInfo; /**< Ue Information */
386 CkwUeInfo *newUeInfo; /**< New Ue Information */
387 RlcUlEntTmpData cfgEntData[CKW_MAX_ENT_CFG]; /**< Entity Data */
389 /****************************************************************************
391 ***************************************************************************/
392 /****************************************************************************
393 * Configuration Functions
394 ***************************************************************************/
396 S16 rlcValidateRbCfgParams ARGS ((RlcCb *gCb,
399 RlcEntCfgInfo *cfgToValidate,
401 S16 rlcCfgValidateUlRb ARGS (( RlcCb *gCb,
402 RlcEntCfgInfo *cfgToValidate,
403 RlcUlEntTmpData *cfgInfo,
404 RlcUlCfgTmpData *cfg));
406 S16 rlcCfgRollBackUlRb ARGS ((RlcCb *gCb,
408 RlcEntCfgInfo *cfgToValidate,
409 RlcUlEntTmpData *cfgTempData));
411 Void rlcCfgApplyUlRb ARGS ((RlcCb *gCb,
412 RlcEntCfgInfo *cfgToAply,
413 RlcUlEntTmpData *cfgTmpData,
414 RlcUlCfgTmpData *cfgTmpInfo));
416 S16 rlcCfgValidateReEstRb ARGS ((RlcCb *gCb,
419 RlcEntCfgInfo *cfgToValidate,
420 RlcUlEntTmpData *cfgTmpData));
422 Void rlcCfgApplyReEstUlRb ARGS ((RlcCb *gCb,
426 RlcUlEntTmpData *cfgTmpData));
428 Void rlcCfgApplyDelUlCell ARGS ((RlcCb *gCb,
429 RlcUlCfgTmpData *cfgTmpData));
431 S16 rlcCfgValidateDelUlCell ARGS ((RlcCb *gCb,
433 RlcEntCfgInfo *cfgToValidate,
434 RlcUlEntTmpData *cfgTmpData,
435 RlcUlCfgTmpData *cfgInfo));
437 S16 rlcCfgValidateDelUlUe ARGS ((RlcCb *gCb,
438 RlcEntCfgInfo *cfgToValidate,
439 RlcUlEntTmpData *cfgTmpData,
440 RlcUlCfgTmpData *cfgInfo));
442 Void rlcCfgApplyDelUlUe ARGS ((RlcCb *gCb,
443 RlcUlCfgTmpData *cfgTmpData));
445 Void rlcUlHdlCfgReq ARGS ((RlcCb *gCb,
446 RlcUlCfgTmpData *cfgInfo,
449 Void rlcCfgApplyUlUeIdChng ARGS ((RlcCb *gCb,
451 CkwUeInfo *newUeInfo,
452 RlcUlCfgTmpData *cfgTmpInfo));
454 S16 rlcCfgValidateUeIdChng ARGS ((RlcCb *gCb,
456 CkwUeInfo *newUeInfo,
457 RlcUlCfgTmpData *cfgTmpInfo));
459 /****************************************************************************
460 * DBM module Functions
461 ***************************************************************************/
462 S16 rlcDbmUlInit ARGS ((RlcCb *gCb));
464 Void rlcDbmUlDeInit ARGS ((RlcCb *gCb));
466 S16 rlcDbmAddUlUeCb ARGS ((RlcCb *gCb,
471 uint8_t rlcDbmFetchUlUeCb ARGS ((RlcCb *gCb,
476 Void rlcDbmDelUlUeCb ARGS ((RlcCb *gCb,
480 Void rlcDbmDelAllUlUe ARGS ((RlcCb *gCb));
482 S16 rlcDbmAddUlCellCb ARGS ((RlcCb *gCb,
484 RlcUlCellCb *cellCb));
486 Void rlcDbmFetchUlCellCb ARGS ((RlcCb *gCb,
488 RlcUlCellCb **cellCb));
490 Void rlcDbmDelUlCellCb ARGS ((RlcCb *gCb,
491 RlcUlCellCb *cellCb));
493 Void rlcDbmDelAllUlCell ARGS ((RlcCb *gCb));
495 Void rlcDbmFetchUlRbCbByRbId ARGS ((RlcCb *gCb,
499 Void rlcDbmFetchUlRbCbFromLchId ARGS ((RlcCb *gCb,
505 Void rlcDbmDelAllUlRb ARGS ((RlcCb *gCb,
509 S16 rlcDbmAddUlTransaction ARGS((RlcCb *gCb, RlcUlCfgTmpData *cfg));
511 S16 rlcDbmFindUlTransaction ARGS((RlcCb *gCb,
513 RlcUlCfgTmpData **cfg));
515 S16 rlcDbmDelUlTransaction ARGS((RlcCb *gCb, RlcUlCfgTmpData *cfg));
517 S16 rlcDbmDelAllUlTransactions ARGS((RlcCb *gCb));
519 Void rlcDbmUlShutdown ARGS ((RlcCb *gCb));
521 /****************************************************************************
522 * Transparent Mode Functions
523 ***************************************************************************/
525 void rlcTmmRcvFrmMac ARGS ((RlcCb *gCb,
531 void rlcTmmRcvFrmMac ARGS ((RlcCb *gCb,
536 Void rlcTmmUlReEstablish ARGS ((RlcCb *gCb, RlcUlRbCb *rbCb));
538 /****************************************************************************
539 * Unacknowledged Mode Functions
540 ***************************************************************************/
542 Void rlcUmmProcessPdus ARGS((RlcCb *gCb,
547 Void rlcUmmProcessPdus ARGS ((RlcCb *gCb,
549 KwPduInfo *pduInfo));
551 Void rlcUmmUlReEstablish ARGS ((RlcCb *gCb,
555 Void rlcUmmReAsmblTmrExp ARGS((RlcCb *gCb, RlcUlRbCb *rbCb));
558 Void rlcUmmFreeUlRbCb ARGS ((RlcCb *gCb, RlcUlRbCb *rbCb));
560 /****************************************************************************
561 * Acknowledged Mode Functions
562 ***************************************************************************/
563 Void rlcAmmUlReEstablish ARGS((RlcCb *gCb,
568 Void rlcAmmProcessPdus ARGS((RlcCb *gCb,
573 Void rlcAmmProcessPdus ARGS((RlcCb *gCb,
575 KwPduInfo *pduInfo));
578 Void rlcAmmReAsmblTmrExp ARGS((RlcCb *gCb, RlcUlRbCb *rbCb));
580 Void rlcAmmStaProTmrExp ARGS((RlcCb *gCb, RlcUlRbCb *rbCb));
582 Void rlcAmmFreeUlRbCb ARGS ((RlcCb *gCb, RlcUlRbCb *rbCb));
584 /****************************************************************************
586 ***************************************************************************/
588 void rlcUtlStoreUmRecBuf ARGS ((CmLListCp *recBufLst,
592 RlcUmRecBuf* rlcUtlGetUmRecBuf ARGS ((CmLListCp *recBufLst,
595 void rlcUtlDelUmRecBuf(RlcCb *gCb, CmLListCp *recBufLst, RlcUmRecBuf *recBuf);
597 Void rlcUtlStoreRecBuf ARGS ((CmLListCp *recBufLst,
601 RlcAmRecBuf* rlcUtlGetRecBuf ARGS ((CmLListCp *recBufLst,
604 Void rlcUtlDelRecBuf ARGS ((CmLListCp *recBufLst,
609 uint8_t rlcUtlRcvFrmMac ARGS ((RlcCb *gCb, KwDatIndInfo *datIndInfo));
611 uint8_t rlcUtlSendUlDataToDu ARGS ((RlcCb *gCb,RlcUlRbCb *rbCb, Buffer *sdu));
614 S16 rlcUtlHdlL2TmrExp ARGS (( RlcCb *gCb, RlcL2MeasEvtCb *measEvtCb));
616 Void rlcUtlCalUlIpThrPutIncTTI ARGS ((RlcCb *gCb,
620 Void rlcUtlCalUlIpThrPut ARGS((RlcCb *gCb,
625 S16 rlcUtlSndUlL2MeasCfm ARGS ((RlcCb *gCb, RlcL2MeasEvtCb *measEvtCb));
627 S16 rlcUtlSndUlL2MeasNCfm ARGS ((RlcCb *gCb,
628 RlcL2MeasReqEvt *measReqEvt,
629 RlcL2MeasCfmEvt *measCfmEvt));
631 S16 rlcUtlL2MeasUlInit ARGS((RlcCb *gCb));
633 Void rlcUtlResetUlL2MeasInRlcRb ARGS((RlcCb *gCb,
637 S16 rlcUtlValidateIpThL2Meas ARGS ((RlcL2MeasReqEvt *measReqEvt,
638 RlcL2MeasCfmEvt *measCfmEvt));
640 #endif /* LTE_L2_MEAS */
641 /****************************************************************************
642 * Activation Functions
643 ***************************************************************************/
644 S16 rlcUlActvInit ARGS ((Ent ent,
649 S16 rlcUlActvTsk ARGS ((Pst *pst, Buffer *mBuf));
651 /****************************************************************************
653 ***************************************************************************/
654 Void DumpRLCUlDebugInformation ARGS((Void));
656 uint8_t rlcProcCommLcUlData(Pst *pst, SuId suId, RguCDatIndInfo *datInd);
657 uint8_t rlcProcDedLcUlData(Pst *pst, SuId suId, RguDDatIndInfo *datInd);
661 #endif /* __cplusplus */
664 #endif /* __RLC_ULH__ */
665 /**********************************************************************
668 **********************************************************************/