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: This file contain the hash definations for RLC
29 **********************************************************************/
31 @brief RLC Hash definitions
34 #ifndef __RLC_UTILS_H__
35 #define __RLC_UTILS_H__
39 #endif /* __cplusplus */
50 /* RLC-SPLIT Activity */
57 #define RLC_2K_BYTE 2048
59 /* RLC RB flag bits */
60 #define RLC_RB_REESTABLISH_DL RLC_BIT0
61 #define RLC_RB_REESTABLISH_UL RLC_BIT1
62 #define RLC_RB_DELETE_DL RLC_BIT2
63 #define RLC_RB_DELETE_UL RLC_BIT3
66 #define RLC_MOD_1024 0x3FF /* used for MOD 1024 */
70 /************************************************************************
72 ************************************************************************/
74 #define RLC_SAP_NOT_CFG 0 /*!< SAP Not Configured */
75 #define RLC_SAP_CFG 1 /*!< SAP Configured but not not bound */
76 #define RLC_SAP_BND 2 /*!< SAP Bound */
77 #define RLC_SAP_BINDING 3 /*!< SAP Bind initiated */
78 #define RLC_SAP_UBND 4 /*!< SAP Unbind */
80 #define RLC_MAX_SAP_BND_RETRY 3 /*!< Maximum SAP Bin Retries */
82 #define RLC_MAX_UE 0xffffffff /*!< Maximum number of UEs. */
84 /* Maximum number of Saps */
85 #define RLC_MAX_UDXSAPS 1 /*!< Maximum number of UDX Saps */
86 #define RLC_MAX_KWUSAPS 2 /*!< Maximum number of KWU Saps. */
87 #define RLC_MAX_CKWSAPS 1 /*!< Maximum number of CKW Saps. */
89 #define RLC_MAX_RGUSAPS 4//5 /*!< Maximum number of RGU Saps. */
91 #define RLC_MAX_RGUSAP_TMR 1 /*!< Maximum number of RGU SAP Timers. */
93 #define RLC_UI_RRC 0 /*!< Upper interface RRC sap Id. */
94 #define RLC_UI_PDCP 1 /*!< Upper interface PDCP sap Id. */
97 /* TODO. This works for FDD only. For TDD the array dimension
98 * should be changed according to the number of Harq Procs */
99 #define RLC_MAX_TB_PER_UE 64 /*!< Maximum number of tbCb for UE */
100 #define RLC_INVALID_TBID RLC_MAX_TB_PER_UE
102 /*******************************************************************************
103 * Memory related Defines
104 ******************************************************************************/
105 /* Allocate function */
107 #define RLC_ALLOC(_cb,_buf, _size) \
109 if (SGetSBuf(_cb->init.region, _cb->init.pool, (Data **)&_buf, \
110 (Size) _size) == ROK) \
112 memset((_buf), 0, _size); \
120 #define RLC_FREE(_cb,_buf, _size) \
124 (Void) SPutSBuf(_cb->init.region, _cb->init.pool, \
125 (Data *) _buf, (Size) _size); \
130 #define RLC_FREE_SHRABL_BUF(_region, _pool,_buf, _size) \
134 (Void) SPutStaticBuffer(_region, _pool, \
135 (Data *) _buf, (Size) _size, 0); \
140 #define RLC_FREE_SHRABL_BUF_WC(_region, _pool,_buf, _size) \
142 (Void) SPutStaticBuffer(_region, _pool, \
143 (Data *) _buf, (Size) _size, 0); \
147 #define RLC_ALLOC_SHRABL_BUF_WC(_region, _pool,_buf, _size) \
149 SGetStaticBuffer(_region, _pool, (Data **)&_buf, \
153 #define RLC_ALLOC_SHRABL_BUF(_region, _pool,_buf, _size) \
155 if (SGetStaticBuffer(_region, _pool, (Data **)&_buf, \
156 (Size) _size, 0) == ROK) \
158 memset((_buf), 0, _size); \
166 #define RLC_ALLOC_WC(_cb,_buf, _size) \
167 SGetSBuf(_cb->init.region, _cb->init.pool, (Data **)&_buf, (Size) _size)
169 #define RLC_REMOVE_SDU(_cb,_sduQ,_sdu) \
173 SPutMsg(_sdu->mBuf); \
175 cmLListDelFrm(_sduQ,&_sdu->lstEnt); \
176 RLC_FREE(_cb,_sdu, sizeof(RlcSdu)); \
179 /* kw002.201 Freeing from region of pst */
180 #define RLC_PST_FREE(_region, _pool, _buf, _size) \
184 (Void) SPutSBuf(_region, _pool, \
185 (Data *) _buf, (Size) _size); \
190 #ifdef XEON_SPECIFIC_CHANGES
191 #ifdef SS_LOCKLESS_MEMORY
192 #define RLC_SHRABL_STATIC_BUF_FREE(_region, _pool, _buf, _size) \
196 (Void) SPutStaticBuffer(_region, _pool, \
197 (Data *) _buf, (Size) _size, 0); \
202 #define RLC_SHRABL_STATIC_BUF_ALLOC(_region, _pool, _buf, _size) \
204 SGetStaticBuffer(_region, _pool, (Data **)&_buf, \
210 #define RLC_SHRABL_STATIC_BUF_FREE(_region, _pool, _buf, _size) \
214 (Void) SPutSBuf(_region, _pool, \
215 (Data *) _buf, (Size) _size); \
220 #define RLC_SHRABL_STATIC_BUF_ALLOC(_region, _pool, _buf, _size) \
222 SGetSBuf(_region, _pool, (Data **)&_buf, \
225 #endif /* SS_LOCKLESS_MEMORY */
229 #define RLC_SHRABL_STATIC_BUF_FREE(_region, _pool, _buf, _size) \
233 (Void) SPutStaticBuffer(_region, _pool, \
234 (Data *) _buf, (Size) _size, 0); \
239 #define RLC_SHRABL_STATIC_BUF_ALLOC(_region, _pool, _buf, _size) \
241 SGetStaticBuffer(_region, _pool, (Data **)&_buf, \
246 #define RLC_MEM_CPY(_dst, _src, _size) memcpy(_dst, _src, _size);
248 #define RLC_MEM_ZERO(_buf, _size) memset((_buf), 0, _size);
250 #define RLC_GET_MEM_REGION(_cb) (_cb->init.region)
252 #define RLC_GET_MEM_POOL(_cb) (_cb->init.pool)
254 #define RLC_GET_MEM_POOL_ADDRESS(_cb) (&_cb->init.pool)
256 /* Memset to value */
257 #define RLC_MEM_SET(_arg, _val, _size) memset(_arg, _val, _size);
260 /* Send an alarm for sapId events */
261 /* kw005.201 added support for L2 Measurement */
263 #define RLC_GETSDUIDX(_sduIdx) \
265 _sduIdx = (((_sduIdx)+1) % RLC_L2MEAS_MAX_OUTSTNGSDU);\
267 #define RLC_SEND_SAPID_ALARM(_cb,_sapId, _evnt, _cause) \
269 rlcLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, _sapId, 0, 0); \
271 #define RLC_SEND_UEID_ALARM(_cb,_ueId, _qci, _evnt, _cause) \
273 rlcLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, 0, _ueId, _qci); \
275 #else /* LTE_L2_MEAS */
276 #define RLC_SEND_SAPID_ALARM(_cb,_sapId, _evnt, _cause) \
278 rlcLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, _sapId, 0); \
280 #define RLC_SEND_UEID_ALARM(_cb,_ueId, _evnt, _cause) \
282 rlcLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, 0, _ueId); \
284 #endif /* LTE_L2_MEAS */
286 /*******************************************************************************
288 ******************************************************************************/
290 /* RLC Configuration parameters */
291 #define RLC_MAX_UL_LI (2 * RLC_MAX_LI)
292 /*macro RLC_MAX_DL_LI is moved to rlc_env.h file */
293 #define RLC_MAX_DAT RLC_MAXIMUM_DAT
294 /*macro RLC_MAX_PDU is moved to rlc_env.h file */
295 #define RLC_MAX_RB_PER_CELL 10
296 #define RLC_MAX_SRB_PER_UE 3
297 #define RLC_MAX_DRB_PER_UE 32
298 #define RLC_MAX_LCH_PER_UE 12
299 #define RLC_MAX_LCH_PER_CELL 6
300 #define RLC_MAX_NUM_RB 24
301 #define RLC_MAX_UE 0xffffffff
302 #define RLC_UE_LIST_BUCKET_SIZE 128
303 #define RLC_CELL_LIST_BUCKET_SIZE 10
304 #define RLC_TRANS_ID_LST_BKT_SIZE 10
305 #define RLC_MAX_RB 32
307 /* RLC Mode defines */
308 #define RLC_MODE_TM 1
309 #define RLC_MODE_UM 2
310 #define RLC_MODE_AM 3
312 /* Direction defines */
313 #define RLC_DIR_UL 1 /*!< Unlink direction */
314 #define RLC_DIR_DL 2 /*!< Downlink direction */
315 #define RLC_DIR_BOTH 3 /*!< Both Downlink and Unlink */
317 #define RLC_DEF_SEQ_NUM 0 /**< Sequence number to pick in case of duplicate
318 entries in hash list searches*/
323 * Macro to find the miniumum of two numbers
325 * @param[in] x First number
326 * @param[in] y Second number
329 #define RLC_MIN(x,y) (x) < (y) ? (x) : (y)
334 * Macro to the RLC instance
336 * @param[in] _inst Instance Id
339 #define RLC_GET_RLCCB(_inst) rlcCb[_inst]
341 #define RLC_ADD_SDU 1 /*!< Add SDU. */
342 #define RLC_DEL_SDU 2 /*!< Delete SDU. */
344 #define RLC_CFM_NOK 0 /*!< Do not send DatCfm */
345 #define RLC_CFM_OK 1 /*!< Send DatCfm */
347 /* Set the unsolictated Status flag */
348 #define RLC_SET_USTA_FLAG(_rlcCb, _value) \
350 _rlcCb->init.usta = _value; \
353 /* Macros to get the init parameters */
354 #define RLC_GET_DBG_MASK(_rlcCb) (_rlcCb->init.dbgMask)
355 #define RLC_GET_LMPST_MEM_POOL(_rlcCb) (_rlcCb->init.lmPst.pool)
356 #define RLC_GET_LMPST_MEM_REGION(_rlcCb) (_rlcCb->init.lmPst.region)
358 /* Macros for configuration module */
359 #define RLC_CFG_FILL_CFG_CFM(_entCfm, _rbId, _rbType, _status, _reason) \
361 _entCfm->rbId = _rbId; \
362 _entCfm->rbType = _rbType; \
363 _entCfm->status.status = _status; \
364 _entCfm->status.reason = _reason; \
368 * @def RLC_VALIDATE_UE_RBID
370 * This macro validates whether the _rbId passed is valid or not. It checks
371 * if the _rbId is within the maximum value depending on the _rbType.
372 * Returns TRUE if valid else FALSE
374 * @param[in] _rbType Type of the Radio Bearer; SRB or DRB
375 * @param[in] _rbId RB Id of the RB to be validated
378 #define RLC_VALIDATE_UE_RBID(_rbType, _rbId) \
379 ((_rbType == CM_LTE_SRB && _rbId < RLC_MAX_SRB_PER_UE) || \
380 (_rbType == CM_LTE_DRB && _rbId < RLC_MAX_DRB_PER_UE))
382 /*******************************************************************************
384 ******************************************************************************/
385 #if (ERRCLASS & ERRCLS_INT_PAR)
386 #define RLC_VALDATE_SAP(_cb,_chkSpId, _sap, _ret) \
388 if (_chkSpId != _sap->spId) \
390 RLCLOGERROR(_cb,ERRCLS_DEBUG, EKWxxx, (ErrVal) RFAILED, \
391 "Sap Id Validation Failed."); \
394 /* SAP state validation */ \
395 if(_sap->state != RLC_SAP_BND) \
397 RLCLOGERROR(_cb,ERRCLS_INT_PAR, EKWXXX, (ErrVal) RFAILED, \
398 "Sap State Invalid."); \
399 RLC_SEND_SAPID_ALARM(_cb,0, LCM_EVENT_UI_INV_EVT, LCM_CAUSE_INV_STATE); \
403 #else /* ERRCLASS & ERRCLS_INT_PAR */
404 #define RLC_VALDATE_SAP(_cb,_chkSpId, _sap, _ret) \
406 /* SAP state validation */ \
407 if(_sap->state != RLC_SAP_BND) \
409 RLCLOGERROR(_cb,ERRCLS_INT_PAR, EKWXXX, (ErrVal) RFAILED, \
410 "Sap State Invalid."); \
411 RLC_SEND_SAPID_ALARM(_cb,0, LCM_EVENT_UI_INV_EVT, LCM_CAUSE_INV_STATE); \
415 #endif /* ERRCLASS & ERRCLS_INT_PAR */
417 /*******************************************************************************
419 ******************************************************************************/
420 #define RLC_TMR_LEN 10
421 #define RLC_MAX_UM_TMR 1
422 #define RLC_MAX_AM_TMR 3
423 #define RLC_MAX_THPT_TMR 1
426 #define EVENT_RLC_UMUL_REASSEMBLE_TMR 1
427 #define EVENT_RLC_AMUL_REASSEMBLE_TMR 2
428 #define EVENT_RLC_AMUL_STA_PROH_TMR 3
429 #define EVENT_RLC_AMDL_POLL_RETX_TMR 4
430 #define EVENT_RLC_WAIT_BNDCFM 5
431 /* kw005.201 added support for L2 Measurement */
433 #define EVENT_RLC_L2_TMR 6
434 #endif /* LTE_L2_MEAS */
435 #define EVENT_RLC_THROUGHPUT_TMR 7
437 /*******************************************************************************
439 ******************************************************************************/
441 * @def RLC_DBM_GET_RBCB_FROM_UECB
443 * This macro makes _rbCb point to the RB in _ueCb based on the passed
444 * _rbId and _rbType. _rbCb can point to NULLP
446 * @param[in] _rbId RB Id of the RB to be fetched
447 * @param[in] _rbType Type of the RB, SRB or DRB
448 * @param[in] _ueCb Pointer to the UECb for which to get the RB
449 * @param[out] _rbCb Pointer to the found RbCb
452 #define RLC_DBM_GET_RBCB_FROM_UECB(_rbId, _rbType, _ueCb, _rbCb) \
453 (_rbCb) = ((_rbType) == CM_LTE_SRB) ? (_ueCb)->srbCb[(_rbId)] : \
454 (_ueCb)->drbCb[(_rbId)];
456 * @def RLC_DBM_GET_CELL_RBCB
458 * This macro makes _rbCb point to the RB in the _rbCbLst.
459 * _rbCb can point to NULLP
461 * @param[in] _rbId RB Id of the RB to be fetched
462 * @param[in] _rbCbLst Pointer to array of RBCbs
463 * @param[out] _rbCb Pointer to the found RbCb
466 #define RLC_DBM_GET_CELL_RBCB(_rbId, _rbCbLst, _rbCb) \
467 (_rbCb) = (_rbCbLst)[(_rbId)];
469 /*******************************************************************************
471 ******************************************************************************/
472 #define RLC_UMDL rbCb->m.umDl
473 #define RLC_UMUL rbCb->m.umUl
475 /* Sequence Number length defines */
476 #define RLC_UM_CFG_6BIT_SN_LEN 1 /**< UM 6-bit Sequence number length
478 #define RLC_UM_CFG_12BIT_SN_LEN 2 /**< UM 12-bit Sequence number length
481 /* Sequence Number length defines */
482 #define RLC_AM_CFG_12BIT_SN_LEN 1 /**< AM 12-bit Sequence number length
484 #define RLC_AM_CFG_18BIT_SN_LEN 2 /**< AM 18-bit Sequence number length
488 * @def RLC_REMOVE_MAC_HDR_SZ
490 * If PDU size is greater than 127, MAC header would be 3 bytes else 2 bytes
492 * @param[in,out] _pduSz Size of the pdu
495 #define RLC_REMOVE_MAC_HDR_SZ(_pduSz) (_pduSz) -= ((_pduSz) > 127) ? 3 : 2;
498 * @def RLC_UM_GET_VALUE
500 * This macro is used to calculate the value of UM state variables used
501 * in comparisons. VR(UH) - UM Window Size is taken as the base modulus.
502 * Returns the modifed value
504 * @param[in] _val Value of the state variable
505 * @param[in] _kwUmUl Um Uplink control block
508 #define RLC_UM_GET_VALUE(_val,_kwUmUl) \
509 (((_val) - ((_kwUmUl).vrUh - (_kwUmUl).umWinSz)) & ((_kwUmUl).modBitMask))
511 /*******************************************************************************
513 ******************************************************************************/
514 #define RLC_AMDL rbCb->m.amDl
515 #define RLC_AMUL rbCb->m.amUl
518 #define RLC_DATA_PDU 1
519 #define RLC_CNTRL_PDU 0
521 #define RLC_FI_FIRST_SEG 0x02
522 #define RLC_FI_LAST_SEG 0x01
523 #define RLC_SI_FIRST_SEG 0x01
524 #define RLC_SI_LAST_SEG 0x02
525 #define RLC_SI_MID_SEG 0x03
527 #define RLC_POLL_SET 0x40 /* 01000000 */
528 #define RLC_POLL_UNSET 0xbf /* 10111111 */
529 #define RLC_MAX_NACK_CNT 100
530 /*RLC_MAX_CNTRL_FIELDS (Maximum size of Status Pdu)
531 * = MAX_NACK_CNT * sizeof(NACK_SN,E1,E2,E3,soStart,soEnd, nackRange)
532 * for 18 bit SN + Fixed Header*/
533 #define RLC_MAX_CNTRL_FIELDS ((RLC_MAX_NACK_CNT * 8) + 3)
535 /* Each LI(Length Indicator) holds approx 1+1/2 byte and some other fields thus keeping Header Size equal to twice of MAX LI */
536 /* 5GNR_RLC: Need to change value of HDRSZ as per number of PDUs going in one datReq */
537 #define RLC_MIN_HDRSZ 1
538 #define RLC_MAX_HDRSZ 5
539 #define RLC_AM_PDU_FIXED_HDRSZ 2
540 #define RLC_AM_PDU_12BIT_SN_HDRSZ 2
541 #define RLC_AM_PDU_18BIT_SN_HDRSZ 3
542 #define RLC_AM_SEG_12BIT_SN_WITH_SO_HDRSZ 4
543 #define RLC_AM_SEG_18BIT_SN_WITH_SO_HDRSZ 5
544 #define RLC_AM_SEG_12BIT_SN_WITHOUT_SO_HDRSZ 2
545 #define RLC_AM_SEG_18BIT_SN_WITHOUT_SO_HDRSZ 3
546 #define RLC_EXTN_HDRSZ 2
547 #define RLC_CNTRL_PDU_FIXED_HDRSZ 3
548 #define RLC_MAC_HDR_SZ2 2
549 #define RLC_MAC_HDR_SZ3 3
550 #define RLC_BYTE_LEN 8
551 #define RLC_2BYTE_LEN 16
553 #define RLC_NACK_E1E2_LEN 12
554 #define RLC_SO_LEN 15
556 #define RLC_CPT_LEN 3
562 #define RLC_SN_LEN 10
563 #define RLC_SN_LEN_12BITS 12
564 #define RLC_SN_LEN_18BITS 18
565 #define RLC_LSF_LEN 1
566 #define RLC_LI_LEN 11
567 #define RLC_STA_PDU_R_BITS_ACKSN_12BITS 7 /* 5GNR : Num Reserved bits in STATUS PDU */
568 #define RLC_STA_PDU_R_BITS_ACKSN_18BITS 1
569 #define RLC_STA_PDU_R_BITS_NACKSN_12BITS 1
570 #define RLC_STA_PDU_R_BITS_NACKSN_18BITS 3
571 #define RLC_NACK_RANGE_LEN 8
572 #define RLC_SO_LEN_5GNR 16
574 #define RLC_DC_POS 0x80
576 #define RLC_POLL_POS 0x40 /* 5GNR */
577 #define RLC_POLL_SHT 6 /* 5GNR */
578 #define RLC_SI_POS 0x30 /* 5GNR */
579 #define RLC_SI_SHT 4 /* 5GNR */
580 #define RLC_SN_POS_12BIT 0x0F
581 #define RLC_SN_POS_18BIT 0x03
582 #define RLC_AM_GET_WIN_SZ(_snLen) ((RLC_AM_CFG_12BIT_SN_LEN == (_snLen)) ? (2048) : (131072)) /* 5GNR */
583 #define RLC_RCV_BUF_BIN_SIZE 512 /* receive buffer size */
584 #define RLC_TX_BUF_BIN_SIZE 512 /* receive buffer size */
586 #define RLC_SDU_LST 1
587 #define RLC_SEG_LST 2
588 #define RLC_RETX_LST 3
589 #define RLC_ALL_BYTES_MISSING 0xffff
591 #define RLC_MAX_PDU_MAP 30 /*!< Maximum PDU Map. */
593 #define RLC_LLIST_FIRST_SDU(lstCp, nod) \
596 /*CM_LLIST_FIRST_NODE(&(lstCp), tmpNode);*/ \
597 /*if (tmpNode != NULLP)*/ \
598 if((tmpNode=cmLListFirst(&lstCp))) \
599 nod = (RlcSdu *)tmpNode->node; \
605 #define RLC_LLIST_FIRST_SEG(lstCp, nod) \
608 /*CM_LLIST_FIRST_NODE(&(lstCp), tmpNode);*/ \
609 /*if (tmpNode != NULLP)*/ \
610 if((tmpNode=cmLListFirst(&lstCp))) \
611 nod = (RlcSeg *)tmpNode->node; \
616 #define RLC_LLIST_FIRST_RETX(lstCp, nod) \
619 /*CM_LLIST_FIRST_NODE(&(lstCp), tmpNode);*/ \
620 /*if (tmpNode != NULLP)*/ \
621 if((tmpNode=cmLListFirst(&lstCp))) \
622 nod = (RlcRetx *)tmpNode->node; \
627 #define RLC_LLIST_NEXT_SDU(lstCp, nod) \
630 /*CM_LLIST_NEXT_NODE(&(lstCp), tmpNode);*/ \
631 /*if (tmpNode != NULLP) */ \
632 if((tmpNode = cmLListNext(&lstCp))) \
633 nod = (RlcSdu *)tmpNode->node; \
639 #define RLC_LLIST_NEXT_SEG(lstCp, nod) \
642 (lstCp).crnt = &((nod)->lstEnt); \
643 /*CM_LLIST_NEXT_NODE(&(lstCp), tmpNode);*/ \
644 /*if (tmpNode != NULLP)*/ \
645 if((tmpNode = cmLListNext(&lstCp))) \
646 nod = (RlcSeg *)tmpNode->node; \
652 #define RLC_LLIST_NEXT_RETX(lstCp, nod) \
655 /*CM_LLIST_NEXT_NODE(&(lstCp), tmpNode);*/ \
656 /*if (tmpNode != NULLP) */ \
657 if ((tmpNode = cmLListNext(&lstCp))) \
658 nod = (RlcRetx *)tmpNode->node; \
664 #define RLC_LLIST_LAST_RETX(lstCp, nod) \
666 CmLList *tempNode = NULLP; \
667 cmLListLast(&lstCp); \
668 tempNode = cmLListCrnt(&lstCp); \
669 if (tempNode != NULLP) \
670 nod = (RlcRetx *)tempNode->node; \
675 #define RLC_LLIST_LAST_SEG(lstCp, nod) \
677 CmLList *tempNode = NULLP; \
678 cmLListLast(&lstCp); \
679 tempNode = cmLListCrnt(&lstCp); \
680 if (tempNode != NULLP) \
681 nod = (RlcSeg *)tempNode->node; \
686 #define RLC_LLIST_LAST_SDU(lstCp, nod) \
688 CmLList *tempNode = NULLP; \
689 cmLListLast(&lstCp); \
690 tempNode = cmLListCrnt(&lstCp); \
691 if (tempNode != NULLP) \
692 nod = (RlcSdu *)tempNode->node; \
697 #define CM_LLIST_INS_AFT_CRNT(lstCp, nod) \
699 CmLList *nodeToIns = &nod->lstEnt;\
700 nodeToIns->node = (PTR) nod;\
701 cmLListInsAfterCrnt(&lstCp, nodeToIns); \
704 #define CM_LLIST_INS_BEF_CRNT(lstCp, nod) \
706 CmLList *nodeToIns = &nod->lstEnt; \
707 nodeToIns->node = (PTR) nod; \
708 cmLListInsCrnt(&lstCp, nodeToIns); \
711 #define RLC_LLIST_DEL_RECBUF(_recBuf) \
713 RlcSeg *_seg = NULLP; \
714 RLC_LLIST_FIRST_SEG(_recBuf->segLst, _seg); \
717 cmLListDelFrm(&_recBuf->segLst, &_seg->lstEnt); \
718 RLC_FREE(_seg, sizeof(RlcSeg)); \
719 RLC_LLIST_NEXT_SEG(_recBuf->segLst, _seg); \
723 #define RLC_UMM_LLIST_FIRST_SEG(lstCp, nod) \
726 if((tmpNode=cmLListFirst(&lstCp))) \
727 nod = (RlcUmSeg *)tmpNode->node; \
730 } /*!< um mode first segment of linked list*/
732 #define RLC_UMM_LLIST_NEXT_SEG(lstCp, nod) \
735 (lstCp).crnt = &((nod)->lstEnt); \
736 if((tmpNode = cmLListNext(&lstCp))) \
737 nod = (RlcUmSeg *)tmpNode->node; \
740 }/*!< next segment in um mode linked list*/
742 #define MODAMT(x, y, z,_snModMask) \
744 y = (x - z) & _snModMask; \
747 #define MODAMR(x, y, z , _snModMask) \
749 y = (x - z) & (_snModMask); \
753 * @def RLC_AM_IS_TRANS_WIN_STALLED
755 * This macro is used to check if the AM transmit window is stalled or not.
756 * The tramist window is stalled when the distance between txNext and txNextAck
757 * is greater than equal to Window Size. Actually it should never be greater
759 * Returns TRUE if the window is stalled else FALSE
761 * @param[in] _amDl AM Downlink control block
764 #define RLC_AM_IS_TRANS_WIN_STALLED(_amDl) \
765 ((((_amDl)->txNext - (_amDl)->txNextAck) & _amDl->snModMask) >= (RLC_AM_GET_WIN_SZ(_amDl->snLen)))
768 #define RLC_AM_TRANS_WIN_SIZE(_amDl) \
769 (((_amDl)->txNext - (_amDl)->txNextAck) & _amDl->snModMask)
772 #define RLC_AM_IS_POLL_BIT_SET(_amDl) \
773 (RLC_AMDL.pollSn == ((RLC_AMDL.txNext - 1) & RLC_AMDL.snModMask))
775 #define RLC_FILL_CNTRL_INFO(cntrlInfo, _val, _len, _idx, _eb)\
777 cntrlInfo.val = _val; \
778 cntrlInfo.len = _len; \
779 cntrlInfo.idx = _idx; \
780 cntrlInfo.emtBits = _eb; \
782 #define RLC_FILL_PREV_IDX(cntrlInfo, _e1Idx, _e1eb, _idx, _eb) \
784 _e1Idx = cntrlInfo.e1Idx; \
785 _e1eb = cntrlInfo.e1eb; \
786 _idx = cntrlInfo.idx; \
787 _eb = cntrlInfo.emtBits; \
790 #define RLC_FILL_HDR_ARGS(hdrInfo, _val, _len) \
792 hdrInfo.val = _val; \
793 hdrInfo.len = _len; \
796 /* kw003.201 - This macro provides the header size other than the */
797 /* fixed header of 2 bytes for each AMD PDU or 4 bytes*/
798 /* for an AM PDU segment */
799 #define RLC_AM_EXTN_HDRSZ(_numLi, _eHdrSz) \
801 if ((_numLi - 1) % 2) \
803 _eHdrSz = ((3 * (_numLi - 2)) >> 1) + 2; \
807 _eHdrSz = (3 * (_numLi - 1)) >> 1; \
811 /* Update poll bit in the buffer */
812 #define RLC_UPD_POLL_BIT(_gCb, _retx, _poll) \
816 if (_poll != _retx->amHdr.p) \
818 /* Get the first byte of the buffer */ \
819 SRemPreMsg((Data *)&fHdr, _retx->seg); \
822 fHdr = fHdr | RLC_POLL_SET; \
826 fHdr = fHdr & RLC_POLL_UNSET; \
828 /* Concatenated updated hdr to the mBuf */ \
829 SAddPreMsg ((Data)fHdr, _retx->seg); \
831 /* Update poll bit in the hdrInfo */ \
832 _retx->amHdr.p = _poll; \
835 #define RLC_AM_ELIMINATE_EXTN_HDR(_pduSz, _sduSz, _numLi) \
837 if ( (_pduSz > _sduSz) && (_sduSz < 2048) ) \
839 _pduSz -= (_numLi % 2) ? 1 : 2; \
843 * @def RLC_AM_CHK_SN_WITHIN_RECV_WINDOW
845 * This macro is used to check if a Sequence Number falls within the AM
846 * reception window or not.
847 * The condition is VR(R) <= SN < VR(MR), which are subtracting the base
848 * modulus becomes 0 <= (SN - VR(R)) % SNLen < (VR(MR) - VR(R)) % SnLen
849 * NOTE: Careful with the parantheses
851 * Returns TRUE if within the window; FALSE otherwise
853 * @param[in] _sn The sequence number to be checked
854 * @param[in] _amUl AM Uplink control block
857 #define RLC_AM_CHK_SN_WITHIN_RECV_WINDOW(_sn, _amUl) \
858 ((((_sn) - (_amUl->rxNext)) & (_amUl->snModMask)) < (((_amUl->vrMr) - (_amUl->rxNext)) & (_amUl->snModMask)))
860 #define RLC_POWER(x, y) x << (y-1);
863 #define rlcCpyMsg(_cb,x, y) \
864 (SAddMsgRef((x), RLC_GET_MEM_REGION(_cb), RLC_GET_MEM_POOL(_cb), (y)))
866 /* L2 optimization for mUe/Tti: Removing dup buf*/
867 #define rlcCpyMsg(_cb,x, y) \
868 (SIncMsgRef((x), RLC_GET_MEM_REGION(_cb), RLC_GET_MEM_POOL(_cb), (y)))
871 // printf("Copy Msg %x \n",x);
873 /*******************************************************************************
875 ******************************************************************************/
876 #define RLC_DBG_SUB_MASK DBGMASK_MI /**< Use for sub-mask */
877 #define RLC_DBGMASK_DETAIL (RLC_DBG_SUB_MASK << 0) /**< Parameters, It will give
879 #define RLC_DBGMASK_BRIEF (RLC_DBG_SUB_MASK << 1) /**< Info, It will give info at
880 entry and exit places along
881 with certain state changes */
882 #define RLC_DBGMASK_ERROR (RLC_DBG_SUB_MASK << 2) /**< Error information */
883 #define RLC_DBGMASK_FATAL (RLC_DBG_SUB_MASK << 3) /**< FATAL errors like memory
884 resource failure etc., */
886 #define RLC_DBG_MDL_MASK (RLC_DBG_SUB_MASK << 4)
888 #define RLC_DBGMASK_TM (RLC_DBG_MDL_MASK << 0) /**< TM */
889 #define RLC_DBGMASK_UM (RLC_DBG_MDL_MASK << 1) /**< UM */
890 #define RLC_DBGMASK_AM (RLC_DBG_MDL_MASK << 2) /**< AM */
891 #define RLC_DBGMASK_DL (RLC_DBG_MDL_MASK << 3) /**< DL */
892 #define RLC_DBGMASK_UL (RLC_DBG_MDL_MASK << 4) /**< UL */
893 #define RLC_DBGMASK_CFG (RLC_DBG_MDL_MASK << 5) /**< CFG */
894 #define RLC_DBGMASK_LMM (RLC_DBG_MDL_MASK << 6) /**< LMM */
895 #define RLC_DBGMASK_INF (RLC_DBG_MDL_MASK << 7) /**< UI, LI */
896 #define RLC_DBGMASK_DUT (RLC_DBG_MDL_MASK << 8) /**< DBM, UTL, TMR */
897 #define RLC_DBGMASK_MBUF_PRNT (RLC_DBG_MDL_MASK << 9) /**< MBUF, useful in
900 #define RLC_DBGMASK_MEM_INFO (RLC_DBG_MDL_MASK << 10) /**< Print SSI memory
902 #define RLC_DBGMASK_UDX (RLC_DBG_MDL_MASK << 11) /**< UDX interface */
905 #define RLC_PRNT_BORDER \
908 RLC_PRNT((_kwPBuf, "\n==========================\n")); \
911 #define RLC_PRNT_HLINE(_cb,_pMsg) \
913 sprintf((_cb)->init.prntBuf, "[RLC_LAYER: %s:%d]::", __FILE__, __LINE__); \
914 SPrint((_cb)->init.prntBuf); \
915 RLC_PRNT_TSTAMP(_cb); \
916 sprintf((_cb)->init.prntBuf, _pMsg); \
917 SPrint((_cb)->init.prntBuf); \
920 #define RLC_PRNT(_cb,_prntbuf) \
923 SPrint(_cb->init.prntBuf); \
926 #define RLC_PRINT_TO_BUFFER(_cb,...) \
928 snprintf((_cb)->init.prntBuf, PRNTSZE, "[%s]::", __func__); \
929 SPrint((_cb)->init.prntBuf); \
930 snprintf(_cb->init.prntBuf, PRNTSZE,__VA_ARGS__); \
931 SPrint(_cb->init.prntBuf); \
934 #define RLC_PRNT_TSTAMP(_cb) \
938 memset((&dt), 0, sizeof(DateTime)); \
940 sprintf(_buf, "date: %02d/%02d/%04d time: %02d:%02d:%02d", \
941 (int)dt.month,(int)dt.day,(int)dt.year + 1900, \
942 (int)dt.hour,(int)dt.min,(int)dt.sec); \
943 RLC_PRNT(_cb,(_cb->init.prntBuf,("[%s]", _buf))); \
946 #define RLC_PRNT_MBUF(_cb,_mBufPtr) \
949 if(_cb->init.dbgMask & (RLC_DBGMASK_MBUF_PRNT)) \
951 RLC_PRNT_HLINE(_cb,("\nMessage Buffer Contents:\n")); \
952 SPrntMsg ((Buffer *)_mBufPtr, 0, 0); \
956 #define RLC_PRNT_MEMINFO(_cb) \
960 if(_cb->init.dbgMask & (RLC_DBGMASK_MEM_INFO)) \
962 RLC_PRNT_HLINE(_cb,("\nMemory Information:\n")); \
963 SRegInfoShow(0, &_memInfo); \
967 #define RLCDBGP_INTERNAL(_cb,_mask,...) \
970 if (!((_cb->init.dbgMask & _mask) ^ _mask)) \
972 RLC_PRINT_TO_BUFFER(_cb, __VA_ARGS__); \
976 #define RLCDBGP_ERROR(_cb, ...) \
977 RLCDBGP_INTERNAL(_cb,(RLC_DBGMASK_ERROR | RLC_MODULE),__VA_ARGS__)
979 #define RLCDBGP_DETAIL(_cb, ...) \
980 RLCDBGP_INTERNAL(_cb,(RLC_DBGMASK_DETAIL | RLC_MODULE),__VA_ARGS__)
982 #define RLCDBGP_BRIEF(_cb, ...) \
983 RLCDBGP_INTERNAL(_cb,(RLC_DBGMASK_BRIEF | RLC_MODULE),__VA_ARGS__)
986 #define RLC_PRNT_HLINE(_cb,_pMsg)
987 #define RLC_PRNT(_cb,_prntbuf)
988 #define RLC_PRNT_TSTAMP(_cb)
989 #define RLC_PRNT_MBUF(_cb,_mBufPtr)
990 #define RLC_PRNT_MEMINFO(_cb)
991 #define RLCDBGP(_cb,_mask, _arg)
992 #define RLCDBGP_ERROR(_cb, ...)
993 #define RLCDBGP_DETAIL(_cb, ...)
994 #define RLCDBGP_BRIEF(_cb, ...)
997 /*******************************************************************************
999 ******************************************************************************/
1000 #define RLC_LMM_RB_STS_INC(_cb) (_cb)->genSts.numOfRb++;
1002 #define RLC_LMM_RB_STS_DEC(_cb) (_cb)->genSts.numOfRb--;
1004 #if defined(SS_MULTICORE_SUPPORT) && defined(SS_M_PROTO_REGION)
1005 #define RLC_FILL_SAP_HELPER(_Sap, _cfg, _gCb)\
1007 _Sap->pst.selector = _cfg->selector; \
1008 _Sap->pst.route = _cfg->route; \
1009 _Sap->pst.prior = _cfg->priority; \
1010 _Sap->pst.region = _gCb->init.region;\
1011 _Sap->pst.pool = _gCb->init.pool;\
1012 _Sap->pst.dstProcId = _cfg->procId; \
1013 _Sap->pst.dstEnt = _cfg->ent; \
1014 _Sap->pst.dstInst = _cfg->inst; \
1015 _Sap->pst.srcProcId = _gCb->init.procId; \
1016 _Sap->pst.srcEnt = _gCb->init.ent; \
1017 _Sap->pst.srcInst = _gCb->init.inst; \
1018 _Sap->pst.event = EVTNONE; \
1019 _Sap->spId = _cfg->sapId; \
1020 _Sap->state = RLC_SAP_CFG; \
1022 #else /* defined(SS_MULTICORE_SUPPORT) && defined(SS_M_PROTO_REGION) */
1023 #define RLC_FILL_SAP_HELPER(_Sap, _cfg, _gCb)\
1025 _Sap->pst.selector = _cfg->selector; \
1026 _Sap->pst.route = _cfg->route; \
1027 _Sap->pst.prior = _cfg->priority; \
1028 _Sap->pst.region = _cfg->mem.region;\
1029 _Sap->pst.pool = _cfg->mem.pool;\
1030 _Sap->pst.dstProcId = _cfg->procId;\
1031 _Sap->pst.dstEnt = _cfg->ent;\
1032 _Sap->pst.dstInst = _cfg->inst;\
1033 _Sap->pst.srcProcId = _gCb->init.procId;\
1034 _Sap->pst.srcEnt = _gCb->init.ent;\
1035 _Sap->pst.srcInst = _gCb->init.inst;\
1036 _Sap->pst.event = EVTNONE;\
1037 _Sap->spId = _cfg->sapId;\
1038 _Sap->state = RLC_SAP_CFG;\
1042 /*******************************************************************************
1044 ******************************************************************************/
1045 #define RLC_GET_DL_SAPCB(_cb, _rbCb) (_cb->u.dlCb->udxDlSap + _rbCb->udxSapId)
1046 #define RLC_GET_UDX_SAP(_cb) (_cb->u.ulCb->udxUlSap)
1048 /* kw005.201 added support for L2 Measurement */
1050 #define RLC_L2_MAX_TIMERS 1
1051 #define RLC_QCI_LIST_BUCKET_SIZE 10
1052 #define RLC_TB_LIST_BUCKET_SIZE 10
1053 #define RLC_MAX_L2MEAS_EVT 10
1054 /* L2 Measurement index to be used in rbCb to store measData */
1055 #define RLC_L2MEAS_ACT_UE 0
1056 #define RLC_L2MEAS_DL_DELAY 1
1057 #define RLC_L2MEAS_DL_DISC 2
1058 #define RLC_L2MEAS_UU_LOSS 3
1059 #define RLC_L2MEAS_DL_IP 4
1060 #define RLC_L2MEAS_UL_IP 5
1061 #endif /* LTE_L2_MEAS */
1063 #define RLC_RDWR_LOCK(_lockPtr)
1064 #define RLC_RDWR_UNLOCK(_lockPtr)
1065 #define RLC_TIME_DIFF(t1,t2) \
1066 (t1<t2 ? ((0xffffffff - t2) + t1 ): (t1 - t2))
1068 /*******************************************************************/
1071 #define RLC_MEM_REGION_UL 1
1072 #define RLC_MEM_REGION_DL 4
1076 #define RLC_UL_INST 0
1077 #define RLC_DL_INST 1
1080 #define RLC_REASSEMBLY_TMR_BASE 5 /* Used to calculate timer value from enum values */
1082 /* Fill Pst structure for sending msg from RLC to DUAPP */
1083 #define FILL_PST_RLC_TO_DUAPP(_pst, _srcInst, _event) \
1085 _pst.selector = ODU_SELECTOR_LWLC; \
1086 _pst.srcEnt = ENTRLC; \
1087 _pst.dstEnt = ENTDUAPP; \
1089 _pst.srcInst = _srcInst; \
1090 _pst.dstProcId = ODU_GET_PROCID(); \
1091 _pst.srcProcId = ODU_GET_PROCID(); \
1092 if(_srcInst == RLC_UL_INST) \
1094 _pst.region = RLC_MEM_REGION_UL; \
1096 else if(_srcInst == RLC_DL_INST) \
1098 _pst.region = RLC_MEM_REGION_DL; \
1100 _pst.pool = RLC_POOL; \
1101 _pst.event = _event; \
1107 #define FILL_PST_RLC_TO_MAC(_pst, _srcInst, _event) \
1109 pst.selector = ODU_SELECTOR_LWLC; \
1110 pst.srcEnt = ENTRLC; \
1111 pst.dstEnt = ENTMAC; \
1113 pst.srcInst = _srcInst; \
1114 pst.dstProcId = ODU_GET_PROCID(); \
1115 pst.srcProcId = ODU_GET_PROCID(); \
1116 if(_srcInst == RLC_UL_INST) \
1118 pst.region = RLC_MEM_REGION_UL; \
1120 else if(_srcInst == RLC_DL_INST) \
1122 pst.region = RLC_MEM_REGION_DL; \
1124 pst.pool = RLC_POOL; \
1125 pst.event = _event; \
1131 /** @brief global variables */
1132 uint16_t getTransId();
1134 /** @brief Local typedefs */
1135 typedef uint32_t RlcSn; /*!< Sequence Number length */
1137 typedef RguDDatIndInfo KwDatIndInfo;
1139 typedef RguDStaIndInfo KwDStaIndInfo;
1141 typedef RguPduInfo KwPduInfo; /* kw002.201 : Aligning the structure with RGU */
1143 typedef struct _amRlcStats
1145 uint32_t numDLStaPduSent;
1146 uint32_t numDLNacksInStaPdu;
1147 uint32_t numDLBytesUnused;
1148 uint32_t numDLPollTimerExpiresSrb;
1149 uint32_t numDLPollTimerExpiresDrb;
1150 uint32_t numDLMaxRetx;
1151 uint32_t numDLRetransPdus;
1152 uint32_t numULPdusDiscarded;
1153 uint32_t numULReAsmblTimerExpires;
1154 uint32_t numULStaPduRcvd;
1155 uint32_t numULNackInStaPduRcvd;
1156 uint32_t numRlcAmCellSduTx; /* Count of SDUs transmitted in DL for all UEs */
1157 uint32_t numRlcAmCellSduBytesTx; /*Total number of bytes transmitted in DL for all Ues */
1158 uint32_t numRlcAmCellRetxPdu; /*Count of PDUs retransmitted for all Ues */
1159 uint32_t numRlcAmMaxRetx; /*Total number of Max-RLC retransmissions hit for all the Ues */
1160 uint32_t numRlcAmCellDupPduRx; /*Count of Duplicate PDUs detected for a UE in UL for all Ues */
1161 uint32_t numRlcAmCellDropOutWinRx; /*Count of PDUs dropped due to Out of Window reception for all Ues */
1162 uint32_t numRlcAmCellSduRx; /* Count of SDUs received in UL for all UEs*/
1163 uint32_t numRlcAmCellSduBytesRx;/*Total number of bytes received in UL for all Ues*/
1164 uint32_t numRlcAmCellNackRx; /*Total number of UL PDUs nacked for all the Ues*/
1165 uint32_t numRlcAmCellWinStall; /*Number of window stalls detected for all the Ues */
1168 typedef struct _umRlcStats
1170 uint32_t numDLBytesUnused;
1171 uint32_t numDLMaxRetx;
1172 uint32_t numULPdusDiscarded;
1173 uint32_t numULReAsmblTimerExpires;
1174 uint32_t numULPdusOutsideWindow;
1177 typedef struct _rlcStats
1179 AMRLCStats amRlcStats;
1180 UMRLCStats umRlcStats;
1185 /* kw005.201 added support for L2 Measurement */
1187 typedef struct rlcSduSnMap RlcSduSnMap;
1188 typedef RguLchMapInfo KwLchMapInfo;
1189 #endif /* LTE_L2_MEAS */
1191 /** @defgroup ummode UM Module Info
1194 * @brief Structure to hold an Unacknowledged Mode header
1197 * - si : Segmentation Info
1198 * - sn : Sequence number
1199 * - so : Segmentation offset
1201 typedef struct rlcUmHdr
1203 uint8_t si; /*!< Segmentation Info */
1204 RlcSn sn; /*!< Sequence number */
1205 uint16_t so; /*!< Segmentation offset */
1209 * @brief Structure to hold an Acknowledged Mode header
1212 * - dc : Data/Control PDU
1213 * - rf : Resegmentation flag
1215 * - fi : Framing Info
1216 * - e : Extension bit
1217 * - lsf : Last segment flat
1218 * - sn : Sequence number
1219 * - so : Segment offset
1220 * - numLi : Number of length indicators in the following array (li)
1221 * - li : Length indicators
1223 typedef struct rlcAmHdr
1225 uint8_t dc; /*!< Data/Control PDU */
1226 uint8_t p; /*!< Poll bit */
1227 uint8_t si; /*!< Segmentation Info: 5GNR */
1228 RlcSn sn; /*!< Sequence number */
1229 uint32_t so; /*!< Segment offset */
1232 /* structures used for encoding/decoding the headers */
1233 typedef struct rlcCntrlInfo
1244 typedef struct rlcHdrInfo
1255 typedef struct rlcExtHdr
1264 * @brief Structure to hold information about a Logical channel
1267 * - lChId : Logical channel Id
1268 * - lChType : Logical channel type
1270 typedef struct rlcLchInfo
1272 CmLteLcId lChId; /*!< Logical channel Id */
1273 CmLteLcType lChType; /*!< Logical channel type */
1276 /* kw005.201 added support for L2 Measurement */
1279 /** @struct RlcL2Cntr
1281 typedef struct rlcL2Cntr
1285 uint32_t numActvUe; /*!< number of active Ue */
1286 uint32_t sampOc; /*!< Total number of sampling occasion */
1290 uint32_t dLoss; /*!< Total number of lost packets */
1291 uint32_t posPkts; /*!< Total number of positively acknowlegded
1294 struct /*!< For DL IP throughput */
1296 uint32_t volSummation; /*!< Sum of data in bytes */
1297 uint32_t timeSummation; /*!< Sum of time difference in milli sec*/
1299 struct /*!< For UL IP throughput */
1301 uint32_t volSummation; /*!< Sum of data in bytes */
1302 uint32_t timeSummation; /*!< Sum of time difference in milli sec*/
1304 /* Discard new changes starts */
1305 struct /*!< For UL IP throughput */
1307 uint32_t discSdus; /*!< Total RLC SDUs discarded */
1308 uint32_t totSdus; /*!< Total RLC SDUs received */
1310 struct /*!< For UL IP throughput */
1312 uint64_t sduDelay; /*!< Total SDUs delay */
1315 uint32_t totDrbsPerQci; /*!< Total Count of DRB's for this QCI */
1325 uint16_t snList[RLC_MAX_PDU_MAP];
1331 typedef struct rlcSnSduMap
1334 CmLteLcId lChId; /*!< Logical channel Id */
1337 Bool isBurstSplitted; /*!< true: burst for this LCH is splitted */
1338 #endif /* LTE_RLC_R9 */
1339 RlcSduSnMap *sduList[RLC_MAX_DL_LI];
1342 typedef struct rlcTbSnMap
1344 CmHashListEnt hlTbEnt;
1348 RlcSnSduMap snSduMap[RGU_MAX_PDU * RGU_MAX_LC];
1351 typedef struct rlcL2MeasCbUeMeasInfo
1353 CmLteRnti ueId; /*!< UE ID (Used only for IP Throughput
1355 CmLteCellId cellId; /*!< UE ID (Used only for IP Throughput
1357 Bool isValid; /*! < is this UE entry valid */
1358 uint8_t numLcId; /*!< Holds the number of LCh for which Ul Ip
1359 measurement is ON */
1360 uint8_t lcId[RLC_MAX_LCH_PER_UE]; /*!< Holds the list of LCh for which Ul ip
1361 measurement is ON */
1362 RlcL2Cntr measData[LKW_MAX_QCI];
1363 uint16_t numQci; /*!< number of valid qcI */
1364 uint8_t qci[LKW_MAX_QCI]; /*!< list of valid qcI */
1365 }RlcL2MeasCbUeMeasInfo;
1367 typedef struct rlcL2MeasCbIpThMeas
1371 uint8_t totQci[LKW_MAX_QCI];
1372 RlcL2MeasCbUeMeasInfo ueInfoLst[LKW_MAX_UE]; /*Added for handling meas for multiple ues*/
1373 }RlcL2MeasCbIpThMeas;
1375 typedef struct rlcL2MeasCbNonIpThMeas
1377 uint16_t numSamples; /*!< Number of samples to take on numActUe */
1378 uint16_t numQci; /*!< number of valid qcI */
1379 uint8_t qci[LKW_MAX_QCI]; /*!< list of valid qcI */
1380 RlcL2Cntr measData[LKW_MAX_QCI]; /*!< Measurement CB */
1381 }RlcL2MeasCbNonIpThMeas;
1383 typedef union rlcL2MeasCbIpNonIpThMeasVal
1385 RlcL2MeasCbIpThMeas ipThMeas;
1386 RlcL2MeasCbNonIpThMeas nonIpThMeas;
1387 }RlcL2MeasCbIpNonIpThMeasVal;
1389 /** @struct RlcL2MeasCb
1390 * RLC L2 Measurement CB */
1391 typedef struct rlcL2MeasCb
1393 uint8_t measType; /*!< Bit-wise set measurement types */
1394 RlcL2MeasCbIpNonIpThMeasVal val; /* Union of IP tpt or non-ip tpt */
1397 /** @struct RlcL2MeasEvtCb
1398 * RLC L2 Measurement Evt CB */
1399 typedef struct rlcL2MeasEvtCb
1401 uint32_t transId; /*!< TransId of Measurement Req */
1402 uint32_t cbIdx; /*!< TransId of Measurement Req */
1403 CmTimer l2Tmr; /* NOT USED */ /*!< L2 Timer per request */
1404 TmrCfg l2TmrCfg; /* NOT USED */ /*!< Time period of measurement */
1405 RlcL2MeasCb measCb; /*!< Measurement CB */
1406 EpcTime startTime; /* NOT USED */ /*!< start time when meas starts*/
1409 /** @struct RlcL2MeasRbCb
1410 * RLC L2 Measurement Rb CB */
1411 typedef struct rlcL2MeasRbCb
1413 uint8_t measOn; /*!< Measurements that are running */
1414 RlcL2Cntr *l2Sts[RLC_MAX_L2MEAS_EVT]; /*!< L2 Mesurement statistics */
1419 typedef struct rlcL2Cb
1421 uint16_t rlcNumMeas; /*!< Number of measurements going on */
1422 RlcL2MeasEvtCb rlcL2EvtCb[LKW_MAX_L2MEAS]; /*!< Pointers to Measurement Cb */
1423 uint8_t measOn[LKW_MAX_QCI]; /*!< Measurement on */
1424 uint32_t numActUe[LKW_MAX_QCI]; /*!< Measurement on */
1428 typedef enum _dlIpThrputState
1430 KW_DL_IPTHRU_RESET = 0,
1431 KW_DL_IPTHRU_BURST_STARTED,
1432 KW_DL_IPTHRU_BURST_CONTINUE,
1433 KW_DL_IPTHRU_BURST_COMPLETED
1437 * @struct rlcL2MeasSduLst
1438 * Structure to hold parameters of
1439 * burst sdus in DL for a RB */
1440 typedef struct rlcOutStngSduInfo
1442 uint32_t sduId; /*!< SDU Id of sdu */
1443 MsgLen sduLen; /*!< Size of sdu */
1444 uint32_t numTb; /*!< Hold the number of TBs for this sdu in DL */
1448 * @struct rlcL2MeasDlIpTh
1449 * Structure to hold parameters for DL ip
1450 * throughput for a RB */
1451 typedef struct rlcL2MeasDlIpTh
1453 Bool isBurstAct; /*!< Set to TRUE when burst is active in DL */
1454 uint64_t burstStartTime; /*!< Holds the starting time of the burst */
1455 uint32_t burstEndSduId; /*!< Sdu ID when burst ends */
1456 uint8_t lastSduIdx; /*!< Holds the index of last outStanding sdu */
1457 RlcOutStngSduInfo outStngSduArr[RLC_L2MEAS_MAX_OUTSTNGSDU];/*!< Hold the burst sdu information */
1461 * @struct rlcL2MeasIpThruput
1462 * Structure to hold parameters for UL/DL ip
1463 * throughput for a RB */
1464 typedef struct rlcL2MeasIpThruput
1466 uint32_t dataVol; /*!< Holds volume of new data in bytes
1467 for UL IP throughput */
1468 uint32_t ttiCnt; /*!< Holds ttiCnt received from MAC in UL */
1469 uint32_t prevTtiCnt; /*!< Holds previous ttiCnt received from MAC in UL */
1470 RlcL2MeasDlIpTh dlIpTh;
1471 }RlcL2MeasIpThruput;
1473 #endif /* LTE_L2_MEAS */
1476 * @brief Structure to hold an UE key for the UE hast lists
1480 * - cellId : Cell Id
1482 typedef struct rlcUeKey
1484 CmLteRnti ueId; /*!< UE Id */
1485 CmLteCellId cellId; /*!< Cell Id */
1489 * @brief Structure to hold an information about the CKW SAP
1492 * - pst : Service user post structure
1493 * - spId : Service provider Id
1494 * - suId : Service user Id
1495 * - state : State of the SAP
1496 * - sts : SAP specific statistics
1498 typedef struct rlcCkwSapCb
1500 Pst pst; /*!< Service user post structure */
1501 SpId spId; /*!< Service provider Id */
1502 SuId suId; /*!< Service user Id */
1503 uint8_t state; /*!< Sap Status */
1504 RlcCkwCntSts sts; /*!< Statistics */
1508 * @brief Structure to hold an information about the KWU SAP
1511 * - pst : Service user post structure
1512 * - spId : Service provider Id
1513 * - suId : Service user Id
1514 * - state : State of the SAP
1515 * - sts : SAP specific statistics
1517 typedef struct rlcKwuSapCb
1519 Pst pst; /*!< Service user post structure */
1520 SpId spId; /*!< Service provider Id */
1521 SuId suId; /*!< Service user Id */
1522 uint8_t state; /*!< Sap Status */
1523 RlcKwuSapSts sts; /*!< Statistics */
1527 * @brief Structure to hold an information about the RGU SAP
1530 * - pst : Service user post structure
1531 * - spId : Service provider Id
1532 * - suId : Service user Id
1533 * - state : State of the SAP
1534 * - bndTmr : Bind Timer
1535 * - bndTmrInt : Timer Interval
1536 * - retryCnt : Bind Retry Count
1538 typedef struct rlcRguSapCb
1540 Pst pst; /*!< Service user post structure */
1541 SpId spId; /*!< Service provider Id */
1542 SuId suId; /*!< Service user Id */
1543 uint8_t state; /*!< Sap Status */
1544 CmTimer bndTmr; /*!< Bind Timer */
1545 uint16_t bndTmrInt; /*!< Timer Interval */
1546 uint8_t retryCnt; /*!< Bind Retry Count */
1550 * @brief Structure to hold an information about the UDX UL SAP
1553 * - pst : Service user post structure
1554 * - spId : Service provider Id
1555 * - suId : Service user Id
1556 * - state : State of the SAP
1557 * - bndTmr : Bind Timer
1558 * - bndTmrInt : Timer Interval
1559 * - retryCnt : Bind Retry Count
1561 typedef struct rlcUdxUlSapCb
1563 Pst pst; /*!< Service user post structure */
1564 SpId spId; /*!< Service provider Id */
1565 SuId suId; /*!< Service user Id */
1566 uint8_t state; /*!< Sap Status */
1567 CmTimer bndTmr; /*!< Bind Timer */
1568 uint16_t bndTmrInt; /*!< Timer Interval */
1569 uint8_t retryCnt; /*!< Bind Retry Count */
1573 * @brief Structure to hold an information about the UDX DL SAP
1576 * - pst : Service user post structure
1577 * - spId : Service provider Id
1578 * - suId : Service user Id
1579 * - state : State of the SAP
1581 typedef struct rlcUdxDlSapCb
1583 Pst pst; /*!< Service user post structure */
1584 SpId spId; /*!< Service provider Id */
1585 SuId suId; /*!< Service user Id */
1586 uint8_t state; /*!< Sap Status */
1590 * @brief Structure to hold info about memory to be freed
1593 * - sduLst : The SDU queues are appended to this queue, used
1594 * for the UM SDU queues
1595 * - txLst : Stores to be released AM Mode TX PDUs
1596 * - reTxLst : Stores to be released AM Re TX PDU's
1597 * - rbLst : List of AM DL RBs to be freed
1599 typedef struct rlcDlDataToBeFreed
1601 CmLListCp sduLst; /*!< Queue of SDU's to be freed */
1602 CmLListCp txLst; /*!< Stores to be released TX PDUs */
1603 CmLListCp reTxLst; /*!< Stores to be released ReTX PDUs */
1604 CmLListCp rbLst; /*!< List of AM DL RBs to be freed */
1605 }RlcDlDataToBeFreed;
1608 * @brief Structure to hold an information about DL RLC instance
1611 * - numKwuSaps : Number of RLC KWU Saps
1612 * - numUdxSaps : Number of RLC UDX Saps
1613 * - rlcKwuDlSap : Pointer to the array of KWU SAPS
1614 * - udxDlSap : Pointer to the array of UDX SAPS
1615 * - rguDlSap : RGU Sap Control Block
1616 * - cellLstCp : Hashlist of CellCb
1617 * - ueLstCp : Hashlist of UeCb
1618 * - toBeFreed : Pointer to data to be freed
1619 * - shutdownReveived : Request for shutdown recevied or not
1620 * - eventInQueue : Event for cleanup exists in queue or not
1622 typedef struct rlcDlCb
1624 uint8_t numKwuSaps; /*!< Number of RLC Data Saps */
1625 uint8_t numUdxSaps; /*!< Number of RLC Data Saps */
1626 RlcKwuSapCb *rlcKwuDlSap; /*!< KWU Sap Control Block */
1627 RlcUdxDlSapCb *udxDlSap; /*!< UDX DL Sap Control Block */
1628 RlcRguSapCb *rguDlSap; /*!< RGU Sap Control Block */
1629 CmHashListCp cellLstCp; /*!< Hashlist of CellCb */
1630 CmHashListCp ueLstCp; /*!< Hashlist of UeCb */
1631 RlcDlDataToBeFreed toBeFreed; /*!< Pointer to data to be freed */
1632 Pst selfPst; /*!< Pst to post events to self */
1633 Buffer *selfPstMBuf; /*!< Buffer used for self post */
1634 Bool shutdownReceived; /*!< Request for shutdown recevied */
1635 Bool eventInQueue; /*!< Event exists in queue or not */
1637 RlcL2Cb rlcL2Cb; /*!< Control Block for L2 Measurements in RLC */
1638 #endif /* LTE_L2_MEAS */
1642 * @brief Structure to hold an information about UL RLC instance
1645 * - ckwSap : CKW Sap Conrol Block
1646 * - numKwuSaps : Number of RLC KWU Saps
1647 * - numUdxSaps : Number of RLC UDX Saps
1648 * - udxUlSap : Pointer to the array of UDX SAPS
1649 * - rlcKwuUlSap : Pointer to the array of KWU SAPS
1650 * - rguUlSap : RGU Sap Control Block
1651 * - cellLstCp : Hashlist of CellCb
1652 * - ueLstCp : Hashlist of UeCb
1653 * - transIdLstCp : Hashlist of cfg trans
1655 typedef struct rlcUlCb
1657 RlcCkwSapCb ckwSap; /*!< CKW Sap Conrol Block */
1658 uint8_t numKwuSaps; /*!< Number of RLC Data Saps */
1659 uint8_t numUdxSaps; /*!< Number of RLC Data Saps */
1660 RlcUdxUlSapCb *udxUlSap; /*!< UDX DL Sap Control Block */
1661 RlcKwuSapCb *rlcKwuUlSap; /*!< KWU Sap Control Block */
1662 RlcRguSapCb *rguUlSap; /*!< RGU Sap Control Block */
1663 CmHashListCp cellLstCp; /*!< Hashlist of CellCb */
1664 CmHashListCp ueLstCp; /*!< Hashlist of UeCb */
1665 CmHashListCp transIdLstCp; /*!< Hashlist of cfg trans */
1666 uint8_t rlcUlUdxEventType; /*!<Ue Create/ReConfig> */
1667 /* kw005.201 added support for L2 Measurement */
1669 RlcL2Cb rlcL2Cb; /*!< Control Block for L2 Measurements in RLC */
1670 #endif /* LTE_L2_MEAS */
1673 typedef struct rlcThptPerUe
1680 * @brief Structure to hold information about throughput at RLC
1683 typedef struct rlcThpt
1685 Inst inst; /* RLC instance */
1686 CmTimer thptTmr; /* Throughput Timer */
1687 uint8_t numActvUe; /* Number of Active UEs */
1688 RlcThptPerUe thptPerUe[MAX_NUM_UE]; /* Throughput calculated per UE */
1692 * @brief Structure to hold an information about a RLC instance
1695 * - init : Task Initialization Info
1696 * - genCfg : General Configuration
1697 * - genSts : General Statistics
1698 * - trcLen : Trace Length
1699 * - trcMask : Trace Mask
1700 * - rlcTq : Timer queue
1701 * - rlcTqCp : Timer queue control point
1702 * - u : Union depending on whether the instance is UL or DL
1703 * - ulCb : UL instance Control Block
1704 * - dlCb : DL instance Control Block
1706 typedef struct rlcCb
1708 TskInit init; /*!< Task Initialization Info */
1709 RlcGenCfg genCfg; /*!< General Configuration Structure */
1710 RlcGenSts genSts; /*!< General Statistics */
1711 S16 trcLen; /*!< Trace Length */
1712 uint8_t trcMask; /*!< Trace Mask */
1713 CmTqType rlcTq[RLC_TMR_LEN]; /*!< Timer queue */
1714 CmTqCp rlcTqCp; /*!< Timer queue control point */
1717 RlcUlCb *ulCb; /*!< Ul Control Block */
1718 RlcDlCb *dlCb; /*!< Dl Control Block */
1720 uint8_t dlSduId; /*!< Downlink SDU ID */
1721 RlcThpt rlcThpt; /*!< Throughput at RLC*/
1724 RlcCb *rlcCb[MAX_RLC_INSTANCES]; /*!< RLC global control block */
1726 /****************************************************************************
1728 ***************************************************************************/
1729 S16 rlcGetSId ARGS((SystemId *s));
1731 Void rlcTmrExpiry ARGS((PTR cb, S16 tmrEvnt));
1733 S16 rlcLmmSendTrc ARGS ((RlcCb *gCb, Event event, Buffer *mBuf));
1735 void rlcStartTmr ARGS((RlcCb *gCb, PTR cb, S16 tmrEvnt));
1737 void rlcStopTmr ARGS((RlcCb *gCb, PTR cb, uint8_t tmrType));
1739 bool rlcChkTmr ARGS((RlcCb *gCb,PTR cb, S16 tmrEvnt));
1742 Void rlcLmmSendAlarm ARGS (( RlcCb *gCb,
1750 S16 RlcMiRlcDlL2MeasReq ARGS (( Pst *pst, RlcL2MeasReqEvt *measReqEvt ));
1751 S16 RlcMiRlcDlL2MeasSendReq ARGS((Pst *pst,uint8_t measType));
1752 S16 RlcMiRlcDlL2MeasStopReq ARGS((Pst *pst,uint8_t measType));
1753 S16 RlcMiRlcUlL2MeasReq ARGS (( Pst *pst, RlcL2MeasReqEvt *measReqEvt ));
1754 S16 RlcMiRlcUlL2MeasSendReq ARGS((Pst *pst,uint8_t measType));
1755 S16 RlcMiRlcUlL2MeasStopReq ARGS((Pst *pst,uint8_t measType));
1756 Void rlcUtlPlcMeasDatInL2Sts ARGS((RlcL2Cntr *measData,
1757 RlcL2MeasRbCb *rbL2Cb,
1759 #else /* LTE_L2_MEAS */
1760 Void rlcLmmSendAlarm ARGS ((RlcCb *gCb,
1766 #endif /* LTE_L2_MEAS */
1770 #endif /* __cplusplus */
1772 #endif /* __RLC_UTILS_H__ */
1773 /**********************************************************************
1776 **********************************************************************/