Merge "Fixes for SIB1 transmission in Radio Mode [Issue-ID: ODUHIGH-325]"
authorHarshita Lal <harshita.lal@radisys.com>
Fri, 14 May 2021 10:05:01 +0000 (10:05 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Fri, 14 May 2021 10:05:01 +0000 (10:05 +0000)
45 files changed:
src/5gnrmac/mac_msg_router.c [moved from src/5gnrmac/rg_ex_ms.c with 99% similarity]
src/5gnrrlc/kw.h [deleted file]
src/5gnrrlc/kw.x [deleted file]
src/5gnrrlc/kw_dl.h [deleted file]
src/5gnrrlc/kw_ptli.c [deleted file]
src/5gnrrlc/kw_ptmi.c [deleted file]
src/5gnrrlc/kw_udx.h [deleted file]
src/5gnrrlc/kw_ul.h [deleted file]
src/5gnrrlc/rlc_amm_dl.c [moved from src/5gnrrlc/kw_amm_dl.c with 99% similarity]
src/5gnrrlc/rlc_amm_ul.c [moved from src/5gnrrlc/kw_amm_ul.c with 99% similarity]
src/5gnrrlc/rlc_cfg_dl.c [moved from src/5gnrrlc/kw_cfg_dl.c with 99% similarity]
src/5gnrrlc/rlc_cfg_ul.c [moved from src/5gnrrlc/kw_cfg_ul.c with 99% similarity]
src/5gnrrlc/rlc_dbm_dl.c [moved from src/5gnrrlc/kw_dbm_dl.c with 98% similarity]
src/5gnrrlc/rlc_dbm_ul.c [moved from src/5gnrrlc/kw_dbm_ul.c with 98% similarity]
src/5gnrrlc/rlc_dl.h [moved from src/5gnrrlc/kw_dl.x with 81% similarity]
src/5gnrrlc/rlc_dl_msg_router.c [moved from src/5gnrrlc/kw_dl_ex_ms.c with 98% similarity]
src/5gnrrlc/rlc_dl_ul_inf.c [moved from src/5gnrrlc/kw_udx.c with 98% similarity]
src/5gnrrlc/rlc_dl_ul_inf.h [moved from src/5gnrrlc/kw_udx.x with 79% similarity]
src/5gnrrlc/rlc_dl_ul_inf_dl.c [moved from src/5gnrrlc/kw_udx_dl.c with 98% similarity]
src/5gnrrlc/rlc_dl_ul_inf_ptdl.c [moved from src/5gnrrlc/kw_udx_ptdl.c with 97% similarity]
src/5gnrrlc/rlc_dl_ul_inf_ptul.c [moved from src/5gnrrlc/kw_udx_ptul.c with 98% similarity]
src/5gnrrlc/rlc_dl_ul_inf_ul.c [moved from src/5gnrrlc/kw_udx_ul.c with 97% similarity]
src/5gnrrlc/rlc_env.h [moved from src/5gnrrlc/kw_env.h with 97% similarity]
src/5gnrrlc/rlc_err.h [moved from src/5gnrrlc/kw_err.h with 99% similarity]
src/5gnrrlc/rlc_layer_mgr.c [moved from src/5gnrrlc/kw_lmm.c with 99% similarity]
src/5gnrrlc/rlc_lwr_inf_mgr.c [moved from src/5gnrrlc/kw_lim.c with 98% similarity]
src/5gnrrlc/rlc_mgr.c
src/5gnrrlc/rlc_msg_hdl.c
src/5gnrrlc/rlc_portable_functions.c [moved from src/5gnrrlc/kw_ptui.c with 54% similarity, mode: 0644]
src/5gnrrlc/rlc_stats.c [moved from src/5gnrrlc/kw_tenb_stats.c with 96% similarity]
src/5gnrrlc/rlc_sys_id.c [moved from src/5gnrrlc/kw_id.c with 99% similarity]
src/5gnrrlc/rlc_tmm_dl.c [moved from src/5gnrrlc/kw_tmm_dl.c with 97% similarity]
src/5gnrrlc/rlc_tmm_ul.c [moved from src/5gnrrlc/kw_tmm_ul.c with 97% similarity]
src/5gnrrlc/rlc_tmr.c [moved from src/5gnrrlc/kw_tmr.c with 98% similarity]
src/5gnrrlc/rlc_ul.h [moved from src/5gnrrlc/kw_ul.x with 96% similarity]
src/5gnrrlc/rlc_ul_msg_router.c [moved from src/5gnrrlc/kw_ul_ex_ms.c with 98% similarity]
src/5gnrrlc/rlc_umm_dl.c [moved from src/5gnrrlc/kw_umm_dl.c with 97% similarity]
src/5gnrrlc/rlc_umm_ul.c [moved from src/5gnrrlc/kw_umm_ul.c with 99% similarity]
src/5gnrrlc/rlc_upr_inf_mgr.c [moved from src/5gnrrlc/kw_uim.c with 98% similarity]
src/5gnrrlc/rlc_utils.h [changed mode: 0644->0755]
src/5gnrrlc/rlc_utl_dl.c [moved from src/5gnrrlc/kw_utl_dl.c with 99% similarity]
src/5gnrrlc/rlc_utl_ul.c [moved from src/5gnrrlc/kw_utl_ul.c with 98% similarity]
src/5gnrsch/sch_msg_router.c [moved from src/5gnrsch/rg_sch_ex_ms.c with 98% similarity]
src/du_app/du_mgr_msg_router.c [moved from src/du_app/du_mgr_ex_ms.c with 99% similarity]
src/du_app/du_ue_mgr.c

similarity index 99%
rename from src/5gnrmac/rg_ex_ms.c
rename to src/5gnrmac/mac_msg_router.c
index 8f5f68d..edb6639 100755 (executable)
   
      Desc:     C source code SSI Interface Implementation
   
-     File:     rg_ex_ms.c 
+     File:     mac_msg_router.c
   
 **********************************************************************/
 
-/** @file rg_ex_ms.c
+/** @file mac_msg_router.c
 @brief This file contains the implementation of callback functions 
 registered with SSI during the LTE MAC Task initialization.
 */
diff --git a/src/5gnrrlc/kw.h b/src/5gnrrlc/kw.h
deleted file mode 100755 (executable)
index 6bf6782..0000000
+++ /dev/null
@@ -1,1093 +0,0 @@
-/*******************************************************************************
-################################################################################
-#   Copyright (c) [2017-2019] [Radisys]                                        #
-#                                                                              #
-#   Licensed under the Apache License, Version 2.0 (the "License");            #
-#   you may not use this file except in compliance with the License.           #
-#   You may obtain a copy of the License at                                    #
-#                                                                              #
-#       http://www.apache.org/licenses/LICENSE-2.0                             #
-#                                                                              #
-#   Unless required by applicable law or agreed to in writing, software        #
-#   distributed under the License is distributed on an "AS IS" BASIS,          #
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
-#   See the License for the specific language governing permissions and        #
-#   limitations under the License.                                             #
-################################################################################
-*******************************************************************************/
-
-/********************************************************************20**
-  
-        Name:     NR RLC file
-
-        Type:     C include file
-  
-        Desc:     This file contain the hash definations for RLC 
-        File:     kw.h
-  
-*********************************************************************21*/
-/** @file kw.h
-@brief RLC Hash definitions
-*/
-
-#ifndef __KWH__
-#define __KWH__
-#include "du_log.h"
-\f 
-
-#define EKWxxx 1
-#define EMG099 1
-#define EMG102 2
-#define EMG103 3
-#define EMG104 4
-
-/* RLC-SPLIT Activity */
-#define RLC_ONE       1
-#define RLC_BIT0      0x01
-#define RLC_BIT1      0x02
-#define RLC_BIT2      0x04
-#define RLC_BIT3      0x08
-
-#define RLC_2K_BYTE   2048
-
-/* RLC RB flag bits */
-#define RLC_RB_REESTABLISH_DL  RLC_BIT0
-#define RLC_RB_REESTABLISH_UL  RLC_BIT1
-#define RLC_RB_DELETE_DL       RLC_BIT2
-#define RLC_RB_DELETE_UL       RLC_BIT3
-
-
-#define RLC_MOD_1024           0x3FF  /* used for MOD 1024 */
-
-
-\f 
-/************************************************************************
- *                            SAP States
- ************************************************************************/
-
-#define RLC_SAP_NOT_CFG        0     /*!< SAP Not Configured */
-#define RLC_SAP_CFG            1     /*!< SAP Configured but not not bound */
-#define RLC_SAP_BND            2     /*!< SAP Bound */
-#define RLC_SAP_BINDING        3     /*!< SAP Bind initiated */
-#define RLC_SAP_UBND           4     /*!< SAP Unbind */
-
-#define RLC_MAX_SAP_BND_RETRY  3     /*!< Maximum SAP Bin Retries */
-
-#define RLC_MAX_UE             0xffffffff  /*!< Maximum number of UEs. */
-
-/* Maximum number of Saps */
-#define RLC_MAX_UDXSAPS        1     /*!< Maximum number of UDX Saps */
-#define RLC_MAX_KWUSAPS        2     /*!< Maximum number of KWU Saps. */
-#define RLC_MAX_CKWSAPS        1     /*!< Maximum number of CKW Saps. */
-/*MCELL changes*/
-#define RLC_MAX_RGUSAPS        4//5     /*!< Maximum number of RGU Saps. */
-
-#define RLC_MAX_RGUSAP_TMR     1     /*!< Maximum number of RGU SAP Timers. */
-
-#define RLC_UI_RRC             0     /*!< Upper interface RRC sap Id. */
-#define RLC_UI_PDCP            1     /*!< Upper interface PDCP sap Id. */
-
-#ifdef LTE_L2_MEAS
-/* TODO. This works for FDD only. For TDD the array dimension
- * should be changed according to the number of Harq Procs */
-#define RLC_MAX_TB_PER_UE      64    /*!< Maximum number of tbCb for UE */
-#define RLC_INVALID_TBID       RLC_MAX_TB_PER_UE
-#endif
-/*******************************************************************************
- *                              Memory related Defines 
- ******************************************************************************/
-#ifdef MCCABE_COV
-/* Allocate function */
-#define RLC_ALLOC(_cb,_buf, _size)                                   \
-{                                                                   \
-   SGetSBuf(_cb->init.region, _cb->init.pool, (Data **)&_buf,       \
-                (Size) _size);                                     \
-      memset((_buf), 0, _size);                             \
-}
-
-#define RLC_RMV_SDU(_cb,_sduQ,_sdu)                    \
-{                                                     \
-   SPutMsg(_sdu->mBuf);                               \
-   cmLListDelFrm(_sduQ,&_sdu->lstEnt);                \
-   RLC_FREE(_cb,_sdu, sizeof(RlcSdu));               \
-}
-
-#define RLC_FREE(_cb,_buf, _size)                          \
-{                                                         \
-      (Void) SPutSBuf(_cb->init.region, _cb->init.pool,   \
-            (Data *) _buf, (Size) _size);                 \
-      _buf = NULLP;                                       \
-}
-
-#else
-
-#define RLC_FREE_SHRABL_BUF(_region, _pool,_buf, _size)    \
-{                                                         \
-   if (_buf != NULLP)                                     \
-   {                                                      \
-      (Void) SPutStaticBuffer(_region, _pool,             \
-            (Data *) _buf, (Size) _size, 0);                 \
-      _buf = NULLP;                                       \
-   }                                                      \
-}
-
-#define RLC_FREE_SHRABL_BUF_WC(_region, _pool,_buf, _size) \
-{                                                         \
-  (Void) SPutStaticBuffer(_region, _pool,                 \
-        (Data *) _buf, (Size) _size, 0);                 \
-  _buf = NULLP;                                       \
-}
-
-#define RLC_ALLOC_SHRABL_BUF_WC(_region, _pool,_buf, _size)           \
-{                                                                    \
- SGetStaticBuffer(_region, _pool, (Data **)&_buf,                    \
-                (Size) _size, 0);                                    \
-}
-
-#define RLC_ALLOC_SHRABL_BUF(_region, _pool,_buf, _size)              \
-{                                                                    \
- if (SGetStaticBuffer(_region, _pool, (Data **)&_buf,                \
-                (Size) _size, 0) == ROK)                                \
-   {                                                                 \
-      memset((_buf), 0, _size);                              \
-   }                                                                 \
-   else                                                              \
-   {                                                                 \
-      (_buf) = NULLP;                                                \
-   }                                                                 \
-}
-/* Allocate function */
-#define RLC_ALLOC(_cb,_buf, _size)                                    \
-{                                                                    \
- if (SGetSBuf(_cb->init.region, _cb->init.pool, (Data **)&_buf,      \
-                (Size) _size) == ROK)                                \
-   {                                                                 \
-      memset((_buf), 0, _size);                              \
-   }                                                                 \
-   else                                                              \
-   {                                                                 \
-      (_buf) = NULLP;                                                \
-   }                                                                 \
-}
-
-#define RLC_ALLOC_WC(_cb,_buf, _size)  \
-           SGetSBuf(_cb->init.region, _cb->init.pool, (Data **)&_buf, (Size) _size)     
-
-#define RLC_RMV_SDU(_cb,_sduQ,_sdu)              \
-{                                               \
-   if(_sdu->mBuf)                               \
-   {                                            \
-      SPutMsg(_sdu->mBuf);    \
-   }                                            \
-   cmLListDelFrm(_sduQ,&_sdu->lstEnt);          \
-   RLC_FREE(_cb,_sdu, sizeof(RlcSdu));            \
-}
-
-#define RLC_FREE(_cb,_buf, _size)                          \
-{                                                         \
-   if (_buf != NULLP)                                     \
-   {                                                      \
-      (Void) SPutSBuf(_cb->init.region, _cb->init.pool,   \
-            (Data *) _buf, (Size) _size);                 \
-      _buf = NULLP;                                       \
-   }                                                      \
-}
-
-#endif
-
-/* kw002.201 Freeing from region of pst */
-#define RLC_PST_FREE(_region, _pool, _buf, _size)          \
-{                                                         \
-   if (_buf != NULLP)                                     \
-   {                                                      \
-      (Void) SPutSBuf(_region, _pool,                     \
-                      (Data *) _buf, (Size) _size);       \
-      _buf = NULLP;                                       \
-   }                                                      \
-}
-
-#ifdef XEON_SPECIFIC_CHANGES
-#ifdef SS_LOCKLESS_MEMORY
-#define RLC_SHRABL_STATIC_BUF_FREE(_region, _pool, _buf, _size)     \
-{                                                                  \
-   if (_buf != NULLP)                                              \
-   {                                                               \
-      (Void) SPutStaticBuffer(_region, _pool,                      \
-                      (Data *) _buf, (Size) _size, 0);             \
-      _buf = NULLP;                                                \
-   }                                                               \
-}
-
-#define RLC_SHRABL_STATIC_BUF_ALLOC(_region, _pool, _buf, _size)     \
-{                                                                        \
- SGetStaticBuffer(_region, _pool, (Data **)&_buf,      \
-                (Size) _size, 0);                                        \
-}
-
-#else
-
-#define RLC_SHRABL_STATIC_BUF_FREE(_region, _pool, _buf, _size)     \
-{                                                                  \
-   if (_buf != NULLP)                                              \
-   {                                                               \
-      (Void) SPutSBuf(_region, _pool,                      \
-                      (Data *) _buf, (Size) _size);             \
-      _buf = NULLP;                                                \
-   }                                                               \
-}
-
-#define RLC_SHRABL_STATIC_BUF_ALLOC(_region, _pool, _buf, _size)     \
-{                                                                        \
- SGetSBuf(_region, _pool, (Data **)&_buf,      \
-                (Size) _size);                                        \
-}
-#endif /* SS_LOCKLESS_MEMORY */
-
-#else 
-
-#define RLC_SHRABL_STATIC_BUF_FREE(_region, _pool, _buf, _size)     \
-{                                                                  \
-   if (_buf != NULLP)                                              \
-   {                                                               \
-      (Void) SPutStaticBuffer(_region, _pool,                      \
-                      (Data *) _buf, (Size) _size, 0);             \
-      _buf = NULLP;                                                \
-   }                                                               \
-}
-
-#define RLC_SHRABL_STATIC_BUF_ALLOC(_region, _pool, _buf, _size)     \
-{                                                                        \
- SGetStaticBuffer(_region, _pool, (Data **)&_buf,      \
-                (Size) _size, 0);                                        \
-}
-#endif
-
-#define RLC_MEM_CPY(_dst, _src, _size)  memcpy(_dst, _src, _size); 
-
-#define RLC_MEM_ZERO(_buf, _size) memset((_buf), 0, _size);
-
-#define RLC_GET_MEM_REGION(_cb) (_cb->init.region)
-
-#define RLC_GET_MEM_POOL(_cb) (_cb->init.pool)
-
-#define RLC_GET_MEM_POOL_ADDRESS(_cb) (&_cb->init.pool)
-
-/* Memset to value */
-#define RLC_MEM_SET(_arg, _val, _size) memset(_arg, _val, _size); 
-
-/* Alarms */
-/* Send an alarm for sapId events */
-/* kw005.201 added support for L2 Measurement */
-#ifdef LTE_L2_MEAS
-#define RLC_GETSDUIDX(_sduIdx) \
-{\
-   _sduIdx = (((_sduIdx)+1) % RLC_L2MEAS_MAX_OUTSTNGSDU);\
-}
-#define RLC_SEND_SAPID_ALARM(_cb,_sapId, _evnt, _cause) \
-{ \
-   rlcLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, _sapId, 0, 0); \
-}
-#define RLC_SEND_UEID_ALARM(_cb,_ueId, _qci, _evnt, _cause) \
-{ \
-   rlcLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, 0, _ueId, _qci); \
-}
-#else /* LTE_L2_MEAS */
-#define RLC_SEND_SAPID_ALARM(_cb,_sapId, _evnt, _cause) \
-{ \
-   rlcLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, _sapId, 0); \
-}
-#define RLC_SEND_UEID_ALARM(_cb,_ueId, _evnt, _cause) \
-{ \
-   rlcLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, 0, _ueId); \
-}
-#endif /* LTE_L2_MEAS */
-
-/*******************************************************************************
- *                              Common Defines 
- ******************************************************************************/
-
-/* RLC Configuration parameters */
-#define RLC_MAX_UL_LI                (2 * RLC_MAX_LI)
-/*macro RLC_MAX_DL_LI is moved to kw_env.h file */
-#define RLC_MAX_DAT                  RLC_MAXIMUM_DAT
-/*macro RLC_MAX_PDU is moved to kw_env.h file */
-#define RLC_MAX_RB_PER_CELL          10
-#define RLC_MAX_SRB_PER_UE           3
-#define RLC_MAX_DRB_PER_UE           32
-#define RLC_MAX_LCH_PER_UE           12
-#define RLC_MAX_LCH_PER_CELL         6
-#define RLC_MAX_NUM_RB               24
-#define RLC_MAX_UE                   0xffffffff 
-#define RLC_UE_LIST_BUCKET_SIZE      128 
-#define RLC_CELL_LIST_BUCKET_SIZE    10 
-#define RLC_TRANS_ID_LST_BKT_SIZE    10 
-#define RLC_MAX_RB                   32
-
-/* RLC Mode defines */
-#define RLC_MODE_TM 1
-#define RLC_MODE_UM 2
-#define RLC_MODE_AM 3
-
-/* Direction defines */
-#define RLC_DIR_UL        1     /*!< Unlink direction */
-#define RLC_DIR_DL        2     /*!< Downlink direction */
-#define RLC_DIR_BOTH      3     /*!< Both Downlink and Unlink */
-
-#define RLC_DEF_SEQ_NUM 0 /**< Sequence number to pick in case of duplicate
-                              entries in hash list searches*/
-
-/**
- * @def RLC_MIN
- *
- *    Macro to find the miniumum of two numbers
- *
- * @param[in] x    First number
- * @param[in] y    Second number
- *
-*/
-#define RLC_MIN(x,y) (x) < (y) ? (x) : (y)
-
-/**
- * @def RLC_GET_RLCCB
- *
- *    Macro to the RLC instance
- *
- * @param[in] _inst    Instance Id
- *
-*/
-#define RLC_GET_RLCCB(_inst) rlcCb[_inst]                              
-
-#define RLC_ADD_SDU            1     /*!< Add SDU. */
-#define RLC_DEL_SDU            2     /*!< Delete SDU. */
-
-#define RLC_CFM_NOK            0     /*!< Do not send DatCfm */
-#define RLC_CFM_OK             1     /*!< Send DatCfm */
-
-/* Set the unsolictated Status flag */
-#define RLC_SET_USTA_FLAG(_rlcCb, _value) \
-{ \
-   _rlcCb->init.usta = _value; \
-}
-
-/* Macros to get the init parameters */
-#define RLC_GET_DBG_MASK(_rlcCb) (_rlcCb->init.dbgMask)
-#define RLC_GET_LMPST_MEM_POOL(_rlcCb) (_rlcCb->init.lmPst.pool)
-#define RLC_GET_LMPST_MEM_REGION(_rlcCb) (_rlcCb->init.lmPst.region)
-
-/* Macros for configuration module */
-#define RLC_CFG_FILL_CFG_CFM(_entCfm, _rbId, _rbType, _status, _reason)  \
-{                                                              \
-   _entCfm->rbId  = _rbId;                                     \
-   _entCfm->rbType = _rbType;                                  \
-   _entCfm->status.status = _status;                           \
-   _entCfm->status.reason = _reason;                           \
-} 
-
-/**
- * @def RLC_VALIDATE_UE_RBID
- *
- *    This macro validates whether the _rbId passed is valid or not. It checks
- *    if the _rbId is within the maximum value depending on the _rbType.
- *    Returns TRUE if valid else FALSE
- *
- * @param[in] _rbType    Type of the Radio Bearer; SRB or DRB
- * @param[in] _rbId      RB Id of the RB to be validated
- *
-*/ 
-#define RLC_VALIDATE_UE_RBID(_rbType, _rbId)                     \
-       ((_rbType == CM_LTE_SRB && _rbId < RLC_MAX_SRB_PER_UE) || \
-       (_rbType == CM_LTE_DRB && _rbId < RLC_MAX_DRB_PER_UE))
-
-/*******************************************************************************
- *                              UIM Defines 
- ******************************************************************************/
-#if (ERRCLASS & ERRCLS_INT_PAR)
-#define RLC_VALDATE_SAP(_cb,_chkSpId, _sap, _ret)                             \
-{                                                                            \
-   if (_chkSpId != _sap->spId)                                               \
-   {                                                                         \
-      RLCLOGERROR(_cb,ERRCLS_DEBUG, EKWxxx, (ErrVal) RFAILED,                 \
-            "Sap Id Validation Failed.");                                    \
-      _ret = RFAILED;                                                        \
-   }                                                                         \
-   /* SAP state validation */                                                \
-   if(_sap->state != RLC_SAP_BND)                                             \
-   {                                                                         \
-      RLCLOGERROR(_cb,ERRCLS_INT_PAR, EKWXXX, (ErrVal) RFAILED,               \
-            "Sap State Invalid.");                                           \
-      RLC_SEND_SAPID_ALARM(_cb,0, LCM_EVENT_UI_INV_EVT, LCM_CAUSE_INV_STATE); \
-      _ret = RFAILED;                                                        \
-   }                                                                         \
-}
-#else /* ERRCLASS & ERRCLS_INT_PAR */
-#define RLC_VALDATE_SAP(_cb,_chkSpId, _sap, _ret)                             \
-{                                                                            \
-   /* SAP state validation */                                                \
-   if(_sap->state != RLC_SAP_BND)                                             \
-   {                                                                         \
-      RLCLOGERROR(_cb,ERRCLS_INT_PAR, EKWXXX, (ErrVal) RFAILED,               \
-            "Sap State Invalid.");                                           \
-      RLC_SEND_SAPID_ALARM(_cb,0, LCM_EVENT_UI_INV_EVT, LCM_CAUSE_INV_STATE); \
-      _ret = RFAILED;                                                        \
-   }                                                                         \
-}
-#endif /* ERRCLASS & ERRCLS_INT_PAR */
-
-/*******************************************************************************
- *                              Timer Defines 
- ******************************************************************************/
-#define RLC_TMR_LEN                     10
-#define RLC_MAX_UM_TMR                  1
-#define RLC_MAX_AM_TMR                  3
-#define RLC_MAX_THPT_TMR                1
-
-/* Timer events */
-#define EVENT_RLC_UMUL_REASSEMBLE_TMR     1
-#define EVENT_RLC_AMUL_REASSEMBLE_TMR          2
-#define EVENT_RLC_AMUL_STA_PROH_TMR       3
-#define EVENT_RLC_AMDL_POLL_RETX_TMR      4
-#define EVENT_RLC_WAIT_BNDCFM             5
-/* kw005.201 added support for L2 Measurement */
-#ifdef LTE_L2_MEAS
-#define EVENT_RLC_L2_TMR                  6
-#endif /* LTE_L2_MEAS */
-#define EVENT_RLC_THROUGHPUT_TMR          7
-
-/*******************************************************************************
- *                              DBM Defines 
- ******************************************************************************/
-/**
- * @def RLC_DBM_GET_RBCB_FROM_UECB
- *
- *    This macro makes _rbCb point to the RB in _ueCb based on the passed 
- *    _rbId and _rbType. _rbCb can point to NULLP
- *
- * @param[in] _rbId      RB Id of the RB to be fetched
- * @param[in] _rbType    Type of the RB, SRB or DRB
- * @param[in] _ueCb      Pointer to the UECb for which to get the RB
- * @param[out] _rbCb     Pointer to the found RbCb
- *
-*/
-#define RLC_DBM_GET_RBCB_FROM_UECB(_rbId, _rbType, _ueCb, _rbCb)            \
-           (_rbCb) = ((_rbType) == CM_LTE_SRB) ? (_ueCb)->srbCb[(_rbId)] : \
-                                                 (_ueCb)->drbCb[(_rbId)];     
-/**
- * @def RLC_DBM_GET_CELL_RBCB
- *
- *    This macro makes _rbCb point to the RB in the _rbCbLst. 
- *    _rbCb can point to NULLP
- *
- * @param[in] _rbId         RB Id of the RB to be fetched
- * @param[in] _rbCbLst      Pointer to array of RBCbs
- * @param[out] _rbCb        Pointer to the found RbCb
- *
-*/
-#define RLC_DBM_GET_CELL_RBCB(_rbId, _rbCbLst, _rbCb) \
-           (_rbCb) = (_rbCbLst)[(_rbId)]; 
-
-/*******************************************************************************
- *                              UMM Defines 
- ******************************************************************************/
-#define RLC_UMDL     rbCb->m.umDl 
-#define RLC_UMUL     rbCb->m.umUl 
-
-/* Sequence Number length defines */
-#define RLC_UM_CFG_6BIT_SN_LEN      1 /**< UM 6-bit Sequence number length 
-                                          in bytes*/   
-#define RLC_UM_CFG_12BIT_SN_LEN     2 /**< UM 12-bit Sequence number length 
-                                          in bytes*/
-/* 5GNR */
-/* Sequence Number length defines */
-#define RLC_AM_CFG_12BIT_SN_LEN      1 /**< AM 12-bit Sequence number length 
-                                          in bytes*/   
-#define RLC_AM_CFG_18BIT_SN_LEN      2 /**< AM 18-bit Sequence number length 
-                                          in bytes*/
-
-/**
- * @def RLC_RMV_MAC_HDR_SZ
- *
- *    If PDU size is greater than 127, MAC header would be 3 bytes else 2 bytes
- *
- * @param[in,out] _pduSz        Size of the pdu 
- *
-*/
-#define RLC_RMV_MAC_HDR_SZ(_pduSz) (_pduSz) -= ((_pduSz) > 127) ? 3 : 2;
-
-/**
- * @def RLC_UM_GET_VALUE
- *
- *    This macro is used to calculate the value of UM state variables used 
- *    in comparisons.  VR(UH) - UM Window Size is taken as the base modulus.
- *    Returns the modifed value
- *
- * @param[in] _val               Value of the state variable 
- * @param[in] _kwUmUl        Um Uplink control block
- *
-*/ 
-#define RLC_UM_GET_VALUE(_val,_kwUmUl)  \
-     (((_val) - ((_kwUmUl).vrUh - (_kwUmUl).umWinSz)) & ((_kwUmUl).modBitMask))
-     
-/*******************************************************************************
- *                              AMM Defines 
- ******************************************************************************/ 
-#define RLC_AMDL                           rbCb->m.amDl 
-#define RLC_AMUL                           rbCb->m.amUl
-
-/* PDU Types */
-#define RLC_DATA_PDU  1
-#define RLC_CNTRL_PDU 0
-
-#define RLC_FI_FIRST_SEG                0x02
-#define RLC_FI_LAST_SEG                 0x01
-#define RLC_SI_FIRST_SEG                0x01
-#define RLC_SI_LAST_SEG                 0x02
-#define RLC_SI_MID_SEG                  0x03
-
-#define RLC_POLL_SET                    0x40 /* 01000000 */
-#define RLC_POLL_UNSET                  0xbf /* 10111111 */
-#define RLC_MAX_NACK_CNT                100
-/*RLC_MAX_CNTRL_FIELDS (Maximum size of Status Pdu) 
- *  = MAX_NACK_CNT * sizeof(NACK_SN,E1,E2,E3,soStart,soEnd, nackRange)
- * for 18 bit SN + Fixed Header*/
-#define RLC_MAX_CNTRL_FIELDS            ((RLC_MAX_NACK_CNT * 8) + 3)  
-
-/* Each LI(Length Indicator) holds approx 1+1/2 byte and some other fields thus keeping Header Size equal to twice of MAX LI */
-/* 5GNR_RLC: Need to change value of HDRSZ as per number of PDUs going in one datReq */
-#define RLC_MIN_HDRSZ                         1
-#define RLC_MAX_HDRSZ                         5 
-#define RLC_AM_PDU_FIXED_HDRSZ                2
-#define RLC_AM_PDU_12BIT_SN_HDRSZ             2
-#define RLC_AM_PDU_18BIT_SN_HDRSZ             3
-#define RLC_AM_SEG_12BIT_SN_WITH_SO_HDRSZ     4
-#define RLC_AM_SEG_18BIT_SN_WITH_SO_HDRSZ     5
-#define RLC_AM_SEG_12BIT_SN_WITHOUT_SO_HDRSZ  2
-#define RLC_AM_SEG_18BIT_SN_WITHOUT_SO_HDRSZ  3
-#define RLC_EXTN_HDRSZ                  2
-#define RLC_CNTRL_PDU_FIXED_HDRSZ       3
-#define RLC_MAC_HDR_SZ2                 2
-#define RLC_MAC_HDR_SZ3                 3
-#define RLC_BYTE_LEN                    8
-#define RLC_2BYTE_LEN                   16
-#define RLC_E1_LEN                      1
-#define RLC_NACK_E1E2_LEN               12
-#define RLC_SO_LEN                      15
-#define RLC_DC_LEN                      1
-#define RLC_CPT_LEN                     3
-#define RLC_RF_LEN                      1
-#define RLC_P_LEN                       1
-#define RLC_FI_LEN                      2
-#define RLC_SI_LEN                      2
-#define RLC_E_LEN                       1
-#define RLC_SN_LEN                      10
-#define RLC_SN_LEN_12BITS               12
-#define RLC_SN_LEN_18BITS               18
-#define RLC_LSF_LEN                     1
-#define RLC_LI_LEN                      11
-#define RLC_STA_PDU_R_BITS_ACKSN_12BITS 7  /* 5GNR : Num Reserved bits in STATUS PDU */
-#define RLC_STA_PDU_R_BITS_ACKSN_18BITS 1
-#define RLC_STA_PDU_R_BITS_NACKSN_12BITS 1
-#define RLC_STA_PDU_R_BITS_NACKSN_18BITS 3
-#define RLC_NACK_RANGE_LEN               8
-#define RLC_SO_LEN_5GNR                  16
-
-#define RLC_DC_POS                      0x80
-#define RLC_DC_SHT                      7      
-#define RLC_POLL_POS                    0x40 /* 5GNR */
-#define RLC_POLL_SHT                    6    /* 5GNR */
-#define RLC_SI_POS                      0x30 /* 5GNR */
-#define RLC_SI_SHT                      4    /* 5GNR */
-#define RLC_SN_POS_12BIT                0x0F
-#define RLC_SN_POS_18BIT                0x03
-#define RLC_AM_GET_WIN_SZ(_snLen)       ((RLC_AM_CFG_12BIT_SN_LEN == (_snLen)) ? (2048) : (131072)) /* 5GNR */
-#define RLC_RCV_BUF_BIN_SIZE 512   /* receive buffer size */
-#define RLC_TX_BUF_BIN_SIZE 512   /* receive buffer size */
-
-#define RLC_SDU_LST                     1
-#define RLC_SEG_LST                     2
-#define RLC_RETX_LST                    3
-#define RLC_ALL_BYTES_MISSING           0xffff
-
-#define RLC_MAX_PDU_MAP                 30       /*!< Maximum PDU Map. */
-
-#define RLC_LLIST_FIRST_SDU(lstCp, nod)          \
-{                                               \
-   CmLList *tmpNode;                            \
-   /*CM_LLIST_FIRST_NODE(&(lstCp), tmpNode);*/      \
-   /*if (tmpNode != NULLP)*/                        \
-   if((tmpNode=cmLListFirst(&lstCp)))            \
-      nod = (RlcSdu *)tmpNode->node;             \
-   else                                         \
-      nod = NULLP;                              \
-}                                                          
-
-                                                           
-#define RLC_LLIST_FIRST_SEG(lstCp, nod)         \
-{                                              \
-   CmLList *tmpNode;                           \
-   /*CM_LLIST_FIRST_NODE(&(lstCp), tmpNode);*/     \
-   /*if (tmpNode != NULLP)*/                       \
-   if((tmpNode=cmLListFirst(&lstCp)))            \
-      nod = (RlcSeg *)tmpNode->node;            \
-   else                                        \
-      nod = NULLP;                             \
-}                                                          
-
-#define RLC_LLIST_FIRST_RETX(lstCp, nod)        \
-{                                              \
-   CmLList *tmpNode;                           \
-   /*CM_LLIST_FIRST_NODE(&(lstCp), tmpNode);*/     \
-   /*if (tmpNode != NULLP)*/                       \
-   if((tmpNode=cmLListFirst(&lstCp)))            \
-      nod = (RlcRetx *)tmpNode->node;           \
-   else                                        \
-      nod = NULLP;                             \
-}
-
-#define RLC_LLIST_NEXT_SDU(lstCp, nod)          \
-{                                              \
-   CmLList *tmpNode;                           \
-   /*CM_LLIST_NEXT_NODE(&(lstCp), tmpNode);*/      \
-   /*if (tmpNode != NULLP)  */                     \
-   if((tmpNode = cmLListNext(&lstCp)))          \
-      nod = (RlcSdu *)tmpNode->node;            \
-   else                                        \
-      nod = NULLP;                             \
-}                                              
-
-
-#define RLC_LLIST_NEXT_SEG(lstCp, nod)          \
-{                                              \
-   CmLList *tmpNode;                           \
-   (lstCp).crnt = &((nod)->lstEnt);            \
-   /*CM_LLIST_NEXT_NODE(&(lstCp), tmpNode);*/      \
-   /*if (tmpNode != NULLP)*/                       \
-   if((tmpNode = cmLListNext(&lstCp)))           \
-      nod = (RlcSeg *)tmpNode->node;            \
-   else                                        \
-      nod = NULLP;                             \
-}      
-
-                                        
-#define RLC_LLIST_NEXT_RETX(lstCp, nod)         \
-{                                              \
-   CmLList *tmpNode;                           \
-   /*CM_LLIST_NEXT_NODE(&(lstCp), tmpNode);*/      \
-   /*if (tmpNode != NULLP) */                      \
-   if ((tmpNode = cmLListNext(&lstCp)))          \
-      nod = (RlcRetx *)tmpNode->node;           \
-   else                                        \
-      nod = NULLP;                             \
-}
-
-
-#define RLC_LLIST_LAST_RETX(lstCp, nod)         \
-{                                              \
-   CmLList *tempNode = NULLP;                  \
-   cmLListLast(&lstCp);                        \
-   tempNode = cmLListCrnt(&lstCp);             \
-   if (tempNode != NULLP)                      \
-      nod = (RlcRetx *)tempNode->node;          \
-   else                                        \
-      nod = NULLP;                             \
-}
-
-#define RLC_LLIST_LAST_SEG(lstCp, nod)          \
-{                                              \
-   CmLList *tempNode = NULLP;                  \
-   cmLListLast(&lstCp);                        \
-   tempNode = cmLListCrnt(&lstCp);             \
-   if (tempNode != NULLP)                      \
-      nod = (RlcSeg *)tempNode->node;           \
-   else                                        \
-      nod = NULLP;                             \
-}
-
-#define RLC_LLIST_LAST_SDU(lstCp, nod)          \
-{                                              \
-   CmLList *tempNode = NULLP;                  \
-   cmLListLast(&lstCp);                        \
-   tempNode = cmLListCrnt(&lstCp);             \
-   if (tempNode != NULLP)                      \
-      nod = (RlcSdu *)tempNode->node;           \
-   else                                        \
-      nod = NULLP;                             \
-}
-
-#define CM_LLIST_INS_AFT_CRNT(lstCp, nod)      \
-{                                              \
-   CmLList *nodeToIns = &nod->lstEnt;\
-   nodeToIns->node = (PTR) nod;\
-   cmLListInsAfterCrnt(&lstCp, nodeToIns);     \
-}
-
-#define CM_LLIST_INS_BEF_CRNT(lstCp, nod)      \
-{                                              \
-   CmLList *nodeToIns = &nod->lstEnt;          \
-   nodeToIns->node = (PTR) nod;                \
-   cmLListInsCrnt(&lstCp, nodeToIns);          \
-}
-
-#define RLC_LLIST_DEL_RECBUF(_recBuf)                      \
-{                                                          \
-   RlcSeg  *_seg = NULLP;                                  \
-   RLC_LLIST_FIRST_SEG(_recBuf->segLst, _seg);             \
-   while (_seg)                                            \
-   {                                                       \
-      cmLListDelFrm(&_recBuf->segLst, &_seg->lstEnt);      \
-      RLC_FREE(_seg, sizeof(RlcSeg));                      \
-      RLC_LLIST_NEXT_SEG(_recBuf->segLst, _seg);           \
-   }                                                       \
-}
-
-#define RLC_UMM_LLIST_FIRST_SEG(lstCp, nod)         \
-{                                              \
-   CmLList *tmpNode;                           \
-   if((tmpNode=cmLListFirst(&lstCp)))            \
-      nod = (RlcUmSeg *)tmpNode->node;            \
-   else                                        \
-      nod = NULLP;                             \
-} /*!< um mode first segment of linked list*/
-
-#define RLC_UMM_LLIST_NEXT_SEG(lstCp, nod)          \
-{                                              \
-   CmLList *tmpNode;                           \
-   (lstCp).crnt = &((nod)->lstEnt);            \
-   if((tmpNode = cmLListNext(&lstCp)))           \
-      nod = (RlcUmSeg *)tmpNode->node;            \
-   else                                        \
-      nod = NULLP;                             \
-}/*!< next segment in um mode linked list*/
-
-#define MODAMT(x, y, z,_snModMask)   \
-{                         \
-   y = (x - z) & _snModMask;   \
-}                                                         
-
-#define MODAMR(x, y, z , _snModMask)   \
-{                         \
-   y = (x - z) & (_snModMask);   \
-}
-
-/**
- * @def RLC_AM_IS_TRANS_WIN_STALLED
- *
- *    This macro is used to check if the AM transmit window is stalled or not.
- *    The tramist window is stalled when the distance between txNext and txNextAck
- *    is greater than equal to Window Size. Actually it should never be greater 
- *    than Window Size.
- *    Returns TRUE if the window is stalled else FALSE
- *
- * @param[in] _amDl     AM Downlink control block
- *
-*/ 
-#define RLC_AM_IS_TRANS_WIN_STALLED(_amDl)  \
-     ((((_amDl)->txNext - (_amDl)->txNextAck) & _amDl->snModMask) >= (RLC_AM_GET_WIN_SZ(_amDl->snLen)))
-
-#ifdef TENB_STATS
-#define RLC_AM_TRANS_WIN_SIZE(_amDl)  \
-     (((_amDl)->txNext - (_amDl)->txNextAck) & _amDl->snModMask)
-#endif
-
-#define RLC_AM_IS_POLL_BIT_SET(_amDl) \
-  (RLC_AMDL.pollSn == ((RLC_AMDL.txNext - 1) & RLC_AMDL.snModMask))
-
-#define RLC_FILL_CNTRL_INFO(cntrlInfo, _val, _len, _idx, _eb)\
-{                                                           \
-   cntrlInfo.val = _val;                                    \
-   cntrlInfo.len = _len;                                    \
-   cntrlInfo.idx = _idx;                                    \
-   cntrlInfo.emtBits = _eb;                                 \
-}
-#define RLC_FILL_PREV_IDX(cntrlInfo, _e1Idx, _e1eb, _idx, _eb) \
-{                                                                     \
-  _e1Idx = cntrlInfo.e1Idx;                                           \
-  _e1eb  = cntrlInfo.e1eb;                                            \
-  _idx   = cntrlInfo.idx;                                             \
-  _eb    = cntrlInfo.emtBits;                                         \
-}
-
-#define RLC_FILL_HDR_ARGS(hdrInfo, _val, _len)  \
-{                                              \
-   hdrInfo.val = _val;                         \
-   hdrInfo.len = _len;                         \
-}
-
-/* kw003.201 - This macro provides the header size other than the */
-/*             fixed header of 2 bytes for each AMD PDU or 4 bytes*/
-/*             for an AM PDU segment                              */
-#define RLC_AM_EXTN_HDRSZ(_numLi, _eHdrSz)       \
-{                                               \
-   if ((_numLi - 1) % 2)                        \
-   {                                            \
-      _eHdrSz = ((3 * (_numLi - 2)) >> 1) + 2;  \
-   }                                            \
-   else                                         \
-   {                                            \
-      _eHdrSz = (3 * (_numLi - 1)) >> 1;        \
-   }                                            \
-}
-
-/* Update poll bit in the buffer */
-#define RLC_UPD_POLL_BIT(_gCb, _retx, _poll)                \
-{                                                          \
-   uint8_t fHdr;                                                \
-                                                           \
-   if (_poll != _retx->amHdr.p)                            \
-   {                                                       \
-      /* Get the first byte of the buffer */               \
-      SRemPreMsg((Data *)&fHdr, _retx->seg);               \
-      if (_poll == TRUE)                                   \
-      {                                                    \
-         fHdr = fHdr | RLC_POLL_SET;                        \
-      }                                                    \
-      else                                                 \
-      {                                                    \
-         fHdr = fHdr & RLC_POLL_UNSET;                      \
-      }                                                    \
-      /* Concatenated updated hdr to the mBuf */           \
-      SAddPreMsg ((Data)fHdr, _retx->seg);                 \
-   }                                                       \
-   /* Update poll bit in the hdrInfo */                    \
-   _retx->amHdr.p = _poll;                                 \
-}
-
-#define RLC_AM_ELIMINATE_EXTN_HDR(_pduSz, _sduSz, _numLi)   \
-{                                                          \
-   if ( (_pduSz > _sduSz) && (_sduSz < 2048) )             \
-   {                                                       \
-      _pduSz -= (_numLi % 2) ? 1 : 2;                      \
-   }                                                       \
-}
-/**
- * @def RLC_AM_CHK_SN_WITHIN_RECV_WINDOW
- *
- *    This macro is used to check if a Sequence Number falls within the AM
- *    reception window or not.
- *    The condition is VR(R) <= SN < VR(MR), which are subtracting the base
- *    modulus becomes 0 <= (SN - VR(R)) % SNLen < (VR(MR) - VR(R)) % SnLen
- *    NOTE: Careful with the parantheses
- *
- *    Returns TRUE if within the window; FALSE otherwise
- *
- * @param[in] _sn       The sequence number to be checked
- * @param[in] _amUl     AM Uplink control block
- *
-*/
-#define RLC_AM_CHK_SN_WITHIN_RECV_WINDOW(_sn, _amUl)          \
-  ((((_sn) - (_amUl->rxNext)) & (_amUl->snModMask)) < (((_amUl->vrMr) - (_amUl->rxNext)) & (_amUl->snModMask))) 
-
-#define RLC_POWER(x, y)  x << (y-1); 
-
-#ifndef L2_OPTMZ
-#define rlcCpyMsg(_cb,x, y) \
-      (SAddMsgRef((x), RLC_GET_MEM_REGION(_cb), RLC_GET_MEM_POOL(_cb), (y)))
-#else
-/* L2 optimization for mUe/Tti: Removing dup buf*/
-#define rlcCpyMsg(_cb,x, y) \
-      (SIncMsgRef((x), RLC_GET_MEM_REGION(_cb), RLC_GET_MEM_POOL(_cb), (y)))
-#endif
-
-//      printf("Copy Msg %x \n",x);
-
-/*******************************************************************************
- *                              Debugging Defines 
- ******************************************************************************/
-#define RLC_DBG_SUB_MASK   DBGMASK_MI             /**< Use for sub-mask */
-#define RLC_DBGMASK_DETAIL (RLC_DBG_SUB_MASK << 0) /**< Parameters, It will give
-                                                      in depth info */
-#define RLC_DBGMASK_BRIEF  (RLC_DBG_SUB_MASK << 1) /**< Info, It will give info at
-                                                    entry and exit places along
-                                                   with certain state changes */
-#define RLC_DBGMASK_ERROR  (RLC_DBG_SUB_MASK << 2) /**< Error information */
-#define RLC_DBGMASK_FATAL  (RLC_DBG_SUB_MASK << 3) /**< FATAL errors like memory
-                                                    resource failure etc., */
-
-#define RLC_DBG_MDL_MASK (RLC_DBG_SUB_MASK << 4)
-
-#define RLC_DBGMASK_TM         (RLC_DBG_MDL_MASK << 0)    /**< TM */
-#define RLC_DBGMASK_UM         (RLC_DBG_MDL_MASK << 1)    /**< UM */
-#define RLC_DBGMASK_AM         (RLC_DBG_MDL_MASK << 2)    /**< AM */
-#define RLC_DBGMASK_DL         (RLC_DBG_MDL_MASK << 3)    /**< DL */
-#define RLC_DBGMASK_UL         (RLC_DBG_MDL_MASK << 4)    /**< UL */
-#define RLC_DBGMASK_CFG        (RLC_DBG_MDL_MASK << 5)    /**< CFG */
-#define RLC_DBGMASK_LMM        (RLC_DBG_MDL_MASK << 6)    /**< LMM */
-#define RLC_DBGMASK_INF        (RLC_DBG_MDL_MASK << 7)    /**< UI, LI */
-#define RLC_DBGMASK_DUT        (RLC_DBG_MDL_MASK << 8)    /**< DBM, UTL, TMR */
-#define RLC_DBGMASK_MBUF_PRNT  (RLC_DBG_MDL_MASK << 9)    /**< MBUF, useful in
-                                                             integrated 
-                                                             testing */
-#define RLC_DBGMASK_MEM_INFO   (RLC_DBG_MDL_MASK << 10)   /**< Print SSI memory
-                                                             information*/
-#define RLC_DBGMASK_UDX        (RLC_DBG_MDL_MASK << 11)   /**< UDX interface */
-
-#ifdef DEBUGP
-#define RLC_PRNT_BORDER                                   \
-do                                                       \
-{                                                        \
-   RLC_PRNT((_kwPBuf, "\n==========================\n")); \
-}while(0)
-
-#define RLC_PRNT_HLINE(_cb,_pMsg)                                              \
-{                                                                             \
-   sprintf((_cb)->init.prntBuf, "[RLC_LAYER: %s:%d]::", __FILE__, __LINE__);  \
-   SPrint((_cb)->init.prntBuf);                                               \
-   RLC_PRNT_TSTAMP(_cb);                                                       \
-   sprintf((_cb)->init.prntBuf, _pMsg);                                       \
-   SPrint((_cb)->init.prntBuf);                                               \
-}
-
-#define RLC_PRNT(_cb,_prntbuf)  \
-{                              \
-   sprintf _prntbuf;           \
-   SPrint(_cb->init.prntBuf);  \
-}
-
-#define RLC_PRINT_TO_BUFFER(_cb,...)                             \
-{                                                               \
-   snprintf((_cb)->init.prntBuf, PRNTSZE, "[%s]::", __func__);  \
-   SPrint((_cb)->init.prntBuf);                                 \
-   snprintf(_cb->init.prntBuf, PRNTSZE,__VA_ARGS__);            \
-   SPrint(_cb->init.prntBuf);                                   \
-}
-
-#define RLC_PRNT_TSTAMP(_cb)                                   \
-{                                                             \
-   S8 _buf[60];                                               \
-   DateTime dt;                                               \
-   memset((&dt), 0, sizeof(DateTime));                \
-   SGetDateTime(&dt);                                         \
-   sprintf(_buf, "date: %02d/%02d/%04d time: %02d:%02d:%02d", \
-     (int)dt.month,(int)dt.day,(int)dt.year + 1900,           \
-     (int)dt.hour,(int)dt.min,(int)dt.sec);                   \
-   RLC_PRNT(_cb,(_cb->init.prntBuf,("[%s]", _buf)));           \
-}
-
-#define RLC_PRNT_MBUF(_cb,_mBufPtr)                          \
-do                                                          \
-{                                                           \
-   if(_cb->init.dbgMask & (RLC_DBGMASK_MBUF_PRNT))           \
-   {                                                        \
-     RLC_PRNT_HLINE(_cb,("\nMessage Buffer Contents:\n"));   \
-     SPrntMsg ((Buffer *)_mBufPtr, 0, 0);                   \
-   }                                                        \
-}while(0)
-
-#define RLC_PRNT_MEMINFO(_cb)                                  \
-do                                                            \
-{                                                             \
-   uint32_t  _memInfo;                                             \
-   if(_cb->init.dbgMask & (RLC_DBGMASK_MEM_INFO))              \
-   {                                                          \
-     RLC_PRNT_HLINE(_cb,("\nMemory Information:\n"));          \
-     SRegInfoShow(0, &_memInfo);                              \
-   }                                                          \
-}while(0)
-
-#define RLCDBGP_INTERNAL(_cb,_mask,...)           \
-do                                               \
-{                                                \
-   if (!((_cb->init.dbgMask & _mask) ^ _mask))   \
-   {                                             \
-      RLC_PRINT_TO_BUFFER(_cb, __VA_ARGS__);      \
-   }                                             \
-}while(0)
-
-#define RLCDBGP_ERROR(_cb, ...) \
-   RLCDBGP_INTERNAL(_cb,(RLC_DBGMASK_ERROR | RLC_MODULE),__VA_ARGS__)
-
-#define RLCDBGP_DETAIL(_cb, ...) \
-   RLCDBGP_INTERNAL(_cb,(RLC_DBGMASK_DETAIL | RLC_MODULE),__VA_ARGS__)
-
-#define RLCDBGP_BRIEF(_cb, ...) \
-   RLCDBGP_INTERNAL(_cb,(RLC_DBGMASK_BRIEF | RLC_MODULE),__VA_ARGS__)   
-   
-#else  /* DEBUGP */ 
-#define RLC_PRNT_HLINE(_cb,_pMsg)
-#define RLC_PRNT(_cb,_prntbuf)
-#define RLC_PRNT_TSTAMP(_cb)
-#define RLC_PRNT_MBUF(_cb,_mBufPtr)
-#define RLC_PRNT_MEMINFO(_cb)
-#define RLCDBGP(_cb,_mask, _arg)
-#define RLCDBGP_ERROR(_cb, ...) 
-#define RLCDBGP_DETAIL(_cb, ...)
-#define RLCDBGP_BRIEF(_cb, ...)
-#endif /* DEBUGP */
-
-/*******************************************************************************
- *                              LMM Defines 
- ******************************************************************************/
-#define RLC_LMM_RB_STS_INC(_cb)    (_cb)->genSts.numOfRb++;
-
-#define RLC_LMM_RB_STS_DEC(_cb)    (_cb)->genSts.numOfRb--;
-
-#if defined(SS_MULTICORE_SUPPORT) && defined(SS_M_PROTO_REGION)
-#define RLC_FILL_SAP_HELPER(_Sap, _cfg, _gCb)\
-{\
-   _Sap->pst.selector = _cfg->selector; \
-   _Sap->pst.route = _cfg->route; \
-   _Sap->pst.prior =  _cfg->priority; \
-   _Sap->pst.region = _gCb->init.region;\
-   _Sap->pst.pool = _gCb->init.pool;\
-   _Sap->pst.dstProcId = _cfg->procId; \
-   _Sap->pst.dstEnt = _cfg->ent; \
-   _Sap->pst.dstInst = _cfg->inst; \
-   _Sap->pst.srcProcId = _gCb->init.procId; \
-   _Sap->pst.srcEnt = _gCb->init.ent; \
-   _Sap->pst.srcInst = _gCb->init.inst; \
-   _Sap->pst.event = EVTNONE; \
-   _Sap->spId = _cfg->sapId; \
-   _Sap->state = RLC_SAP_CFG; \
-}
-#else /* defined(SS_MULTICORE_SUPPORT) && defined(SS_M_PROTO_REGION) */
-#define RLC_FILL_SAP_HELPER(_Sap, _cfg, _gCb)\
-{\
-   _Sap->pst.selector = _cfg->selector; \
-   _Sap->pst.route = _cfg->route; \
-   _Sap->pst.prior =  _cfg->priority; \
-   _Sap->pst.region = _cfg->mem.region;\
-   _Sap->pst.pool = _cfg->mem.pool;\
-   _Sap->pst.dstProcId = _cfg->procId;\
-   _Sap->pst.dstEnt = _cfg->ent;\
-   _Sap->pst.dstInst = _cfg->inst;\
-   _Sap->pst.srcProcId = _gCb->init.procId;\
-   _Sap->pst.srcEnt = _gCb->init.ent;\
-   _Sap->pst.srcInst = _gCb->init.inst;\
-   _Sap->pst.event = EVTNONE;\
-   _Sap->spId = _cfg->sapId;\
-   _Sap->state = RLC_SAP_CFG;\
-}
-#endif
-
-/*******************************************************************************
- *                              UDX Defines 
- ******************************************************************************/
-#define RLC_GET_DL_SAPCB(_cb, _rbCb) (_cb->u.dlCb->udxDlSap + _rbCb->udxSapId)
-#define RLC_GET_UDX_SAP(_cb) (_cb->u.ulCb->udxUlSap)
-
-/* kw005.201 added support for L2 Measurement */
-#ifdef LTE_L2_MEAS
-#define RLC_L2_MAX_TIMERS        1
-#define RLC_QCI_LIST_BUCKET_SIZE 10
-#define RLC_TB_LIST_BUCKET_SIZE  10
-#define RLC_MAX_L2MEAS_EVT       10
-/* L2 Measurement index to be used in rbCb to store measData */                                       
-#define RLC_L2MEAS_ACT_UE       0                                       
-#define RLC_L2MEAS_DL_DELAY     1                                       
-#define RLC_L2MEAS_DL_DISC      2
-#define RLC_L2MEAS_UU_LOSS      3
-#define RLC_L2MEAS_DL_IP        4
-#define RLC_L2MEAS_UL_IP        5
-#endif /* LTE_L2_MEAS */
-
-#define RLC_RDWR_LOCK(_lockPtr)
-#define RLC_RDWR_UNLOCK(_lockPtr)
-#define RLC_TIME_DIFF(t1,t2)                  \
-   (t1<t2 ? ((0xffffffff - t2) + t1 ): (t1 - t2)) 
-
-#endif /* __KWH__ */
-\f  
-/********************************************************************30**
-  
-         End of file
-**********************************************************************/
diff --git a/src/5gnrrlc/kw.x b/src/5gnrrlc/kw.x
deleted file mode 100755 (executable)
index 7e378b4..0000000
+++ /dev/null
@@ -1,686 +0,0 @@
-/*******************************************************************************
-################################################################################
-#   Copyright (c) [2017-2019] [Radisys]                                        #
-#                                                                              #
-#   Licensed under the Apache License, Version 2.0 (the "License");            #
-#   you may not use this file except in compliance with the License.           #
-#   You may obtain a copy of the License at                                    #
-#                                                                              #
-#       http://www.apache.org/licenses/LICENSE-2.0                             #
-#                                                                              #
-#   Unless required by applicable law or agreed to in writing, software        #
-#   distributed under the License is distributed on an "AS IS" BASIS,          #
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
-#   See the License for the specific language governing permissions and        #
-#   limitations under the License.                                             #
-################################################################################
-*******************************************************************************/
-
-/********************************************************************20**
-  
-        Name:    NR RLC file       
-    
-        Type:    C include file
-  
-        Desc:    This file contains all the data structures and 
-                 prototypes for RLC.
-        File:    kw.x
-
-*********************************************************************21*/
-/** @file kw.x
-@brief RLC Product Structures, prototypes
-*/
-
-#ifndef __KWX__
-#define __KWX__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/** @brief Local typedefs */
-typedef uint32_t    RlcSn;   /*!< Sequence Number length */
-
-typedef RguDDatIndInfo KwDatIndInfo;
-
-typedef RguDStaIndInfo KwDStaIndInfo;
-
-typedef RguPduInfo KwPduInfo; /* kw002.201 : Aligning the structure with RGU */
-
-typedef struct _amRlcStats
-{
-   uint32_t   numDLStaPduSent;
-   uint32_t   numDLNacksInStaPdu;
-   uint32_t   numDLBytesUnused;
-   uint32_t   numDLPollTimerExpiresSrb;
-   uint32_t   numDLPollTimerExpiresDrb;
-   uint32_t   numDLMaxRetx;
-   uint32_t   numDLRetransPdus;
-   uint32_t   numULPdusDiscarded;
-   uint32_t   numULReAsmblTimerExpires;
-   uint32_t   numULStaPduRcvd;
-   uint32_t   numULNackInStaPduRcvd;
-   uint32_t   numRlcAmCellSduTx; /* Count of SDUs transmitted in DL for all UEs */
-   uint32_t   numRlcAmCellSduBytesTx; /*Total number of bytes transmitted in DL for all Ues */
-   uint32_t   numRlcAmCellRetxPdu; /*Count of PDUs retransmitted for all Ues */
-   uint32_t   numRlcAmMaxRetx; /*Total number of Max-RLC retransmissions hit for all the Ues */
-   uint32_t   numRlcAmCellDupPduRx; /*Count of Duplicate PDUs detected for a UE in UL for all Ues */
-   uint32_t   numRlcAmCellDropOutWinRx; /*Count of PDUs dropped due to Out of Window reception for all Ues */
-   uint32_t   numRlcAmCellSduRx; /* Count of SDUs received in UL for all UEs*/
-   uint32_t   numRlcAmCellSduBytesRx;/*Total number of bytes received in UL for all Ues*/
-   uint32_t   numRlcAmCellNackRx; /*Total number of UL PDUs nacked for all the Ues*/
-   uint32_t   numRlcAmCellWinStall; /*Number of window stalls detected for all the Ues */
-}AMRLCStats;
-
-typedef struct _umRlcStats
-{
-   uint32_t   numDLBytesUnused;
-   uint32_t   numDLMaxRetx;
-   uint32_t   numULPdusDiscarded;
-   uint32_t   numULReAsmblTimerExpires;
-   uint32_t   numULPdusOutsideWindow;
-}UMRLCStats;
-
-typedef struct _rlcStats
-{
-   AMRLCStats   amRlcStats;
-   UMRLCStats   umRlcStats;
-}RLCStats;
-
-RLCStats gRlcStats;
-
-/* kw005.201 added support for L2 Measurement */
-#ifdef LTE_L2_MEAS
-typedef struct rlcSduSnMap RlcSduSnMap;
-typedef RguLchMapInfo KwLchMapInfo;
-#endif /*  LTE_L2_MEAS */
-
-/** @defgroup ummode UM Module Info 
-*/
-/** 
- * @brief  Structure to hold an Unacknowledged Mode header
- *
- * @details
- *    - si    : Segmentation Info
- *    - sn    : Sequence number
- *    - so    : Segmentation offset
-*/
-typedef struct rlcUmHdr
-{
-   uint8_t     si;              /*!< Segmentation Info */
-   RlcSn       sn;              /*!< Sequence number */
-   uint16_t    so;              /*!< Segmentation offset */
-}RlcUmHdr;
-
-/** 
- * @brief  Structure to hold an Acknowledged Mode header
- *
- * @details
- *    - dc    : Data/Control PDU
- *    - rf    : Resegmentation flag
- *    - p     : Poll bit
- *    - fi    : Framing Info
- *    - e     : Extension bit
- *    - lsf   : Last segment flat
- *    - sn    : Sequence number
- *    - so    : Segment offset
- *    - numLi : Number of length indicators in the following array (li)
- *    - li    : Length indicators
-*/
-typedef struct rlcAmHdr
-{
-   uint8_t     dc;              /*!< Data/Control PDU */
-   uint8_t     p;               /*!< Poll bit */
-   uint8_t     si;              /*!< Segmentation Info: 5GNR */ 
-   RlcSn       sn;              /*!< Sequence number */
-   uint32_t    so;              /*!< Segment offset */
-}RlcAmHdr;
-
-/* structures used for encoding/decoding the headers */
-typedef struct rlcCntrlInfo
-{
-   uint16_t  val;
-   uint8_t   len;
-   uint16_t  idx;
-   uint8_t   emtBits;
-   uint16_t  e1Idx;
-   uint16_t  e2Idx;   
-   uint8_t   e1eb;
-}RlcCntrlInfo;
-
-typedef struct rlcHdrInfo
-{
-   uint32_t  val;
-   uint8_t   len;
-   uint8_t   eb;
-   uint8_t   *hdr;
-   uint16_t  idx;
-   uint8_t   pEb;
-   uint8_t   pLen;
-}RlcHdrInfo;
-
-typedef struct rlcExtHdr
-{
-   uint32_t val;
-   uint16_t len;
-   uint8_t  hdr;
-   uint8_t  pLen;
-}RlcExtHdr;
-
-/** 
- * @brief  Structure to hold information about a Logical channel
- *
- * @details
- *    - lChId    : Logical channel Id
- *    - lChType  : Logical channel type 
-*/ 
-typedef struct rlcLchInfo
-{
-   CmLteLcId     lChId;     /*!< Logical channel Id */
-   CmLteLcType   lChType;   /*!< Logical channel type */
-}RlcLchInfo;
-
-/* kw005.201 added support for L2 Measurement */
-#ifdef LTE_L2_MEAS
-
-/** @struct RlcL2Cntr
- * RLC L2 Counter  */
-typedef struct rlcL2Cntr
-{
-   struct
-   {
-      uint32_t  numActvUe;        /*!< number of active Ue */
-      uint32_t  sampOc;           /*!< Total number of sampling occasion */
-   }actUe;
-   struct
-   {
-      uint32_t  dLoss;            /*!< Total number of lost packets */  
-      uint32_t  posPkts;          /*!< Total number of positively acknowlegded 
-                                  packets */
-   }uuLoss;
-   struct                    /*!< For DL IP throughput */
-   {
-      uint32_t volSummation;      /*!< Sum of data in bytes */
-      uint32_t timeSummation;     /*!< Sum of time difference in milli sec*/
-   }dlIpThruput;
-   struct                    /*!< For UL IP throughput */
-   {
-      uint32_t volSummation;      /*!< Sum of data in bytes */
-      uint32_t timeSummation;     /*!< Sum of time difference in milli sec*/
-   }ulIpThruput;
-   /* Discard new changes starts */
-   struct                    /*!< For UL IP throughput */
-   {
-      uint32_t discSdus;          /*!< Total RLC SDUs discarded */
-      uint32_t totSdus;           /*!< Total RLC SDUs received */
-   }dlDisc;
-   struct                    /*!< For UL IP throughput */
-   {
-      uint64_t sduDelay;          /*!< Total SDUs delay */
-      uint32_t numSdus;
-   }dlPjSduDelay;
-   uint32_t    totDrbsPerQci;     /*!< Total Count of DRB's for this QCI */
-}RlcL2Cntr;
-
-struct rlcSduSnMap
-{
-   CmLList     lstEnt;
-   Bool        failMarked;
-   Bool        fullySent;
-   uint32_t    sduId;
-   uint16_t    numSn;
-   uint16_t    snList[RLC_MAX_PDU_MAP];
-   uint16_t    harqAck;
-   uint16_t    reqSent;
-   uint16_t    rspRcvd;
-};
-
-typedef struct rlcSnSduMap
-{
-   uint16_t         sn;
-   CmLteLcId        lChId;              /*!< Logical channel Id */
-   uint16_t         numSdu;
-#ifdef LTE_RLC_R9
-   Bool        isBurstSplitted;    /*!< true: burst for this LCH is splitted */
-#endif /* LTE_RLC_R9 */
-   RlcSduSnMap  *sduList[RLC_MAX_DL_LI];
-}RlcSnSduMap;
-
-typedef struct rlcTbSnMap
-{
-   CmHashListEnt  hlTbEnt;
-   uint32_t       tbId;
-   uint16_t       prevNumSn;
-   uint16_t       numSn;
-   RlcSnSduMap    snSduMap[RGU_MAX_PDU * RGU_MAX_LC];
-}RlcTbSnMap;
-
-typedef struct rlcL2MeasCbUeMeasInfo
-{
-   CmLteRnti   ueId;                    /*!< UE ID (Used only for IP Throughput
-                                             in UL/DL */
-   CmLteCellId cellId;                  /*!< UE ID (Used only for IP Throughput
-                                             in UL/DL */
-   Bool        isValid;                 /*! < is this UE entry valid */
-   uint8_t     numLcId;                 /*!< Holds the number of LCh for which Ul Ip
-                                             measurement is ON */
-   uint8_t     lcId[RLC_MAX_LCH_PER_UE]; /*!< Holds the list of LCh for which Ul ip
-                                             measurement is ON */
-   RlcL2Cntr    measData[LKW_MAX_QCI];
-   uint16_t     numQci;                  /*!< number of valid qcI */
-   uint8_t      qci[LKW_MAX_QCI];        /*!< list of valid qcI */
-}RlcL2MeasCbUeMeasInfo;
-
-typedef struct rlcL2MeasCbIpThMeas
-{
-   uint8_t                   numUes;
-   uint8_t                   totNumQci;
-   uint8_t                   totQci[LKW_MAX_QCI];
-   RlcL2MeasCbUeMeasInfo ueInfoLst[LKW_MAX_UE]; /*Added for handling meas for multiple ues*/ 
-}RlcL2MeasCbIpThMeas;
-
-typedef struct rlcL2MeasCbNonIpThMeas
-{
-   uint16_t    numSamples;              /*!< Number of samples to take on numActUe */
-   uint16_t    numQci;                  /*!< number of valid qcI */
-   uint8_t     qci[LKW_MAX_QCI];        /*!< list of valid qcI */
-   RlcL2Cntr   measData[LKW_MAX_QCI];   /*!< Measurement CB */
-}RlcL2MeasCbNonIpThMeas;
-
-typedef union rlcL2MeasCbIpNonIpThMeasVal
-{
-   RlcL2MeasCbIpThMeas    ipThMeas;
-   RlcL2MeasCbNonIpThMeas nonIpThMeas;
-}RlcL2MeasCbIpNonIpThMeasVal;
-
-/** @struct RlcL2MeasCb
- * RLC L2 Measurement CB */
-typedef struct rlcL2MeasCb
-{
-   uint8_t        measType;        /*!< Bit-wise set measurement types */
-   RlcL2MeasCbIpNonIpThMeasVal val;   /* Union of IP tpt or non-ip tpt */
-}RlcL2MeasCb;
-
-/** @struct RlcL2MeasEvtCb
- * RLC L2 Measurement Evt CB */
-typedef struct rlcL2MeasEvtCb
-{
-   uint32_t      transId;                /*!< TransId of Measurement Req */
-   uint32_t      cbIdx;                  /*!< TransId of Measurement Req */
-   CmTimer       l2Tmr; /* NOT USED */                 /*!< L2 Timer per request */
-   TmrCfg        l2TmrCfg; /* NOT USED */               /*!< Time period of measurement */
-   RlcL2MeasCb   measCb;                 /*!< Measurement CB */ 
-   EpcTime       startTime; /* NOT USED */            /*!<  start time when meas starts*/ 
-}RlcL2MeasEvtCb;
-
-/** @struct RlcL2MeasRbCb
- * RLC L2 Measurement Rb CB */
-typedef struct rlcL2MeasRbCb
-{
-   uint8_t        measOn;                      /*!< Measurements that are running */ 
-   RlcL2Cntr      *l2Sts[RLC_MAX_L2MEAS_EVT];  /*!< L2 Mesurement statistics */     
-}RlcL2MeasRbCb;
-
-/** @struct RlcL2Cb
- * RLC L2  CB */
-typedef struct rlcL2Cb
-{
-   uint16_t        rlcNumMeas;                   /*!< Number of measurements going on */
-   RlcL2MeasEvtCb  rlcL2EvtCb[LKW_MAX_L2MEAS];  /*!< Pointers to Measurement Cb */
-   uint8_t         measOn[LKW_MAX_QCI];          /*!< Measurement on */
-   uint32_t        numActUe[LKW_MAX_QCI];       /*!< Measurement on */
-}RlcL2Cb;
-
-
-typedef enum _dlIpThrputState
-{
-   KW_DL_IPTHRU_RESET = 0,
-   KW_DL_IPTHRU_BURST_STARTED,
-   KW_DL_IPTHRU_BURST_CONTINUE,
-   KW_DL_IPTHRU_BURST_COMPLETED
-}DlIpThrputState;
-
-/** 
-* @struct rlcL2MeasSduLst
-* Structure to hold parameters of 
-* burst sdus in DL for a RB */
-typedef struct rlcOutStngSduInfo
-{
-   uint32_t  sduId;            /*!< SDU Id of sdu */
-   MsgLen    sduLen;           /*!< Size of sdu */
-   uint32_t  numTb;            /*!< Hold the number of TBs for this sdu in DL */
-}RlcOutStngSduInfo;
-
-/** 
-* @struct rlcL2MeasDlIpTh
-* Structure to hold parameters for DL ip 
-* throughput for a RB */
-typedef struct rlcL2MeasDlIpTh
-{
-   Bool               isBurstAct;            /*!< Set to TRUE when burst is active in DL */
-   uint64_t           burstStartTime;        /*!< Holds the starting time of the burst */
-   uint32_t           burstEndSduId;         /*!< Sdu ID when burst ends */
-   uint8_t            lastSduIdx;            /*!< Holds the index of last outStanding sdu */
-   RlcOutStngSduInfo  outStngSduArr[RLC_L2MEAS_MAX_OUTSTNGSDU];/*!< Hold the burst sdu information */
-}RlcL2MeasDlIpTh;
-
-/** 
-* @struct rlcL2MeasIpThruput
-* Structure to hold parameters for UL/DL ip 
-* throughput for a RB */
-typedef struct rlcL2MeasIpThruput
-{
-   uint32_t         dataVol;                 /*!< Holds volume of new data in bytes
-                                              for UL IP throughput */
-   uint32_t         ttiCnt;                  /*!< Holds ttiCnt received from MAC in UL */
-   uint32_t         prevTtiCnt;        /*!< Holds previous ttiCnt received from MAC in UL */
-   RlcL2MeasDlIpTh  dlIpTh;
-}RlcL2MeasIpThruput;
-
-#endif /* LTE_L2_MEAS */
-
-/** 
- * @brief  Structure to hold an UE key for the UE hast lists
- *
- * @details
- *    - ueId    : UE Id
- *    - cellId  : Cell Id 
-*/
-typedef struct rlcUeKey
-{
-   CmLteRnti     ueId;     /*!< UE Id */
-   CmLteCellId   cellId;   /*!< Cell Id */
-}RlcUeKey;
-
-/** 
- * @brief  Structure to hold an information about the CKW SAP
- *
- * @details
- *    - pst   : Service user post structure
- *    - spId  : Service provider Id
- *    - suId  : Service user Id
- *    - state : State of the SAP
- *    - sts   : SAP specific statistics 
-*/
-typedef struct rlcCkwSapCb
-{
-   Pst           pst;     /*!< Service user post structure */
-   SpId          spId;    /*!< Service provider Id */
-   SuId          suId;    /*!< Service user Id */
-   uint8_t       state;   /*!< Sap Status */
-   RlcCkwCntSts   sts;     /*!< Statistics */
-}RlcCkwSapCb;
-
-/** 
- * @brief  Structure to hold an information about the KWU SAP
- *
- * @details
- *    - pst   : Service user post structure
- *    - spId  : Service provider Id
- *    - suId  : Service user Id
- *    - state : State of the SAP
- *    - sts   : SAP specific statistics 
-*/
-typedef struct rlcKwuSapCb
-{
-   Pst           pst;     /*!< Service user post structure */
-   SpId          spId;    /*!< Service provider Id */
-   SuId          suId;    /*!< Service user Id */
-   uint8_t       state;   /*!< Sap Status */
-   RlcKwuSapSts  sts;     /*!< Statistics */
-}RlcKwuSapCb;
-
-/** 
- * @brief  Structure to hold an information about the RGU SAP
- *
- * @details
- *    - pst       : Service user post structure
- *    - spId      : Service provider Id
- *    - suId      : Service user Id
- *    - state     : State of the SAP
- *    - bndTmr    : Bind Timer
- *    - bndTmrInt : Timer Interval
- *    - retryCnt  : Bind Retry Count
-*/
-typedef struct rlcRguSapCb
-{
-   Pst       pst;         /*!< Service user post structure */
-   SpId      spId;        /*!< Service provider Id */
-   SuId      suId;        /*!< Service user Id */
-   uint8_t   state;       /*!< Sap Status */
-   CmTimer   bndTmr;      /*!< Bind Timer */
-   uint16_t  bndTmrInt;   /*!< Timer Interval */
-   uint8_t   retryCnt;    /*!< Bind Retry Count */
-}RlcRguSapCb;
-
-/** 
- * @brief  Structure to hold an information about the UDX UL SAP
- *
- * @details
- *    - pst       : Service user post structure
- *    - spId      : Service provider Id
- *    - suId      : Service user Id
- *    - state     : State of the SAP
- *    - bndTmr    : Bind Timer
- *    - bndTmrInt : Timer Interval
- *    - retryCnt  : Bind Retry Count
-*/
-typedef struct rlcUdxUlSapCb
-{
-   Pst       pst;         /*!< Service user post structure */
-   SpId      spId;        /*!< Service provider Id */
-   SuId      suId;        /*!< Service user Id */
-   uint8_t   state;       /*!< Sap Status */
-   CmTimer   bndTmr;      /*!< Bind Timer */
-   uint16_t  bndTmrInt;   /*!< Timer Interval */
-   uint8_t   retryCnt;    /*!< Bind Retry Count */
-}RlcUdxUlSapCb;
-
-/** 
- * @brief  Structure to hold an information about the UDX DL SAP
- *
- * @details
- *    - pst       : Service user post structure
- *    - spId      : Service provider Id
- *    - suId      : Service user Id
- *    - state     : State of the SAP
-*/
-typedef struct rlcUdxDlSapCb
-{
-   Pst     pst;     /*!< Service user post structure */
-   SpId    spId;    /*!< Service provider Id */
-   SuId    suId;    /*!< Service user Id */
-   uint8_t state;   /*!< Sap Status */
-}RlcUdxDlSapCb;
-
-/** 
- * @brief  Structure to hold info about memory to be freed
- *
- * @details
- *    - sduLst  : The SDU queues are appended to this queue, used 
- *                for the UM SDU queues
- *    - txLst   : Stores to be released AM Mode TX PDUs
- *    - reTxLst : Stores to be released AM Re TX PDU's
- *    - rbLst   : List of AM DL RBs to be freed 
-*/
-typedef struct rlcDlDataToBeFreed
-{
-   CmLListCp   sduLst;     /*!< Queue of SDU's to be freed  */
-   CmLListCp   txLst;     /*!< Stores to be released TX PDUs */
-   CmLListCp   reTxLst;   /*!< Stores to be released ReTX PDUs */
-   CmLListCp   rbLst;     /*!< List of AM DL RBs to be freed */
-}RlcDlDataToBeFreed;
-
-/** 
- * @brief  Structure to hold an information about DL RLC instance
- *
- * @details
- *    - numKwuSaps        : Number of RLC KWU Saps
- *    - numUdxSaps        : Number of RLC UDX Saps
- *    - rlcKwuDlSap          : Pointer to the array of KWU SAPS
- *    - udxDlSap          : Pointer to the array of UDX SAPS
- *    - rguDlSap          : RGU Sap Control Block
- *    - cellLstCp         : Hashlist of CellCb
- *    - ueLstCp           : Hashlist of UeCb 
- *    - toBeFreed         : Pointer to data to be freed
- *    - shutdownReveived  : Request for shutdown recevied or not
- *    - eventInQueue      : Event for cleanup exists in queue or not
- */
-typedef struct rlcDlCb
-{
-   uint8_t             numKwuSaps;         /*!< Number of RLC Data Saps */
-   uint8_t             numUdxSaps;         /*!< Number of RLC Data Saps */
-   RlcKwuSapCb         *rlcKwuDlSap;          /*!< KWU Sap Control Block */
-   RlcUdxDlSapCb       *udxDlSap;          /*!< UDX DL Sap Control Block */
-   RlcRguSapCb         *rguDlSap;          /*!< RGU Sap Control Block */
-   CmHashListCp        cellLstCp;          /*!< Hashlist of CellCb */
-   CmHashListCp        ueLstCp;            /*!< Hashlist of UeCb */
-   RlcDlDataToBeFreed  toBeFreed;          /*!< Pointer to data to be freed */        
-   Pst                 selfPst;            /*!< Pst to post events to self */
-   Buffer              *selfPstMBuf;       /*!< Buffer used for self post */
-   Bool                shutdownReceived;   /*!< Request for shutdown recevied */
-   Bool                eventInQueue;       /*!< Event exists in queue or not */
-#ifdef LTE_L2_MEAS
-   RlcL2Cb              rlcL2Cb; /*!< Control Block for L2 Measurements in RLC */
-#endif /* LTE_L2_MEAS */
-}RlcDlCb;
-
-/** 
- * @brief  Structure to hold an information about UL RLC instance
- *
- * @details
- *    - ckwSap       : CKW Sap Conrol Block
- *    - numKwuSaps   : Number of RLC KWU Saps
- *    - numUdxSaps   : Number of RLC UDX Saps
- *    - udxUlSap     : Pointer to the array of UDX SAPS 
- *    - rlcKwuUlSap     : Pointer to the array of KWU SAPS
- *    - rguUlSap     : RGU Sap Control Block
- *    - cellLstCp    : Hashlist of CellCb
- *    - ueLstCp      : Hashlist of UeCb 
- *    - transIdLstCp : Hashlist of cfg trans
- */
-typedef struct rlcUlCb
-{
-   RlcCkwSapCb     ckwSap;         /*!< CKW Sap Conrol Block */ 
-   uint8_t         numKwuSaps;     /*!< Number of RLC Data Saps */
-   uint8_t         numUdxSaps;     /*!< Number of RLC Data Saps */
-   RlcUdxUlSapCb   *udxUlSap;      /*!< UDX DL Sap Control Block */
-   RlcKwuSapCb     *rlcKwuUlSap;      /*!< KWU Sap Control Block */
-   RlcRguSapCb     *rguUlSap;      /*!< RGU Sap Control Block */
-   CmHashListCp   cellLstCp;      /*!< Hashlist of CellCb */
-   CmHashListCp   ueLstCp;        /*!< Hashlist of UeCb */
-   CmHashListCp   transIdLstCp;   /*!< Hashlist of cfg trans */
-   uint8_t        rlcUlUdxEventType;  /*!<Ue Create/ReConfig> */
-/* kw005.201 added support for L2 Measurement */
-#ifdef LTE_L2_MEAS
-   RlcL2Cb        rlcL2Cb; /*!< Control Block for L2 Measurements in RLC */
-#endif /* LTE_L2_MEAS */
-}RlcUlCb;
-
-typedef struct rlcThptPerUe
-{
-   uint16_t ueIdx;
-   uint64_t dataVol;
-}RlcThptPerUe;
-
-/**
- * @brief  Structure to hold information about throughput at  RLC
- * 
- */
-typedef struct rlcThpt
-{
-   Inst          inst;                      /* RLC instance */
-   CmTimer       thptTmr;                   /* Throughput Timer */
-   uint8_t       numActvUe;                 /* Number of Active UEs */
-   RlcThptPerUe  thptPerUe[MAX_NUM_UE];     /* Throughput calculated per UE */
-}RlcThpt;
-
-/** 
- * @brief  Structure to hold an information about a RLC instance
- *
- * @details
- *    - init    : Task Initialization Info
- *    - genCfg  : General Configuration
- *    - genSts  : General Statistics
- *    - trcLen  : Trace Length
- *    - trcMask : Trace Mask
- *    - rlcTq    : Timer queue
- *    - rlcTqCp  : Timer queue control point
- *    - u       : Union depending on whether the instance is UL or DL
- *      - ulCb  : UL instance Control Block
- *      - dlCb  : DL instance Control Block
- */
-typedef struct rlcCb
-{
-   TskInit    init;               /*!< Task Initialization Info */
-   RlcGenCfg   genCfg;             /*!< General Configuration Structure */
-   RlcGenSts   genSts;             /*!< General Statistics */
-   S16        trcLen;             /*!< Trace Length */
-   uint8_t         trcMask;            /*!< Trace Mask */
-   CmTqType   rlcTq[RLC_TMR_LEN];   /*!< Timer queue */
-   CmTqCp     rlcTqCp;             /*!< Timer queue control point */
-   union 
-   {
-      RlcUlCb   *ulCb;   /*!< Ul Control Block */
-      RlcDlCb   *dlCb;   /*!< Dl Control Block */
-   } u;
-   uint8_t    dlSduId;   /*!< Downlink SDU ID */
-   RlcThpt    rlcThpt;   /*!< Throughput at RLC*/
-}RlcCb;
-
-RlcCb *rlcCb[MAX_RLC_INSTANCES];   /*!< RLC global control block */
-
-/****************************************************************************
- *                      Declarations
- ***************************************************************************/
-S16 rlcGetSId ARGS((SystemId *s));
-
-Void rlcTmrExpiry ARGS((PTR cb, S16 tmrEvnt));
-
-S16 rlcLmmSendTrc ARGS ((RlcCb *gCb, Event event, Buffer *mBuf));
-
-void rlcStartTmr ARGS((RlcCb *gCb, PTR cb, S16 tmrEvnt));
-
-void rlcStopTmr  ARGS((RlcCb *gCb, PTR cb, uint8_t tmrType));
-
-bool rlcChkTmr ARGS((RlcCb *gCb,PTR cb, S16 tmrEvnt));
-
-#ifdef LTE_L2_MEAS
-Void rlcLmmSendAlarm ARGS (( RlcCb *gCb,
-                                   uint16_t category, 
-                                   uint16_t event, 
-                                   uint16_t cause, 
-                                   SuId suId, 
-                                   uint32_t ueId, 
-                                   uint8_t qci));
-
-S16 RlcMiRlcDlL2MeasReq ARGS (( Pst *pst, RlcL2MeasReqEvt *measReqEvt ));
-S16 RlcMiRlcDlL2MeasSendReq ARGS((Pst *pst,uint8_t measType));
-S16 RlcMiRlcDlL2MeasStopReq ARGS((Pst *pst,uint8_t measType));
-S16 RlcMiRlcUlL2MeasReq ARGS (( Pst *pst, RlcL2MeasReqEvt *measReqEvt ));
-S16 RlcMiRlcUlL2MeasSendReq ARGS((Pst *pst,uint8_t measType));
-S16 RlcMiRlcUlL2MeasStopReq ARGS((Pst *pst,uint8_t measType));
-Void rlcUtlPlcMeasDatInL2Sts ARGS((RlcL2Cntr *measData, 
-                                         RlcL2MeasRbCb *rbL2Cb,
-                                         uint8_t measType));
-#else /* LTE_L2_MEAS */
-Void rlcLmmSendAlarm ARGS ((RlcCb *gCb,
-                                  uint16_t category, 
-                                  uint16_t event, 
-                                  uint16_t cause, 
-                                  SuId suId, 
-                                  uint32_t ueId));
-#endif /* LTE_L2_MEAS */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __KWX__ */
-
-\f  
-/********************************************************************30**
-  
-         End of file
-**********************************************************************/
diff --git a/src/5gnrrlc/kw_dl.h b/src/5gnrrlc/kw_dl.h
deleted file mode 100755 (executable)
index 6fe8550..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*******************************************************************************
-################################################################################
-#   Copyright (c) [2017-2019] [Radisys]                                        #
-#                                                                              #
-#   Licensed under the Apache License, Version 2.0 (the "License");            #
-#   you may not use this file except in compliance with the License.           #
-#   You may obtain a copy of the License at                                    #
-#                                                                              #
-#       http://www.apache.org/licenses/LICENSE-2.0                             #
-#                                                                              #
-#   Unless required by applicable law or agreed to in writing, software        #
-#   distributed under the License is distributed on an "AS IS" BASIS,          #
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
-#   See the License for the specific language governing permissions and        #
-#   limitations under the License.                                             #
-################################################################################
-*******************************************************************************/
-
-/********************************************************************20**
-  
-        Name:     NR RLC file for downlink and non real time tasks 
-    
-        Type:     C include file
-  
-        Desc:     This file contains helper macros for RLC downlink
-                  and non real time task
-        File:     kw_dl.h
-  
-*********************************************************************21*/
-/** @file kw_dl.h
-@brief RLC Downlink helper macros 
-*/
-
-#ifndef __KW_DLH__
-#define __KW_DLH__
-#define RLC_DL_INST 1
-#define RLC_MAX_RNG_DEQ_INDX 8
-
-/* Below are the status used within RLC */
-#define RLC_SDU_OPAT_NOUPDATE 0
-#define RLC_SDU_OPAT_UPD_TX 1
-#define RLC_SDU_OPAT_UPD_RETX   2
-
-/* Below are the status which needs to be updated to MAC */
-#define RLC_RGU_SDU_OPAT_NOUPDATE 0
-#define RLC_RGU_SDU_OPAT_UPDATE   1
-#define RLC_RGU_SDU_OPAT_BREACH   2
-
-/* PDB Values for various QCI bearers : This value is considered 
-   after taking into account a 20ms delay at the network */
-#define RLC_PDB_VALUE_FOR_QCI1    80
-#define RLC_PDB_VALUE_FOR_QCI2    130
-#define RLC_PDB_VALUE_FOR_QCI3    30
-#define RLC_PDB_VALUE_FOR_QCI4    280
-#define RLC_PDB_VALUE_FOR_QCI5    80
-#define RLC_PDB_VALUE_FOR_QCI6    280
-#define RLC_PDB_VALUE_FOR_QCI7    80
-#define RLC_PDB_VALUE_FOR_QCI8    280
-#define RLC_PDB_VALUE_FOR_QCI9    280
-
-#define RLC_DATA_BITMASK          0x80 /* Data bitmask is used to fill D/C bit for data*/
-/**
- * @def RLC_MEAS_IS_DL_IP_MEAS_ON_FOR_RB
- *
- *    This macro is used to check if DL IP throughput measurement is ON
- *    or off for the passed rb
- *
- *    Returns TRUE (non-zero) if measurement is ON else FALSE (zero)
- *
- * @param[in] _gCb     RLC DL Cb
- * @param[in] _rbCb    RLC downlink control block
- *
-*/ 
-#ifdef LTE_L2_MEAS
-#define RLC_MEAS_IS_DL_ANY_MEAS_ON_FOR_RB(_gCb, _rbCb)  \
-     ((_rbCb->rlcId.rbType == CM_LTE_DRB) && \
-            (_gCb->u.dlCb->rlcL2Cb.measOn[_rbCb->qci]))
-
-#define RLC_MEAS_IS_DL_IP_MEAS_ON_FOR_RB(_gCb, _rbCb)  \
-     ((_rbCb->rlcId.rbType == CM_LTE_DRB) && \
-      (_gCb->u.dlCb->rlcL2Cb.measOn[_rbCb->qci] & LKW_L2MEAS_DL_IP) && \
-      (_rbCb->rbL2Cb.measOn & LKW_L2MEAS_DL_IP))
-
-#define RLC_MEAS_IS_DL_DELAY_MEAS_ON_FOR_RB(_gCb, _rbCb)  \
-     ((_rbCb->rlcId.rbType == CM_LTE_DRB) && \
-            (_gCb->u.dlCb->rlcL2Cb.measOn[_rbCb->qci] & LKW_L2MEAS_DL_DELAY))
-
-#define RLC_MEAS_IS_DL_UU_LOSS_MEAS_ON_FOR_RB(_gCb, _rbCb)  \
-     ((_rbCb->rlcId.rbType == CM_LTE_DRB) && \
-            (_gCb->u.dlCb->rlcL2Cb.measOn[_rbCb->qci] & LKW_L2MEAS_UU_LOSS))
-#define RLC_UPD_PDCP_L2_DLDELAY_STS(_rlcCb, _rlcRbCb, _delay)                     \
-{                                                                              \
-   if(((_rlcRbCb)->rlcId.rbType == CM_LTE_DRB) &&                               \
-      ((_rlcCb)->u.dlCb->rlcL2Cb.measOn[_rlcRbCb->qci] & LKW_L2MEAS_DL_DELAY))    \
-   {                                                                           \
-      (_rlcRbCb)->rbL2Cb.l2Sts[RLC_L2MEAS_DL_DELAY]->dlPjSduDelay.sduDelay += _delay; \
-      (_rlcRbCb)->rbL2Cb.l2Sts[RLC_L2MEAS_DL_DELAY]->dlPjSduDelay.numSdus++; \
-   }                                                                    \
-}
-
-#define RLC_UPD_L2_UU_LOSS_PKTS(_rlcCb, _rlcRbCb, _val)                         \
-{                                                                 \
-   if(((_rlcRbCb)->rlcId.rbType == CM_LTE_DRB) &&                              \
-      ((_rlcCb)->u.dlCb->rlcL2Cb.measOn[_rlcRbCb->qci] & LKW_L2MEAS_UU_LOSS))              \
-   {                                                              \
-      (_rlcRbCb)->rbL2Cb.l2Sts[RLC_L2MEAS_UU_LOSS]->uuLoss.dLoss += _val;     \
-   }                                                              \
-}
-#define RLC_UPD_L2_UU_LOSS_POS_PKTS(_rlcCb,_rlcRbCb,_val)                         \
-{                                                                 \
-   if(((_rlcRbCb)->rlcId.rbType == CM_LTE_DRB) &&                              \
-      ((_rlcCb)->u.dlCb->rlcL2Cb.measOn[_rlcRbCb->qci] & LKW_L2MEAS_UU_LOSS))              \
-   {                                                              \
-      (_rlcRbCb)->rbL2Cb.l2Sts[RLC_L2MEAS_UU_LOSS]->uuLoss.posPkts += _val;     \
-   }                                                              \
-}
-/* Discard new changes starts */
-#define RLC_UPD_L2_DL_DISC_SDU_STS(_rlcCb,_rlcRbCb)                         \
-{                                                                 \
-   if(((_rlcRbCb)->rlcId.rbType == CM_LTE_DRB) &&                              \
-      ((_rlcCb)->u.dlCb->rlcL2Cb.measOn[_rlcRbCb->qci] & LKW_L2MEAS_DL_DISC))              \
-   {                                                              \
-      (_rlcRbCb)->rbL2Cb.l2Sts[RLC_L2MEAS_DL_DISC]->dlDisc.discSdus++;     \
-   }                                                              \
-}                                              
-
-#define RLC_UPD_L2_DL_TOT_SDU_STS(_rlcCb,_rlcRbCb)                             \
-{                                                                 \
-   if(((_rlcRbCb)->rlcId.rbType == CM_LTE_DRB) &&                              \
-      ((_rlcCb)->u.dlCb->rlcL2Cb.measOn[_rlcRbCb->qci] & LKW_L2MEAS_DL_DISC))   \
-   {                                                              \
-      (_rlcRbCb)->rbL2Cb.l2Sts[RLC_L2MEAS_DL_DISC]->dlDisc.totSdus++;      \
-   }                                                              \
-}
-
-#define RLC_UPD_L2_DECR_NONIP_PER_QCI_RB_COUNT(_rlcCb, _rlcRbCb)                 \
-{                                                                 \
-   if(((_rlcRbCb)->rlcId.rbType == CM_LTE_DRB) &&                    \
-      ((_rlcCb)->u.dlCb->rlcL2Cb.measOn[_rlcRbCb->qci] & LKW_L2MEAS_DL_DISC))   \
-   {                                                              \
-      uint32_t idx1;                                                    \
-      for (idx1 = 0; idx1 < LKW_MAX_L2MEAS; idx1++)                  \
-      {                                                           \
-         if(_rlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[idx1].measCb.measType & LKW_L2MEAS_DL_DISC)                 \
-         {                                                        \
-            if(_rlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[idx1].measCb.val.nonIpThMeas.measData[(_rlcRbCb)->qci].totDrbsPerQci > 0) \
-            {                                                                                               \
-               _rlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[idx1].measCb.val.nonIpThMeas.measData[(_rlcRbCb)->qci].totDrbsPerQci--;   \
-               if (_rlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[idx1].measCb.val.nonIpThMeas.measData[(_rlcRbCb)->qci].totDrbsPerQci == 0) \
-               {                                                                                                 \
-                  _rlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[idx1].measCb.val.nonIpThMeas.qci[(_rlcRbCb)->qci] = 0;                      \
-                  memset(&_rlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[idx1].measCb.val.nonIpThMeas.measData[(_rlcRbCb)->qci], 0,  \
-                     sizeof(_rlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[idx1].measCb.val.nonIpThMeas.measData[(_rlcRbCb)->qci]));            \
-               }                                                                                                 \
-            }                                                                                                    \
-         }                                                                                                       \
-      }                                                                                                          \
-   }                                                                                                             \
-}
-#else
-#define RLC_UPD_PDCP_L2_DLDELAY_STS(_rlcCb, _rlcRbCb, _delay)
-#define RLC_MEAS_IS_DL_IP_MEAS_ON_FOR_RB(_gCb, _rbCb)
-#define RLC_MEAS_IS_DL_DELAY_MEAS_ON_FOR_RB(_gCb, _rbCb)
-#define RLC_UPD_L2_DL_DISC_SDU_STS(_rlcCb,_rlcRbCb)
-#define RLC_UPD_L2_DL_TOT_SDU_STS(_rlcCb, _rlcRbCb)
-#define RLC_UPD_L2_DECR_NONIP_PER_QCI_RB_COUNT(_rlcCb, _rlcRbCb)
-#endif
-
-
-#endif /* __KW_DLH__ */
-\f  
-/********************************************************************30**
-  
-         End of file
-**********************************************************************/
diff --git a/src/5gnrrlc/kw_ptli.c b/src/5gnrrlc/kw_ptli.c
deleted file mode 100755 (executable)
index 261ac78..0000000
+++ /dev/null
@@ -1,411 +0,0 @@
-/*******************************************************************************
-################################################################################
-#   Copyright (c) [2017-2019] [Radisys]                                        #
-#                                                                              #
-#   Licensed under the Apache License, Version 2.0 (the "License");            #
-#   you may not use this file except in compliance with the License.           #
-#   You may obtain a copy of the License at                                    #
-#                                                                              #
-#       http://www.apache.org/licenses/LICENSE-2.0                             #
-#                                                                              #
-#   Unless required by applicable law or agreed to in writing, software        #
-#   distributed under the License is distributed on an "AS IS" BASIS,          #
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
-#   See the License for the specific language governing permissions and        #
-#   limitations under the License.                                             #
-################################################################################
-*******************************************************************************/
-
-/********************************************************************20**
-  
-        Name:    NR RLC Layer - Lower Interface
-    
-        Type:    C file
-  
-        Desc:    C source code for the lower interface of NR RLC
-        File:    kw_ptli.c
-  
-*********************************************************************21*/
-
-/** @file kw_ptli.c 
-@brief RLC Lower Interface
-*/
-
-\f
-/* header (.h) include files */
-#include "common_def.h"
-#include "lkw.h"           /* LKW defines */
-#include "ckw.h"           /* CKW defines */
-#include "kwu.h"           /* KWU defines */
-#include "rgu.h"           /* RGU defines */
-#ifdef KW_PDCP
-#include "cpj.h"           /* CPJ defines */
-#include "pju.h"           /* PJU defines */
-#include "lpj.h"           /* LPJ defines */
-#endif
-#include "kw_err.h"
-#include "kw_env.h"        /* RLC environment options */
-#include "kw.h"            /* RLC defines */
-
-/* extern (.x) include files */
-#include "lkw.x"           /* LKW */
-#include "ckw.x"           /* CKW */
-#include "kwu.x"           /* KWU */
-#include "rgu.x"           /* RGU */
-#ifdef KW_PDCP
-#include "cpj.x"           /* CPJ defines */
-#include "pju.x"           /* PJU defines */
-#include "lpj.x"           /* LPJ defines */
-#endif
-#include "kw.x"
-#include "ss_rbuf.h"
-#include "ss_rbuf.x"
-
-#ifndef LCKWLIRGU
-#define PTKWRGU
-#endif
-
-#ifndef RG
-#define PTKWRGU
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-
-#ifdef RLC_MAC_DAT_REQ_RBUF
-S16 rlcLiRguDatReqRbuf(Pst *Post,SpId spId,Void *datReq);
-#endif
-
-#ifdef RLC_MAC_STA_RSP_RBUF
-S16 rlcLiRguStaRspRbuf(Pst *Post,SpId spId,Void  *staRsp);
-#endif
-#if defined(MAC_RLC_HARQ_STA_RBUF) && defined(LTE_L2_MEAS)
-S16 RlcDlHarqStaBatchProc (Void);
-#endif
-
-\f
-/*********************************************************************
- *             Primitives for RGU interface 
- ********************************************************************/
-
-/* RGU Bind Request primitive */
-
-RguBndReq kwLiRguBndReqMt[] =
-{
-#ifdef LCKWLIRGU
-   cmPkRguBndReq,            /* 0 - loosely coupled */
-#endif /* LCRGUIRGU */
-#ifdef RG 
-   RgUiRguBndReq,            /* 1 - tightly coupled, MAC  */
-#endif /* RG */
-#ifdef LCKWLIRGU
-   cmPkRguBndReq,            /* 0 - loosely coupled */
-#endif /* LCRGUIRGU */
-};
-
-/* RGU Unbind Request primitive */
-
-RguBndReq kwLiRguUbndReqMt[] =
-{
-#ifdef LCKWLIRGU
-   cmPkRguUbndReq,            /* 0 - loosely coupled */
-#endif /* LCRGUIRGU */
-#ifdef RG 
-   RgUiRguUbndReq,            /* 1 - tightly coupled, MAC  */
-#endif /* RG */
-#ifdef LCKWLIRGU
-   cmPkRguUbndReq,            /* 0 - loosely coupled */
-#endif /* LCRGUIRGU */
-};
-
-/* kw005.201 added support for L2 Measurement */
-#ifdef LTE_L2_MEAS
-#ifdef LTE_RLC_R9
-/* RGU L2 Measurement Ul Ip Throughput Measurement Request primitive */
-
-RguL2MUlThrpMeasReq kwLiRguL2MUlThrpMeasReqMt[] =
-{
-#ifdef LCKWLIRGU
-   cmPkRguL2MUlThrpMeasReq,            /* 0 - loosely coupled */
-#endif /* LCRGUIRGU */
-#ifdef RG 
-   RgUiRguL2MUlThrpMeasReq,            /* 1 - tightly coupled, MAC  */
-#endif /* RG */
-};
-#endif /* LTE_RLC_R9 */
-#endif /*  LTE_L2_MEAS */
-\f
-/****************************************************************************
- *                         RGU Interface Mt functions
- ***************************************************************************/
-/**
- *
- * @brief 
- *
- *        Handler for RGU SAP bind Request.
- *
- * @b Description:
- *
- *        This function is used by RLC to request for binding to 
- *        MAC for accessing MAC services.This function binds MAC's 
- *        SAP (identified by spId) with the service user's SAP 
- *        (identified by suId).
- *
- *  @param[in] pst   Post structure  
- *  @param[in] suId  Service user SAP ID 
- *  @param[in] spId  Service provider ID
- *
- *  @return  S16
- *      -# ROK 
- */
-
-S16 RlcLiRguBndReq
-(
-Pst  *post,                       /* post structure */
-SuId suId,                      /* Service User Id */
-SpId spId                       /* Service Provider Id */
-)
-{
-
-   /* jump to specific primitive depending on configured selector */
-   (*kwLiRguBndReqMt[post->selector])(post, suId, spId);
-
-   return ROK;
-
-} /* end of RlcLiRguBndReq */
-
-\f
-/**
- *
- * @brief 
- *
- *        Handler for bind confirmation from MAC.
- *
- * @b Description:
- *
- *        This function handles the bind confirmation received
- *        from MAC. 
- *
- *  @param[in] post     - Post structure  
- *  @param[in] suId    - Service provider SAP ID 
- *  @param[in] reason  - Reason of confirmation
- *
- *  @return  S16
- *      -# ROK 
- */
-
-S16 RlcLiRguUbndReq(Pst *post,SpId spId,Reason reason)
-{
-
-   /* jump to specific primitive depending on configured selector */
-   (*kwLiRguUbndReqMt[post->selector])(post, spId, reason);
-
-   return ROK;
-
-} /* end of RlcLiRguUbndReq */
-
-/* kw005.201 added support for L2 Measurement */
-#ifdef LTE_L2_MEAS
-#ifdef LTE_RLC_R9
-\f  
-/**
- *
- * @brief 
- *
- *        Handler for sending ulThrpMeasReqInfo from RLC to MAC for UL ip throughput measurement. 
- *
- * @b Description:
- *
- *        This function sends ulThrpMeasReqInfo from RLC to MAC whenver UL ip throughput
- * measurement is ON for a single or multiple qci in a UE. This is an indication for MAC
- * to start the T2/T1 time stamps for the coresponding LCHs in the UE.
- *
- *  @param[in] post                    Post structure  
- *  @param[in] spId                   Service Provider ID
- *  @param[in] ulThrpMeasReqInfo      Ul ip measurement request info
- *
- *  @return  S16
- *      -# ROK 
- *      -# RFAILED
- *
- */
-S16 RlcLiRguL2MUlThrpMeasReq(Pst *post,SpId spId,RguL2MUlThrpMeasReqInfo *l2mUlThrpMeasReq)
-{
-
-   /* jump to specific primitive depending on configured selector */
-   (*kwLiRguL2MUlThrpMeasReqMt[post->selector])(post, spId, l2mUlThrpMeasReq);
-
-   return ROK;
-
-} /* end of RlcLiRguL2MUlThrpMeasReq */
-
-#endif /* LTE_RLC_R9 */
-#endif /* LTE_L2_MEAS */
-
-
-#ifdef MAC_RLC_UL_RBUF
-S16 rlcUlBatchProc ARGS ((Void));
-Void rlcUtlFreeUlRBuf ARGS((void));
-
-S16 rlcUlBatchProc(Void)
-{
-/* Read from Ring Buffer and process PDCP packets */
-   RguDDatIndInfo   *datInd;
-   Void *elmIndx = NULLP;
-   static Pst rlcUlRbfuPst={1,1,ENTRLC,0,ENTMAC,0,PRIOR0,RTESPEC,EVTRLCULDAT,0,0,0,0};
-/* Read from Ring Buffer and process PDCP packets */
-
-#ifndef SS_RBUF
-   RguDedDatInd1 *rguDatInd = NULLP;
-   uint8_t rngBufDeqIndx = 0;
-
-   elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
-   while(NULLP != elmIndx)
-   {
-      rguDatInd = (RguDedDatInd1 *)elmIndx;
-      datInd = (RguDDatIndInfo*) rguDatInd->msg; 
-      SsRngInfoTbl[SS_RNG_BUF_ULMAC_TO_ULRLC].nPktProc++;//Number of pkt processed in tti
-      if(datInd != NULLP)
-      {
-         RlcProcDedLcUlData(&rlcUlRbfuPst, 0, datInd);
-      }
-      else
-      {
-         DU_LOG("\nERROR  -->  RLC UL : Received NULL buffer");
-      }
-      rguDatInd->msg=NULLP;
-      SRngIncrRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
-      elmIndx = NULLP;
-      rguDatInd = NULLP;
-
-      rngBufDeqIndx++;
-
-      //if(rngBufDeqIndx >= SS_RNG_MAX_ULMAC_TO_ULRLC_DQ_CNT)
-       // break;
-
-      if((elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC)) == NULLP)
-      break;
-   }
-#else
-   elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
-   while(NULLP != elmIndx)
-   {
-      datInd = (RguDDatIndInfo *)elmIndx;
-      RlcProcDedLcUlData(&rlcUlRbfuPst, 0, datInd);
-
-      elmIndx = NULLP;
-      datInd = NULLP;
-      SRngIncrRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
-
-      if((elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC)) == NULLP)
-       break;
-   }
-#endif
-   return ROK;
-
-}
-
-/**
- *
- * @brief 
- *        Handler to clear Ring buffer from UL RLC
- *
- * @details
- *         This function clears all the ring buffer content from  UL RLC
- *
- * @return  S16
- *      -# ROK 
- *      -# RFAILED
- *
- */
-Void rlcUtlFreeUlRBuf(void)
-{
-   RguDDatIndInfo *datInd;
-   PTR            elem;
-   uint8_t        numLch;
-   uint8_t        numPdu;
-
-   /* Free SS_RNG_BUF_ULMAC_TO_ULRLC  */
-   while((SDeqSRngBuf (SS_RNG_BUF_ULMAC_TO_ULRLC, &elem) == ROK))
-   {
-      datInd = (RguDDatIndInfo *)elem; 
-      for(numLch = 0; numLch< datInd->numLch; numLch++)
-      {
-         for(numPdu = 0; numPdu < datInd->lchData[numLch].pdu.numPdu; numPdu++)
-         {
-            if(datInd->lchData[numLch].pdu.mBuf[numPdu])
-            {
-               ODU_PUT_MSG_BUF(datInd->lchData[numLch].pdu.mBuf[numPdu]);
-            }
-         }
-      }
-      RLC_PST_FREE(0, 0, datInd, sizeof(RguDDatIndInfo)); 
-   }
-}
-#endif
-#ifdef RLC_MAC_STA_RSP_RBUF
-S16 rlcLiRguStaRspRbuf(Pst *post,SpId spId,Void *staRsp)
-{
-   S16 ret1 = ROK;
-   
-   Void *elem = NULLP;
-
-   RguDStaRspInfo  *staRspInfo = NULL;
-   elem = SRngGetWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
-   if (NULLP != elem)
-   {
-      staRspInfo = (RguDStaRspInfo *)elem;
-      memcpy(staRspInfo, staRsp, sizeof(RguDStaRspInfo)); 
-      staRspInfo->post = *post;
-      SRngIncrWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
-      SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC].pktRate++;
-   }   
-   else
-   {
-      DU_LOG("\nERROR  -->  RLC_DL : RLC DL STA RSP RBUF is FULL!!! ");
-      SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC].pktDrop++;
-      ret1 = RFAILED;
-   }
-   return (ret1);
-} /* cmPkRlcDatReq */
-
-#endif
-#ifdef RLC_MAC_DAT_REQ_RBUF
-S16 rlcLiRguDatReqRbuf(Pst *post,SpId spId,Void *datReq)
-{
-   S16 ret1 = ROK;
-   
-   Void *elem = NULLP;
-   RguInfoRingElem *datReqRing=NULLP;
-   elem = SRngGetWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ);
-   if (NULLP != elem)
-   {
-      datReqRing = (RguInfoRingElem *) elem;
-      datReqRing->spId = spId;
-      datReqRing->event = post->event;
-      datReqRing->msg =datReq;
-      SRngIncrWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ);
-      SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ].pktRate++;
-   }   
-   else
-   {
-      DU_LOG("\nERROR  -->  RLC_DL : RLC DL DAT REQ RBUF is FULL!!! \n");
-      SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ].pktDrop++;
-      ret1 = RFAILED;
-   }
-   return (ret1);
-} /* cmPkRlcDatReq */
-
-#endif 
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-\f  
-/********************************************************************30**
-         End of file
-**********************************************************************/
diff --git a/src/5gnrrlc/kw_ptmi.c b/src/5gnrrlc/kw_ptmi.c
deleted file mode 100755 (executable)
index 2696268..0000000
+++ /dev/null
@@ -1,367 +0,0 @@
-/*******************************************************************************
-################################################################################
-#   Copyright (c) [2017-2019] [Radisys]                                        #
-#                                                                              #
-#   Licensed under the Apache License, Version 2.0 (the "License");            #
-#   you may not use this file except in compliance with the License.           #
-#   You may obtain a copy of the License at                                    #
-#                                                                              #
-#       http://www.apache.org/licenses/LICENSE-2.0                             #
-#                                                                              #
-#   Unless required by applicable law or agreed to in writing, software        #
-#   distributed under the License is distributed on an "AS IS" BASIS,          #
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
-#   See the License for the specific language governing permissions and        #
-#   limitations under the License.                                             #
-################################################################################
-*******************************************************************************/
-
-/********************************************************************20**
-
-        Name:     RLC Layer Management interface
-
-        Type:     C source file
-
-        Desc:     This file contains source code for RLC layer management
-                  interface primitives. It includes the definition of the
-                  following functions and their portable function
-                  definitions.
-                     -- PjMiLpjCfgCfm
-                     -- PjMiLpjCntrlCfm
-                     -- PjMiLpjStaInd
-
-
-        File:     kw_ptmi.c
-
-*********************************************************************21*/
-
-\f
-/* header (.h) include files */
-#include "common_def.h"
-#include "lkw.h"           /* LKW defines */
-#include "ckw.h"           /* CKW defines */
-#include "kwu.h"           /* KWU defines */
-#include "rgu.h"           /* RGU defines */
-
-#include "kw_env.h"        /* RLC environment options */
-#include "kw.h"            /* RLC defines */
-
-/* extern (.x) include files */
-#include "lkw.x"           /* LKW */
-#include "ckw.x"           /* CKW */
-#include "kwu.x"           /* KWU */
-#include "rgu.x"           /* RGU */
-
-#include "kw.x"
-
-/* local defines */
-#define MAXKWMI 2               /* max. layer management interfaces */
-
-\f
-/*********************************************************************
- *             Primitives for LKW interface 
- ********************************************************************/
-/* Configuration confirmation primitive */
-
-static RlcConfigCfm rlcMiRlcConfigCfmMt[MAXKWMI] =
-{
-#ifdef LCKWMILKW
-   packRlcConfigCfm,            /* 0 - loosely coupled - fc */
-#endif /* LCRLMILKW */
-#ifdef SM
-   SmMiRlcConfigCfm,            /* 1 - tightly coupled layer management*/
-#endif /* SM */
-};
-
-/* control confirmation primitives */
-
-static LkwCntrlCfm kwMiLkwCntrlCfmMt[MAXKWMI] =
-{
-#ifdef LCKWMILKW 
-   cmPkLkwCntrlCfm,          /* 0 - loosely coupled - fc */
-#endif /* LCRLMILKW */
-#ifdef SM
-   SmMiLkwCntrlCfm,          /* 1 - tightly coupled layer management*/
-#endif /* SM */
-};
-
-/* Status Indication primitive */
-
-static LkwStaInd kwMiLkwStaIndMt[MAXKWMI] =
-{
-#ifdef LCKWMILKW 
-   cmPkLkwStaInd,            /* 0 - loosely coupled  */
-#endif /* LCKWMILKW */
-#ifdef SM
-   SmMiLkwStaInd,            /* 1 - tightly coupled, layer management */
-#endif /* SM */
-};
-
-/* Status confirm primitive */
-
-static LkwStaCfm kwMiLkwStaCfmMt[MAXKWMI] =
-{
-#ifdef LCKWMILKW 
-   cmPkLkwStaCfm,            /* 0 - loosely coupled  */
-#endif /* LCKWMILKW */
-#ifdef SM
-   SmMiLkwStaCfm,            /* 1 - tightly coupled, layer management */
-#endif /* SM */
-};
-
-/* Statistics confirm primitive */
-
-static LkwStsCfm kwMiLkwStsCfmMt[MAXKWMI] =
-{
-#ifdef LCKWMILKW
-   cmPkLkwStsCfm,            /* 0 - loosely coupled  */
-#endif /* LCRLMILKW */
-#ifdef SM
-   SmMiLkwStsCfm,            /* 1 - tightly coupled, layer management */
-#endif /* SM */
-};
-
-/* Trace indication primitive */
-
-static LkwTrcInd kwMiLkwTrcIndMt[MAXKWMI] =
-{
-#ifdef LCKWMILKW
-   cmPkLkwTrcInd,            /* 0 - loosely coupled  */
-#endif /* LCKWMILKW */
-#ifdef SM
-   SmMiLkwTrcInd,            /* 1 - tightly coupled, layer management */
-#endif /* SM */
-};
-
-/* kw005.201 added support for L2 Measurement */
-#ifdef LTE_L2_MEAS
-static const LkwL2MeasCfm rlcMiLkwL2MeasCfmMt[] =
-{
-#ifdef LCKWMILKW
-   cmPkLkwL2MeasCfm,
-#endif
-#ifdef SM
-   SmMiLkwL2MeasCfm,
-#endif
-};
-static const LkwL2MeasStopCfm RlcMiLkwL2MeasStopCfmMt[] =
-{
-#ifdef LCKWMILKW
-   cmPkLkwL2MeasStopCfm,
-#endif
-#ifdef SM
-   SmMiLkwL2MeasStopCfm,
-#endif
-};
-#endif /*  LTE_L2_MEAS */
-\f  
-/****************************************************************************
- *                         LKW Interface Mt functions
- ***************************************************************************/
-/**
-   @brief
-   This function is called by the RlcMiRlcConfigReq function for responding
-   to configuration requests.The cfm field in the RlcMngmt  structure contains
- the response value.
-
-   - This function calls the mapping matrix for sending the configuration
-     confirmation.
-   - The actual function called depends on the coupling at the LKW interface.
-   - For a loosely coupled interface, a common packing function is called.
-   - The packing function packs the parameter in a message buffer and posts
-     the message to the target task.
-   - For a tightly coupled interface, the actual function called depends on
-     the layer manager API provided.
-
-*/
-S16 RlcMiRlcConfigCfm
-(
-Pst        *pst,                /* post structure */
-RlcMngmt    *cfm                 /* Layer Management structure */
-)
-{
-
-   /* jump to specific primitive depending on configured selector */
-   (*rlcMiRlcConfigCfmMt[pst->selector])(pst, cfm);
-   
-   return ROK;
-}
-
-
-/**
-   @brief
-   This function is called by the RlcMiLkwCntrlReq function to send a control confirm to the layer management module.
-
-   - This function calls the mapping matrix for sending the control confirmation.
-   - Actual function called depends on the coupling of the LKW interface.
-   - For a loosely coupled interface, a common packing function is called.
-   - The packing function packs the parameter in a message buffer and posts the
-     message to the target task.
-   - For a tightly coupled interface, the actual function called depends on the
-     layer manager API provided.
-
-*/
-S16 RlcMiLkwCntrlCfm
-(
-Pst *pst,                    /* post structure */
-RlcMngmt *cfm                 /* configure */
-)
-{
-
-   /* jump to specific primitive depending on configured selector */
-   (*kwMiLkwCntrlCfmMt[pst->selector])(pst, cfm);
-
-   return ROK;
-
-} /* end of RlcMiLkwCntrlCfm */
-
-/**
-   @brief
-   Description:
-   - This function can be used by RLC to send unsolicited status information
-     to the layer manager, when the unsolicited status flag is enabled by the
-     layer manager through a previous control request.
-
-   - This function calls the mapping matrix for sending the unsolicited status
-     indication.The actual function called depends on the coupling of the
-     LKW interface.
-
-   - For a loosely coupled interface, a common packing function is called. The
-     packing function packs the parameter in a message buffer and posts the
-     message to the target task.
-
-   - For a tightly coupled interface, the actual function called depends on
-     the layer manager API provided.
-*/
-S16 RlcMiLkwStaInd
-(
-Pst     *pst,                /* post structure */
-RlcMngmt *usta                /* unsolicited status */
-)
-{
-   /* jump to specific primitive depending on configured selector */
-   (*kwMiLkwStaIndMt[pst->selector])(pst, usta);
-
-   return (ROK);
-} /* end of RlcMiLkwStaInd */
-
-
-/**
-   @brief
-   - This function is called by the RlcMiLkwStaReq function to send
-      the requested status information to the layer manager.
-
-   - This function calls the mapping matrix for sending the status
-      confirmation. The actual function called depends on the coupling
-      of the LKW interface.
-
-   - For a loosely coupled interface, a common packing function is called.
-      The packing function packs the parameter in a message buffer and
-      posts the message to the target task.
-
-   - For a tightly coupled interface, the actual function called depends
-      on the layer manager API provided.
-
-*/
-S16 RlcMiLkwStaCfm
-(
-Pst *pst,                    /* post structure */
-RlcMngmt *cfm                 /* solicited status confirmation */
-)
-{
-
-   /* jump to specific primitive depending on configured selector */
-   (*kwMiLkwStaCfmMt[pst->selector])(pst, cfm);
-
-   return ROK;
-
-} /* end of RlcMiLkwStaCfm */
-
-
-/**
-   @brief
-   - This function is called by the RlcMiLkwStsReq function for responding
-      to statistics requests.
-
-   - This function calls the mapping matrix for sending the statistics
-      confirmation. The actual function called depends on the coupling
-      of the LKW interface.
-
-   - For a loosely coupled interface, a common packing function is called.
-      The packing function packs the parameter in a message buffer and
-      posts the message to the target task.
-
-   - For a tightly coupled interface, the actual function called depends
-      on the layer manager API provided.
-
-*/
-S16 RlcMiLkwStsCfm
-(
-Pst *pst,                    /* post structure */
-Action action,               /* action */
-RlcMngmt *cfm                 /* statistics confirmation */
-)
-{
-   /* jump to specific primitive depending on configured selector */
-   (*kwMiLkwStsCfmMt[pst->selector])(pst, action, cfm);
-
-   return ROK;
-
-} /* end of RlcMiLkwStsCfm */
-
-/**
-   @brief
-   - This function can be used by RLC module to send unsolicited trace
-      indications to the layer manager, when tracing is enabled by the
-      layer manager through a previous control request.
-
-   - This function calls the mapping matrix for sending the trace indication.
-      The actual function called depends on the coupling of the LKW interface.
-
-   - For a loosely coupled interface, a common packing function is called.
-      The packing function packs the parameter in a message buffer and posts
-      the message to the target task.
-
-   - For a tightly coupled interface, the actual function called depends on
-      the layer manager API provided.
-
-*/
-S16 RlcMiLkwTrcInd
-(
-Pst *pst,                    /* post structure */
-RlcMngmt *trc,                /* trace indication */
-Buffer *mBuf                 /* message buffer */
-)
-{
-   /* jump to specific primitive depending on configured selector */
-   (*kwMiLkwTrcIndMt[pst->selector])(pst, trc, mBuf);
-
-   return ROK;
-
-} /* end of RlcMiLkwTrcInd */
-
-
-/* kw005.201 added support for L2 Measurement */
-#ifdef LTE_L2_MEAS
-S16 RlcMiLkwL2MeasCfm(Pst * pst,RlcL2MeasCfmEvt *measEvt)
-{
-
-   (*rlcMiLkwL2MeasCfmMt[pst->selector])(pst, measEvt);
-
-   return ROK;
-
-}
-S16 RlcMiLkwL2MeasStopCfm(Pst *pst,uint8_t measType,uint8_t status)
-{
-
-   (*RlcMiLkwL2MeasStopCfmMt[pst->selector])(pst, measType,status);
-
-   return ROK;
-
-}
-#endif /*  LTE_L2_MEAS */
-
-/********************************************************************30**
-
-         End of file
-**********************************************************************/
diff --git a/src/5gnrrlc/kw_udx.h b/src/5gnrrlc/kw_udx.h
deleted file mode 100755 (executable)
index 38b117e..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
-################################################################################
-#   Copyright (c) [2017-2019] [Radisys]                                        #
-#                                                                              #
-#   Licensed under the Apache License, Version 2.0 (the "License");            #
-#   you may not use this file except in compliance with the License.           #
-#   You may obtain a copy of the License at                                    #
-#                                                                              #
-#       http://www.apache.org/licenses/LICENSE-2.0                             #
-#                                                                              #
-#   Unless required by applicable law or agreed to in writing, software        #
-#   distributed under the License is distributed on an "AS IS" BASIS,          #
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
-#   See the License for the specific language governing permissions and        #
-#   limitations under the License.                                             #
-################################################################################
-*******************************************************************************/
-
-/********************************************************************20**
-  
-        Name:    UDX  Control Interface
-    
-        Type:    C include file
-  
-        Desc:    This file Contains the Data structures for and prototypes
-                  UDX Interface
-        File:    kw_udx.h
-  
-*********************************************************************21*/
-
-#ifndef __KW_UDX_H__
-#define __KW_UDX_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/** @file kw_udx.h
-    @brief UDX Interface File (ckw.h)
-*/
-/* UDX Interface Hash Defines */
-
-/* Loose Coupling define */
-#define UDX_SEL_LC            0     /*!< Loose Coupling Option */
-#define UDX_SEL_LWLC          1
-#define RLC_MAX_UDX 3
-
-
-/* CKW Interface defines */
-#define UDX_MAX_ENT_CFG       24    /*!< Maximum number of entities to configure */
-
-#define   ERRUDX 0
-#define   EUDXXXX 0
-/* ckw_h_001.main_3 added support for L2 Measurement */   
-#ifdef LTE_L2_MEAS
-#define UDX_MAX_QCI           10
-#endif
-/* CKW Interface configuration type */
-#define UDX_CFG_ADD           1     /*!< Add RLC Entity */
-#define UDX_CFG_MODIFY        2     /*!< Modify RLC Entity */
-#define UDX_CFG_DELETE        3     /*!< Delete RLC entity */
-#define UDX_CFG_REESTABLISH   4     /*!< Re-establish RLC entity */
-#define UDX_CFG_DELETE_UE     5     /*!< Release RLC entities per UE */
-#define UDX_CFG_DELETE_CELL   6     /*!< Release RLC entities per Cell */
-
-/* CKW RLC entity direction configuration */
-#define UDX_CFG_DIR_UL        1     /*!< Unlink direction */
-#define UDX_CFG_DIR_DL        2     /*!< Downlink direction */
-#define UDX_CFG_DIR_BOTH      3     /*!< Both Downlink and Unlink */
-
-/* CKW Configuration confirmations */
-#define UDX_CFG_CFM_OK        1     /*!< Configuration confirmation success */
-#define UDX_CFG_CFM_NOK       2     /*!< Configuration confirmation failed */
-
-/***********************************************************************
-        Defines for  CKW Interface Events
- ***********************************************************************/
-#define UDX_EVT_BND_REQ              0x01   /*!< Bind Request */
-#define UDX_EVT_BND_CFM              0x02   /*!< Bind Confirm */
-#define UDX_EVT_UBND_REQ             0x03   /*!< Unbind Request */
-#define UDX_EVT_CFG_REQ              0x04   /*!< Config Request */
-#define UDX_EVT_CFG_CFM              0x05   /*!< Config Confirm */
-#define UDX_EVT_UEIDCHG_REQ          0x06   /*!< UE Id Change Request */
-#define UDX_EVT_UEIDCHG_CFM          0x07   /*!< UE Id Change Confirm */
-#define UDX_EVT_STA_UPD_REQ          0x08
-#define UDX_EVT_STA_UPD_CFM          0x09
-#define UDX_EVT_STA_PDU_REQ          0x0A
-#define UDX_EVT_STA_PHBT_TMR_START   0x0B
-#define UDX_EVT_DL_CLEANUP_MEM       0x10   /*!< To cleanup memory in DL inst */
-
-/***********************************************************************
-        Defines for Measurements 
- ***********************************************************************/
-#define UDX_EVT_L2MEAS_REQ           0x11 
-#define UDX_EVT_L2MEAS_SEND_REQ      0x12 
-#define UDX_EVT_L2MEAS_STOP_REQ      0x13 
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-
-\f  
-/********************************************************************30**
-         End of file
-**********************************************************************/
diff --git a/src/5gnrrlc/kw_ul.h b/src/5gnrrlc/kw_ul.h
deleted file mode 100755 (executable)
index 00ec5d0..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
-################################################################################
-#   Copyright (c) [2017-2019] [Radisys]                                        #
-#                                                                              #
-#   Licensed under the Apache License, Version 2.0 (the "License");            #
-#   you may not use this file except in compliance with the License.           #
-#   You may obtain a copy of the License at                                    #
-#                                                                              #
-#       http://www.apache.org/licenses/LICENSE-2.0                             #
-#                                                                              #
-#   Unless required by applicable law or agreed to in writing, software        #
-#   distributed under the License is distributed on an "AS IS" BASIS,          #
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
-#   See the License for the specific language governing permissions and        #
-#   limitations under the License.                                             #
-################################################################################
-*******************************************************************************/
-
-/********************************************************************20**
-  
-        Name:     NR RLC file for uplink and non real time tasks 
-    
-        Type:     C include file
-  
-        Desc:     This file contains helper macros for RLC uplink
-                  and non real time tasks
-        File:     kw_ul.h
-
-*********************************************************************21*/
-/** 
- * @file kw_ul.h
- * @brief RLC uplink helper macros
-*/
-
-#ifndef __KW_ULH__
-#define __KW_ULH__
-
-/**
- * @def RLC_MEAS_IS_UL_IP_MEAS_ON_FOR_RB
- *
- *    This macro is used to check if UL IP throughput measurement is ON
- *    or off for the passed rb
- *
- *    Returns TRUE(non-zero) if measurement is ON else FALSE (zero)
- *
- * @param[in] _gCb     RLC UL Cb
- * @param[in] _rbCb    RLC uplink control block
- *
-*/ 
-#define RLC_MEAS_IS_UL_IP_MEAS_ON_FOR_RB(_gCb, _rbCb)  \
-     ((_rbCb->rlcId.rbType == CM_LTE_DRB) && \
-     (_gCb->u.ulCb->rlcL2Cb.measOn[_rbCb->qci] & LKW_L2MEAS_UL_IP) && \
-     (_rbCb->rbL2Cb.measOn & LKW_L2MEAS_UL_IP))
-#endif /* __KW_ULH__ */
-\f  
-/********************************************************************30**
-  
-         End of file
-**********************************************************************/
similarity index 99%
rename from src/5gnrrlc/kw_amm_dl.c
rename to src/5gnrrlc/rlc_amm_dl.c
index 609434d..a9a1da3 100755 (executable)
@@ -32,7 +32,7 @@
                  Duplicate detection for byte segments
                  Reassemble SDUs
                   
-        File:   kw_amm_dl.c 
+        File:   rlc_amm_dl.c 
   
 *********************************************************************21*/
 /* header include files (.h) */
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_err.h"        /* Err defines */
-#include "kw_env.h"        /* RLC environment options */
-
-#include "kw.h"            /* RLC defines */
-#include "kw_udx.h"
-#include "kw_dl.h"
-
+#include "rlc_err.h"        /* Err defines */
+#include "rlc_env.h"        /* RLC environment options */
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
@@ -55,9 +50,9 @@
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
-#include "kw.x"
-#include "kw_udx.x"
-#include "kw_dl.x"
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"
 
 //UDAY
 #ifdef L2_OPTMZ
@@ -88,7 +83,7 @@ Void rlcAmmDlHndlStatusPdu ARGS ((RlcCb  *gCb,
 
 /* private variable declarations */
 
-#define RLC_AM_RMV_HDR(_gCb, _rbCb, _retx) do { \
+#define RLC_AM_REMOVE_HDR(_gCb, _rbCb, _retx) do { \
   if ((_retx)->yetToConst == FALSE) \
   {\
      Buffer    *_pduInfo; \
@@ -1483,7 +1478,7 @@ static void rlcResegRetxPdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *rlcDatReq)
          tNode->lstEnt.prev = 0;
          
          /* Segment header and data */
-         RLC_AM_RMV_HDR(gCb, rbCb, retx);
+         RLC_AM_REMOVE_HDR(gCb, rbCb, retx);
 
          /* kw003.201 - Split the payload and update other fields */
          rlcSplitPdu(gCb,rbCb, retx, tNode, rlcDatReq->pduSz); 
similarity index 99%
rename from src/5gnrrlc/kw_amm_ul.c
rename to src/5gnrrlc/rlc_amm_ul.c
index afdd334..b77a4ca 100755 (executable)
@@ -32,7 +32,7 @@
                  Duplicate detection for byte segments
                  Reassemble SDUs
 
-        File:    kw_amm_ul.c
+        File:    rlc_amm_ul.c
 
 *********************************************************************21*/
 
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_udx.h"
-#include "kw_err.h"        /* Err defines */
-#include "kw_env.h"        /* RLC environment options */
-
-#include "kw.h"            /* RLC defines */
-#include "kw_ul.h"
+#include "rlc_err.h"        /* Err defines */
+#include "rlc_env.h"        /* RLC environment options */
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
-#include "kw.x"
-#include "kw_ul.x"
-#include "kw_udx.x"
-
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_ul.h"
 /* Variable for logging, declared in cl */
 #ifndef RGL_SPECIFIC_CHANGES
 #ifndef TENB_ACC
similarity index 99%
rename from src/5gnrrlc/kw_cfg_dl.c
rename to src/5gnrrlc/rlc_cfg_dl.c
index e8f6ccc..9c24eb4 100755 (executable)
                     -- rlcCfgReEstRb
                     -- rlcCfgDelUe
 
-        File:    kw_cfg_dl.c
+        File:    rlc_cfg_dl.c
 
 *********************************************************************21*/
 
-/** @file kw_cfg_dl.c
+/** @file rlc_cfg_dl.c
 @brief RLC Downlink Configuration Module
 **/
 
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_err.h"        /* RLC error options */
-#include "kw_env.h"        /* RLC environment options */
-#include "kw.h"            /* RLC defines */
-#include "kw_udx.h"
-#include "kw_dl.h"
+#include "rlc_err.h"        /* RLC error options */
+#include "rlc_env.h"        /* RLC environment options */
+
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
@@ -61,9 +59,9 @@
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
-#include "kw.x"
-#include "kw_udx.x"
-#include "kw_dl.x"
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"
 #include "du_app_rlc_inf.h"
 
 #define RLC_MODULE RLC_DBGMASK_CFG
similarity index 99%
rename from src/5gnrrlc/kw_cfg_ul.c
rename to src/5gnrrlc/rlc_cfg_ul.c
index 7f919cd..6d64fc0 100755 (executable)
                     -- rlcCfgFillRbCb
                     -- rlcCfgRbInit
 
-        File:     kw_cfg_ul.c
+        File:     rlc_cfg_ul.c
 
 *********************************************************************21*/
-/** @file kw_cfg_ul.c
+/** @file rlc_cfg_ul.c
 @brief RLC Uplink Configuration Module
 **/
 
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_err.h"        /* RLC error options */
-#include "kw_env.h"        /* RLC environment options */
-#include "kw.h"            /* RLC defines */
-#include "kw_ul.h"
+#include "rlc_err.h"        /* RLC error options */
+#include "rlc_env.h"        /* RLC environment options */
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
@@ -53,8 +51,8 @@
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
-#include "kw.x"
-#include "kw_ul.x"
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_ul.h"
 #ifdef TENB_STATS
 #ifdef L2_L3_SPLIT
 #include "l2_tenb_stats.x"    /* Total EnodeB Stats declarations */
similarity index 98%
rename from src/5gnrrlc/kw_dbm_dl.c
rename to src/5gnrrlc/rlc_dbm_dl.c
index b9de678..68be787 100755 (executable)
@@ -44,7 +44,7 @@
                  - kwDbmDelAllCell
                  - kwDbmShutdown
 
-        File:    kw_dbm_dl.c
+        File:    rlc_dbm_dl.c
   
 *********************************************************************21*/
 
 #include "ckw.h"           /* CKW defines */
 #include "rgu.h"           /* RGU defines */
 #include "kwu.h"           /* KWU defines */
-#include "kw_err.h"        /* Err defines */
-#include "kw_env.h"        /* RLC environment options */
-#include "kw.h"            /* RLC defines */
-#include "kw_udx.h"
-#include "kw_dl.h"
+#include "rlc_err.h"        /* Err defines */
+#include "rlc_env.h"        /* RLC environment options */
+
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
 #include "ckw.x"           /* CKW */
 #include "rgu.x"           /* RGU */
 #include "kwu.x"           /* KWU */
-#include "kw.x"
-#include "kw_udx.x"
-#include "kw_dl.x"
 
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"
 
 #ifdef TENB_STATS
 TSL2UeStatsCb* TSL2MapUeStatsBlk (uint16_t rnti);
similarity index 98%
rename from src/5gnrrlc/kw_dbm_ul.c
rename to src/5gnrrlc/rlc_dbm_ul.c
index 21b588b..55ced39 100755 (executable)
@@ -24,7 +24,7 @@
   
         Desc:    Source code for Database Module functions such as, 
 
-        File:    kw_dbm_ul.c
+        File:    rlc_dbm_ul.c
   
 *********************************************************************21*/
 
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_err.h"        /* Err defines */
-#include "kw_env.h"        /* RLC environment options */
+#include "rlc_err.h"        /* Err defines */
+#include "rlc_env.h"        /* RLC environment options */
 
-#include "kw.h"            /* RLC defines */
-#include "kw_ul.h"
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
@@ -47,8 +45,8 @@
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
-#include "kw.x"
-#include "kw_ul.x"
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_ul.h"
 
 /** 
  * @file gp_dbm_ul.c
similarity index 81%
rename from src/5gnrrlc/kw_dl.x
rename to src/5gnrrlc/rlc_dl.h
index e686fae..ef6880e 100755 (executable)
 
 /********************************************************************20**
   
-        Name:    NR RLC file      
+        Name:     NR RLC file for downlink and non real time tasks 
     
-        Type:    C include file
+        Type:     C include file
   
-        Desc:    This file contains all the data structures and 
-                 prototypes for RLC.
+        Desc:     This file contains helper macros for RLC downlink
+                  and non real time task
  
-        File:    kw_dl.x
+        File:     rlc_dl.h
   
 *********************************************************************21*/
-/** 
- * @file kw_dl.x
- * @brief RLC downlink structures, prototypes
+/** @file rlc_dl.h
+@brief RLC Downlink helper macros 
 */
 
-#ifndef __KW_DLX__
-#define __KW_DLX__
+#ifndef __RLC_DLH__
+#define __RLC_DLH__
+
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
@@ -46,6 +45,141 @@ extern "C" {
 #include "l2_tenb_stats.x"
 #endif
 #endif
+
+#define RLC_DL_INST 1
+#define RLC_MAX_RNG_DEQ_INDX 8
+
+/* Below are the status used within RLC */
+#define RLC_SDU_OPAT_NOUPDATE 0
+#define RLC_SDU_OPAT_UPD_TX 1
+#define RLC_SDU_OPAT_UPD_RETX   2
+
+/* Below are the status which needs to be updated to MAC */
+#define RLC_RGU_SDU_OPAT_NOUPDATE 0
+#define RLC_RGU_SDU_OPAT_UPDATE   1
+#define RLC_RGU_SDU_OPAT_BREACH   2
+
+/* PDB Values for various QCI bearers : This value is considered 
+   after taking into account a 20ms delay at the network */
+#define RLC_PDB_VALUE_FOR_QCI1    80
+#define RLC_PDB_VALUE_FOR_QCI2    130
+#define RLC_PDB_VALUE_FOR_QCI3    30
+#define RLC_PDB_VALUE_FOR_QCI4    280
+#define RLC_PDB_VALUE_FOR_QCI5    80
+#define RLC_PDB_VALUE_FOR_QCI6    280
+#define RLC_PDB_VALUE_FOR_QCI7    80
+#define RLC_PDB_VALUE_FOR_QCI8    280
+#define RLC_PDB_VALUE_FOR_QCI9    280
+
+#define RLC_DATA_BITMASK          0x80 /* Data bitmask is used to fill D/C bit for data*/
+/**
+ * @def RLC_MEAS_IS_DL_IP_MEAS_ON_FOR_RB
+ *
+ *    This macro is used to check if DL IP throughput measurement is ON
+ *    or off for the passed rb
+ *
+ *    Returns TRUE (non-zero) if measurement is ON else FALSE (zero)
+ *
+ * @param[in] _gCb     RLC DL Cb
+ * @param[in] _rbCb    RLC downlink control block
+ *
+*/ 
+#ifdef LTE_L2_MEAS
+#define RLC_MEAS_IS_DL_ANY_MEAS_ON_FOR_RB(_gCb, _rbCb)  \
+     ((_rbCb->rlcId.rbType == CM_LTE_DRB) && \
+            (_gCb->u.dlCb->rlcL2Cb.measOn[_rbCb->qci]))
+
+#define RLC_MEAS_IS_DL_IP_MEAS_ON_FOR_RB(_gCb, _rbCb)  \
+     ((_rbCb->rlcId.rbType == CM_LTE_DRB) && \
+      (_gCb->u.dlCb->rlcL2Cb.measOn[_rbCb->qci] & LKW_L2MEAS_DL_IP) && \
+      (_rbCb->rbL2Cb.measOn & LKW_L2MEAS_DL_IP))
+
+#define RLC_MEAS_IS_DL_DELAY_MEAS_ON_FOR_RB(_gCb, _rbCb)  \
+     ((_rbCb->rlcId.rbType == CM_LTE_DRB) && \
+            (_gCb->u.dlCb->rlcL2Cb.measOn[_rbCb->qci] & LKW_L2MEAS_DL_DELAY))
+
+#define RLC_MEAS_IS_DL_UU_LOSS_MEAS_ON_FOR_RB(_gCb, _rbCb)  \
+     ((_rbCb->rlcId.rbType == CM_LTE_DRB) && \
+            (_gCb->u.dlCb->rlcL2Cb.measOn[_rbCb->qci] & LKW_L2MEAS_UU_LOSS))
+#define RLC_UPD_PDCP_L2_DLDELAY_STS(_rlcCb, _rlcRbCb, _delay)                     \
+{                                                                              \
+   if(((_rlcRbCb)->rlcId.rbType == CM_LTE_DRB) &&                               \
+      ((_rlcCb)->u.dlCb->rlcL2Cb.measOn[_rlcRbCb->qci] & LKW_L2MEAS_DL_DELAY))    \
+   {                                                                           \
+      (_rlcRbCb)->rbL2Cb.l2Sts[RLC_L2MEAS_DL_DELAY]->dlPjSduDelay.sduDelay += _delay; \
+      (_rlcRbCb)->rbL2Cb.l2Sts[RLC_L2MEAS_DL_DELAY]->dlPjSduDelay.numSdus++; \
+   }                                                                    \
+}
+
+#define RLC_UPD_L2_UU_LOSS_PKTS(_rlcCb, _rlcRbCb, _val)                         \
+{                                                                 \
+   if(((_rlcRbCb)->rlcId.rbType == CM_LTE_DRB) &&                              \
+      ((_rlcCb)->u.dlCb->rlcL2Cb.measOn[_rlcRbCb->qci] & LKW_L2MEAS_UU_LOSS))              \
+   {                                                              \
+      (_rlcRbCb)->rbL2Cb.l2Sts[RLC_L2MEAS_UU_LOSS]->uuLoss.dLoss += _val;     \
+   }                                                              \
+}
+#define RLC_UPD_L2_UU_LOSS_POS_PKTS(_rlcCb,_rlcRbCb,_val)                         \
+{                                                                 \
+   if(((_rlcRbCb)->rlcId.rbType == CM_LTE_DRB) &&                              \
+      ((_rlcCb)->u.dlCb->rlcL2Cb.measOn[_rlcRbCb->qci] & LKW_L2MEAS_UU_LOSS))              \
+   {                                                              \
+      (_rlcRbCb)->rbL2Cb.l2Sts[RLC_L2MEAS_UU_LOSS]->uuLoss.posPkts += _val;     \
+   }                                                              \
+}
+/* Discard new changes starts */
+#define RLC_UPD_L2_DL_DISC_SDU_STS(_rlcCb,_rlcRbCb)                         \
+{                                                                 \
+   if(((_rlcRbCb)->rlcId.rbType == CM_LTE_DRB) &&                              \
+      ((_rlcCb)->u.dlCb->rlcL2Cb.measOn[_rlcRbCb->qci] & LKW_L2MEAS_DL_DISC))              \
+   {                                                              \
+      (_rlcRbCb)->rbL2Cb.l2Sts[RLC_L2MEAS_DL_DISC]->dlDisc.discSdus++;     \
+   }                                                              \
+}                                              
+
+#define RLC_UPD_L2_DL_TOT_SDU_STS(_rlcCb,_rlcRbCb)                             \
+{                                                                 \
+   if(((_rlcRbCb)->rlcId.rbType == CM_LTE_DRB) &&                              \
+      ((_rlcCb)->u.dlCb->rlcL2Cb.measOn[_rlcRbCb->qci] & LKW_L2MEAS_DL_DISC))   \
+   {                                                              \
+      (_rlcRbCb)->rbL2Cb.l2Sts[RLC_L2MEAS_DL_DISC]->dlDisc.totSdus++;      \
+   }                                                              \
+}
+
+#define RLC_UPD_L2_DECR_NONIP_PER_QCI_RB_COUNT(_rlcCb, _rlcRbCb)                 \
+{                                                                 \
+   if(((_rlcRbCb)->rlcId.rbType == CM_LTE_DRB) &&                    \
+      ((_rlcCb)->u.dlCb->rlcL2Cb.measOn[_rlcRbCb->qci] & LKW_L2MEAS_DL_DISC))   \
+   {                                                              \
+      uint32_t idx1;                                                    \
+      for (idx1 = 0; idx1 < LKW_MAX_L2MEAS; idx1++)                  \
+      {                                                           \
+         if(_rlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[idx1].measCb.measType & LKW_L2MEAS_DL_DISC)                 \
+         {                                                        \
+            if(_rlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[idx1].measCb.val.nonIpThMeas.measData[(_rlcRbCb)->qci].totDrbsPerQci > 0) \
+            {                                                                                               \
+               _rlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[idx1].measCb.val.nonIpThMeas.measData[(_rlcRbCb)->qci].totDrbsPerQci--;   \
+               if (_rlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[idx1].measCb.val.nonIpThMeas.measData[(_rlcRbCb)->qci].totDrbsPerQci == 0) \
+               {                                                                                                 \
+                  _rlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[idx1].measCb.val.nonIpThMeas.qci[(_rlcRbCb)->qci] = 0;                      \
+                  memset(&_rlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[idx1].measCb.val.nonIpThMeas.measData[(_rlcRbCb)->qci], 0,  \
+                     sizeof(_rlcCb->u.dlCb->rlcL2Cb.rlcL2EvtCb[idx1].measCb.val.nonIpThMeas.measData[(_rlcRbCb)->qci]));            \
+               }                                                                                                 \
+            }                                                                                                    \
+         }                                                                                                       \
+      }                                                                                                          \
+   }                                                                                                             \
+}
+#else
+#define RLC_UPD_PDCP_L2_DLDELAY_STS(_rlcCb, _rlcRbCb, _delay)
+#define RLC_MEAS_IS_DL_IP_MEAS_ON_FOR_RB(_gCb, _rbCb)
+#define RLC_MEAS_IS_DL_DELAY_MEAS_ON_FOR_RB(_gCb, _rbCb)
+#define RLC_UPD_L2_DL_DISC_SDU_STS(_rlcCb,_rlcRbCb)
+#define RLC_UPD_L2_DL_TOT_SDU_STS(_rlcCb, _rlcRbCb)
+#define RLC_UPD_L2_DECR_NONIP_PER_QCI_RB_COUNT(_rlcCb, _rlcRbCb)
+#endif
+
+
 typedef struct rlcDlUeCb RlcDlUeCb;
 
 /** 
@@ -840,8 +974,7 @@ Void rlcUtlFreeDlMem ARGS(( Void));
 }
 #endif /* __cplusplus */
 
-#endif /* __KW_DLX__ */
-
+#endif /* __RLC_DLH__ */
 \f  
 /********************************************************************30**
   
similarity index 98%
rename from src/5gnrrlc/kw_dl_ex_ms.c
rename to src/5gnrrlc/rlc_dl_msg_router.c
index 16492a2..63c958b 100755 (executable)
         Desc:    C source code for the interface to System Services
                   of NR RLC
  
-        File:    kw_dl_ex_ms.c
+        File:    rlc_dl_msg_router.c
   
 *********************************************************************21*/
 
-/** @filekw_dl_ex_ms.c 
+/** @filerlc_dl_msg_router.c
 @brief RLC System Services Interface
 */
 
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_err.h"        /* Err defines */
-#include "kw_env.h"        /* RLC environment options */
-#include "kw.h"            /* RLC defines */
-#include "kw_udx.h"
-#include "kw_dl.h"
+#include "rlc_err.h"        /* Err defines */
+#include "rlc_env.h"        /* RLC environment options */
+
 
 
 /* extern (.x) include files */
 #include "ckw.x"           /* CKW */
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
-#include "kw.x"
-#include "kw_udx.x"
-#include "kw_dl.x"
+
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"
 #include "du_app_rlc_inf.h"
 #include "rlc_mac_inf.h"
 
similarity index 98%
rename from src/5gnrrlc/kw_udx.c
rename to src/5gnrrlc/rlc_dl_ul_inf.c
index ccb2f33..0538fee 100755 (executable)
         Desc:    This file Contains the packing and unpacking functions for
                  UDX Interface
  
-        File:    kw_udx.c
+        File:    rlc_dl_ul_inf.c
   
 *********************************************************************21*/
 #include "common_def.h"
-#include "lkw.h"
-#include "kw_udx.h"           /* UDX defines */
-#include "kw.h"
+#include "rgu.h"           /* RGU interface includes*/
+#include "lkw.h"           /* LKW defines */
+#include "ckw.h"           /* CKW defines */
 
 /* extern (.x) include files */
-#include "lkw.x"
-#include "kw_udx.x"
-\f
+#include "rgu.x"           
+#include "lkw.x"           /* LKW */
+#include "ckw.x"           /* CKW */
+
+#include "rlc_env.h"
+#include "rlc_utils.h"
+#include "rlc_dl_ul_inf.h"           /* UDX defines */
 
 #ifdef LCUDX
 
@@ -1236,7 +1240,7 @@ S16 cmUnpkUdxStaPduReq(UdxStaPduReq func,Pst *pst,Buffer *mBuf)
 *
 *    Notes:   None
 *
-*    File:    kw_udx.c
+*    File:    rlc_dl_ul_inf.c
 *
 */
 S16 cmUnpkUdxStaProhTmrStart(UdxStaProhTmrStart func,Pst *pst,Buffer *mBuf)
similarity index 79%
rename from src/5gnrrlc/kw_udx.x
rename to src/5gnrrlc/rlc_dl_ul_inf.h
index d63c6b1..e66af1b 100755 (executable)
 *******************************************************************************/
 
 /**********************************************************************
+  
+        Name:    UDX  Control Interface
+    
+        Type:    C include file
+  
+        Desc:    This file Contains the Data structures for and prototypes
+                  UDX Interface
  
-    Name:   NR RLC layer
-    Type:   C include file
-    Desc:   Defines required by LTE MAC
-    File:   kw_udx.x
+        File:    rlc_dl_ul_inf.h
+  
 **********************************************************************/
-/** @file kw_udx.x
-@brief This file contains basic data structures for the Uplink Downlink 
-interface.
-*/
-#ifndef __UDX_X__
-#define __UDX_X__
 
-#include "ckw.h"
-#include "ckw.x"
+#ifndef __RLC_DL_UL_INF_H__
+#define __RLC_DL_UL_INF_H__
 
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 
+
+/** @file rlc_dl_ul_inf.h
+    @brief UDX Interface File (ckw.h)
+*/
+/* UDX Interface Hash Defines */
+
+/* Loose Coupling define */
+#define UDX_SEL_LC            0     /*!< Loose Coupling Option */
+#define UDX_SEL_LWLC          1
+#define RLC_MAX_UDX 3
+
+
+/* CKW Interface defines */
+#define UDX_MAX_ENT_CFG       24    /*!< Maximum number of entities to configure */
+
+#define   ERRUDX 0
+#define   EUDXXXX 0
+/* ckw_h_001.main_3 added support for L2 Measurement */   
+#ifdef LTE_L2_MEAS
+#define UDX_MAX_QCI           10
+#endif
+/* CKW Interface configuration type */
+#define UDX_CFG_ADD           1     /*!< Add RLC Entity */
+#define UDX_CFG_MODIFY        2     /*!< Modify RLC Entity */
+#define UDX_CFG_DELETE        3     /*!< Delete RLC entity */
+#define UDX_CFG_REESTABLISH   4     /*!< Re-establish RLC entity */
+#define UDX_CFG_DELETE_UE     5     /*!< Release RLC entities per UE */
+#define UDX_CFG_DELETE_CELL   6     /*!< Release RLC entities per Cell */
+
+/* CKW RLC entity direction configuration */
+#define UDX_CFG_DIR_UL        1     /*!< Unlink direction */
+#define UDX_CFG_DIR_DL        2     /*!< Downlink direction */
+#define UDX_CFG_DIR_BOTH      3     /*!< Both Downlink and Unlink */
+
+/* CKW Configuration confirmations */
+#define UDX_CFG_CFM_OK        1     /*!< Configuration confirmation success */
+#define UDX_CFG_CFM_NOK       2     /*!< Configuration confirmation failed */
+
+/***********************************************************************
+        Defines for  CKW Interface Events
+ ***********************************************************************/
+#define UDX_EVT_BND_REQ              0x01   /*!< Bind Request */
+#define UDX_EVT_BND_CFM              0x02   /*!< Bind Confirm */
+#define UDX_EVT_UBND_REQ             0x03   /*!< Unbind Request */
+#define UDX_EVT_CFG_REQ              0x04   /*!< Config Request */
+#define UDX_EVT_CFG_CFM              0x05   /*!< Config Confirm */
+#define UDX_EVT_UEIDCHG_REQ          0x06   /*!< UE Id Change Request */
+#define UDX_EVT_UEIDCHG_CFM          0x07   /*!< UE Id Change Confirm */
+#define UDX_EVT_STA_UPD_REQ          0x08
+#define UDX_EVT_STA_UPD_CFM          0x09
+#define UDX_EVT_STA_PDU_REQ          0x0A
+#define UDX_EVT_STA_PHBT_TMR_START   0x0B
+#define UDX_EVT_DL_CLEANUP_MEM       0x10   /*!< To cleanup memory in DL inst */
+
+/***********************************************************************
+        Defines for Measurements 
+ ***********************************************************************/
+#define UDX_EVT_L2MEAS_REQ           0x11 
+#define UDX_EVT_L2MEAS_SEND_REQ      0x12 
+#define UDX_EVT_L2MEAS_STOP_REQ      0x13 
+
 typedef struct rlcNackInfo
 {
    uint8_t nackRange;
@@ -297,12 +352,16 @@ S16 rlcUlUdxL2MeasStopReq ARGS((Pst* pst, uint8_t measType));
 
 #endif
 
+
+
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
-#endif /* __UDX_X__ */
 
+#endif
 
-/**********************************************************************
+\f  
+/********************************************************************30**
          End of file
 **********************************************************************/
similarity index 98%
rename from src/5gnrrlc/kw_udx_dl.c
rename to src/5gnrrlc/rlc_dl_ul_inf_dl.c
index 421ee67..77f652d 100755 (executable)
@@ -24,7 +24,7 @@
  
     Desc:   Defines required by LTE MAC
  
-    File:   kw_udx_dl.c
+    File:   rlc_dl_ul_inf_dl.c
 
 **********************************************************************/
 
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_err.h"        /* Err defines */
-#include "kw_env.h"        /* RLC environment options */
+#include "rlc_err.h"        /* Err defines */
+#include "rlc_env.h"        /* RLC environment options */
 
-#include "kw.h"            /* RLC defines */
-#include "kw_udx.h"
-#include "kw_dl.h"
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
-#include "kw.x"
-#include "kw_udx.x"
-#include "kw_dl.x"
-
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"
 
 #define RLC_MODULE RLC_DBGMASK_UDX
 /* local defines */
similarity index 97%
rename from src/5gnrrlc/kw_udx_ptdl.c
rename to src/5gnrrlc/rlc_dl_ul_inf_ptdl.c
index 536a245..cd222e0 100755 (executable)
   
      Desc:     C source code for INF Interface Module 
   
-     File:     kw_udx_ptdl.c
+     File:     rlc_dl_ul_inf_ptdl.c
   
 **********************************************************************/
 
-/** @file kw_udx_ptdl.c
+/** @file rlc_dl_ul_inf_ptdl.c
 */
 
 /* header include files (.h) */
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_err.h"        /* Err defines */
-#include "kw_env.h"        /* RLC environment options */
-
-#include "kw.h"            /* RLC defines */
-#include "kw_udx.h"
-#include "kw_dl.h"
-
+#include "rlc_err.h"        /* Err defines */
+#include "rlc_env.h"        /* RLC environment options */
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
-#include "kw.x"
-#include "kw_udx.x"
-#include "kw_dl.x"
-
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"
 
 #define UDX_MAX_SEL   3
 
similarity index 98%
rename from src/5gnrrlc/kw_udx_ptul.c
rename to src/5gnrrlc/rlc_dl_ul_inf_ptul.c
index 0e1bdd3..feb1e8f 100755 (executable)
   
      Desc:     C source code for INF Interface Module 
   
-     File:     kw_udx_ptul.c
+     File:     rlc_dl_ul_inf_ptul.c
   
 **********************************************************************/
 
-/** @file kw_udx_ptul.c
+/** @file rlc_dl_ul_inf_ptul.c
 */
 
 /* header include files (.h) */
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_err.h"        /* Err defines */
-#include "kw_env.h"        /* RLC environment options */
-
-#include "kw.h"            /* RLC defines */
-#include "kw_udx.h"
-#include "kw_dl.h"
+#include "rlc_err.h"        /* Err defines */
+#include "rlc_env.h"        /* RLC environment options */
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
-#include "kw.x"
-#include "kw_udx.x"
-#include "kw_dl.x"
-
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"
 
 #ifndef LCKWULUDX
 static S16 PtUlUdxBndReq ARGS((Pst* pst, SuId suId,SpId  spId ));
similarity index 97%
rename from src/5gnrrlc/kw_udx_ul.c
rename to src/5gnrrlc/rlc_dl_ul_inf_ul.c
index 630f427..0831de8 100755 (executable)
  
     Desc:   Defines required by LTE MAC
  
-    File:   kw_udx_ul.c
+    File:   rlc_dl_ul_inf_ul.c
  
 **********************************************************************/
 
-/** @file kw_udx_ul.c
+/** @file rlc_dl_ul_inf_ul.c
 @brief  UDX Uplink Module 
 */
  
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_err.h"        /* Err defines */
-#include "kw_env.h"        /* RLC environment options */
-
-#include "kw.h"            /* RLC defines */
-#include "kw_udx.h"
-#include "kw_ul.h"
-#include "kw_dl.h"
+#include "rlc_err.h"        /* Err defines */
+#include "rlc_env.h"        /* RLC environment options */
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
-#include "kw.x"
-#include "kw_udx.x"
-#include "kw_dl.x"
-#include "kw_ul.x"
-
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"
+#include "rlc_ul.h"
 #include "du_app_rlc_inf.h"
 #include "rlc_mgr.h"
-#include "rlc_utils.h"
 
 #define RLC_MODULE RLC_DBGMASK_UDX
 /* local defines */
similarity index 97%
rename from src/5gnrrlc/kw_env.h
rename to src/5gnrrlc/rlc_env.h
index c14fd1f..5787d54 100755 (executable)
                   to reflect the software architecture needed to run under the 
                   target system hardware architecture.
 
-        File:     kw_env.h
+        File:     rlc_env.h
   
 *********************************************************************21*/
-/** @file kw_env.h
+/** @file rlc_env.h
 @brief RLC Hash definitions
 */
 
-#ifndef __KWENVH__
-#define __KWENVH__
+#ifndef __RLC_ENV_H__
+#define __RLC_ENV_H__
 
 #define MAX_RLC_INSTANCES            2
 #define RLC_MAX_LI                       KWU_MAX_STA_IND_SDU
@@ -82,7 +82,7 @@
 #endif
 
 
-#endif /* __KWENVH__ */
+#endif /* __RLC_ENV_H__ */
 \f  
 /********************************************************************30**
   
similarity index 99%
rename from src/5gnrrlc/kw_err.h
rename to src/5gnrrlc/rlc_err.h
index 718a3da..c0a85d6 100755 (executable)
   
         Desc:     This file contain the hash definations for RLC 
  
-        File:     kw_err.h
+        File:     rlc_err.h
   
 *********************************************************************21*/
-/** @file kw_err.h
+/** @file rlc_err.h
 @brief RLC Hash definitions
 */
 
-#ifndef __KW_ERR_H__
-#define __KW_ERR_H__
+#ifndef __RLC_ERR_H__
+#define __RLC_ERR_H__
 
 #if (ERRCLASS & ERRCLS_INT_PAR)
 #define RLCLOGERROR(cb,errCls, errCode, errVal, errDesc) \
 #define   EKW227      (ERRKW +  227)    /*     gp_pj_tmr.c: 576 */
 
 
-#endif /* __KW_ERR_H__ */
+#endif /* __RLC_ERR_H__ */
 \f  
 /********************************************************************30**
   
similarity index 99%
rename from src/5gnrrlc/kw_lmm.c
rename to src/5gnrrlc/rlc_layer_mgr.c
index 7031615..f08d4e4 100755 (executable)
@@ -16,7 +16,7 @@
 ################################################################################
 *******************************************************************************/
 
-/********************************************************************20**
+/************************************************************************
 
         Name:    NR RLC - Layer Manager file
 
@@ -37,8 +37,8 @@
 
         File:     kw_lmm.c
 
-*********************************************************************21*/
-/** @file kw_lmm.c
+************************************************************************/
+/** @file rlc_layer_mgr.c
 @brief RLC Layer Manager Module
 **/
 
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_err.h"        /* Err defines */
-#include "kw_env.h"        /* RLC environment options */
+#include "rlc_err.h"        /* Err defines */
+#include "rlc_env.h"        /* RLC environment options */
 
-#include "kw.h"            /* RLC defines */
-#include "kw_dl.h"
-#include "kw_ul.h"
-#include "kw_udx.h"
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
-#include "kw.x"
-#include "kw_udx.x"
-#include "kw_dl.x"
-#include "kw_ul.x"
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"
+#include "rlc_ul.h"
 
 #define RLC_MODULE RLC_DBGMASK_LMM
 
similarity index 98%
rename from src/5gnrrlc/kw_lim.c
rename to src/5gnrrlc/rlc_lwr_inf_mgr.c
index d5f863c..23a140f 100755 (executable)
@@ -37,7 +37,7 @@
 **********************************************************************/
 
 /** 
- * @file kw_lim.c
+ * @file rlc_lwr_inf_mgr.c
  * @brief RLC Lower Interface module
 */
 
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_err.h"
-#include "kw_env.h"        /* RLC environment options */
+#include "rlc_err.h"
+#include "rlc_env.h"        /* RLC environment options */
+
 
-#include "kw.h"            /* RLC defines */
-#include "kw_udx.h"
-#include "kw_dl.h"
-#include "kw_ul.h"
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
-#include "kw.x"
-#include "kw_udx.x"
-#include "kw_dl.x"
-#include "kw_ul.x"
-#include "rlc_utils.h"
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"
+#include "rlc_ul.h"
 #include "rlc_mac_inf.h"
 
 #ifdef __cplusplus
index 6de3006..3cfb3b7 100644 (file)
@@ -21,8 +21,8 @@
 #include "lkw.h"           /* LKW defines */
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
-#include "kw_env.h"        /* RLC environment options */
-#include "kw.h"            /* RLC defines */
+#include "rlc_env.h"        /* RLC environment options */
+#include "rlc_err.h"
 
 
 /* header/extern include files (.x) */
@@ -30,9 +30,8 @@
 #include "lkw.x"           /* LKW */
 #include "ckw.x"           /* CKW */
 #include "kwu.x"           /* KWU */
-#include "kw_err.h"
-#include "kw.x"
 
+#include "rlc_utils.h"            /* RLC defines */
 #include "du_app_rlc_inf.h"
 #include "rlc_mgr.h"
 
index 98f95ad..063d9e5 100644 (file)
 #include "lkw.h"           /* LKW defines */
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
-#include "kw_env.h"        /* RLC environment options */
-#include "kw.h"            /* RLC defines */
-#include "kw_udx.h"
-#include "kw_ul.h"
-#include "kw_dl.h"
+#include "rlc_env.h"        /* RLC environment options */
+#include "rlc_err.h"
+
 
 /* header/extern include files (.x) */
 #include "rgu.x"           
 #include "lkw.x"           /* LKW */
 #include "ckw.x"           /* CKW */
 #include "kwu.x"           /* KWU */
-#include "kw_err.h"
-#include "kw.x"
-#include "kw_udx.x"
-#include "kw_dl.x"
-#include "kw_ul.x"
 
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"
+#include "rlc_ul.h"
 #include "rlc_mac_inf.h"
 #include "du_app_rlc_inf.h"
-#include "rlc_utils.h"
 #include "rlc_upr_inf_api.h"
 
 /*******************************************************************
old mode 100755 (executable)
new mode 100644 (file)
similarity index 54%
rename from src/5gnrrlc/kw_ptui.c
rename to src/5gnrrlc/rlc_portable_functions.c
index 840d460..c57cb07
 
 /********************************************************************20**
   
-        Name:    NR RLC Layer - Upper Interface
+        Name:    NR RLC Layer - Lower Interface
     
         Type:    C file
   
-        Desc:    C source code for the upper interface of NR RLC
+        Desc:    C source code for the lower interface of NR RLC
  
-        File:    kw_ptui.c
+        File:    kw_ptli.c
   
 *********************************************************************21*/
 
-/** @file kw_ptui.c
-@brief RLC Upper Interface
+/** @file rlc_portable_functions.c
+@brief RLC Lower Interface
 */
 
 \f
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-
-#include "kw_err.h"
-#include "kw_env.h"        /* RLC environment options */
-#include "kw.h"            /* RLC defines */
+#ifdef KW_PDCP
+#include "cpj.h"           /* CPJ defines */
+#include "pju.h"           /* PJU defines */
+#include "lpj.h"           /* LPJ defines */
+#endif
+#include "rlc_err.h"
+#include "rlc_env.h"        /* RLC environment options */
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
 #include "ckw.x"           /* CKW */
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
+#ifdef KW_PDCP
+#include "cpj.x"           /* CPJ defines */
+#include "pju.x"           /* PJU defines */
+#include "lpj.x"           /* LPJ defines */
+#endif
+
+#include "rlc_utils.h"            /* RLC defines */
+/*
 #if defined(MAC_RLC_UL_RBUF) || (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF)) || defined(SS_RBUF)
 #include "ss_rbuf.h"
 #include "ss_rbuf.x"
 #endif
-#include "kw.x"
+*/
+#include "ss_rbuf.h"
+#include "ss_rbuf.x"
 #if defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF)
 #include "mt_plat_t33.h"
 #include "mt_plat_t33.x"
 #endif
 
+#ifndef LCKWLIRGU
+#define PTKWRGU
+#endif
+
+#ifndef RG
+#define PTKWRGU
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 
-\f  
+/* local defines */
+#define MAXKWMI 2               /* max. layer management interfaces */
+
+#ifdef RLC_MAC_DAT_REQ_RBUF
+S16 rlcLiRguDatReqRbuf(Pst *Post,SpId spId,Void *datReq);
+#endif
+
+#ifdef RLC_MAC_STA_RSP_RBUF
+S16 rlcLiRguStaRspRbuf(Pst *Post,SpId spId,Void  *staRsp);
+#endif
+#if defined(MAC_RLC_HARQ_STA_RBUF) && defined(LTE_L2_MEAS)
+S16 RlcDlHarqStaBatchProc (Void);
+#endif
+
+\f
+/*********************************************************************
+ *             Primitives for RGU interface 
+ ********************************************************************/
+
+/* RGU Bind Request primitive */
+
+RguBndReq kwLiRguBndReqMt[] =
+{
+#ifdef LCKWLIRGU
+   cmPkRguBndReq,            /* 0 - loosely coupled */
+#endif /* LCRGUIRGU */
+#ifdef RG 
+   RgUiRguBndReq,            /* 1 - tightly coupled, MAC  */
+#endif /* RG */
+#ifdef LCKWLIRGU
+   cmPkRguBndReq,            /* 0 - loosely coupled */
+#endif /* LCRGUIRGU */
+};
+
+/* RGU Unbind Request primitive */
+
+RguBndReq kwLiRguUbndReqMt[] =
+{
+#ifdef LCKWLIRGU
+   cmPkRguUbndReq,            /* 0 - loosely coupled */
+#endif /* LCRGUIRGU */
+#ifdef RG 
+   RgUiRguUbndReq,            /* 1 - tightly coupled, MAC  */
+#endif /* RG */
+#ifdef LCKWLIRGU
+   cmPkRguUbndReq,            /* 0 - loosely coupled */
+#endif /* LCRGUIRGU */
+};
+
+/* kw005.201 added support for L2 Measurement */
+#ifdef LTE_L2_MEAS
+#ifdef LTE_RLC_R9
+/* RGU L2 Measurement Ul Ip Throughput Measurement Request primitive */
+
+RguL2MUlThrpMeasReq kwLiRguL2MUlThrpMeasReqMt[] =
+{
+#ifdef LCKWLIRGU
+   cmPkRguL2MUlThrpMeasReq,            /* 0 - loosely coupled */
+#endif /* LCRGUIRGU */
+#ifdef RG 
+   RgUiRguL2MUlThrpMeasReq,            /* 1 - tightly coupled, MAC  */
+#endif /* RG */
+};
+#endif /* LTE_RLC_R9 */
+#endif /*  LTE_L2_MEAS */
+
+/*********************************************************************
+ *             Primitives for LKW interface 
+ ********************************************************************/
+/* Configuration confirmation primitive */
+
+static RlcConfigCfm rlcMiRlcConfigCfmMt[MAXKWMI] =
+{
+#ifdef LCKWMILKW
+   packRlcConfigCfm,            /* 0 - loosely coupled - fc */
+#endif /* LCRLMILKW */
+#ifdef SM
+   SmMiRlcConfigCfm,            /* 1 - tightly coupled layer management*/
+#endif /* SM */
+};
+
+/* control confirmation primitives */
+
+static LkwCntrlCfm kwMiLkwCntrlCfmMt[MAXKWMI] =
+{
+#ifdef LCKWMILKW 
+   cmPkLkwCntrlCfm,          /* 0 - loosely coupled - fc */
+#endif /* LCRLMILKW */
+#ifdef SM
+   SmMiLkwCntrlCfm,          /* 1 - tightly coupled layer management*/
+#endif /* SM */
+};
+
+/* Status Indication primitive */
+
+static LkwStaInd kwMiLkwStaIndMt[MAXKWMI] =
+{
+#ifdef LCKWMILKW 
+   cmPkLkwStaInd,            /* 0 - loosely coupled  */
+#endif /* LCKWMILKW */
+#ifdef SM
+   SmMiLkwStaInd,            /* 1 - tightly coupled, layer management */
+#endif /* SM */
+};
+
+/* Status confirm primitive */
+
+static LkwStaCfm kwMiLkwStaCfmMt[MAXKWMI] =
+{
+#ifdef LCKWMILKW 
+   cmPkLkwStaCfm,            /* 0 - loosely coupled  */
+#endif /* LCKWMILKW */
+#ifdef SM
+   SmMiLkwStaCfm,            /* 1 - tightly coupled, layer management */
+#endif /* SM */
+};
+
+/* Statistics confirm primitive */
+
+static LkwStsCfm kwMiLkwStsCfmMt[MAXKWMI] =
+{
+#ifdef LCKWMILKW
+   cmPkLkwStsCfm,            /* 0 - loosely coupled  */
+#endif /* LCRLMILKW */
+#ifdef SM
+   SmMiLkwStsCfm,            /* 1 - tightly coupled, layer management */
+#endif /* SM */
+};
+
+/* Trace indication primitive */
+
+static LkwTrcInd kwMiLkwTrcIndMt[MAXKWMI] =
+{
+#ifdef LCKWMILKW
+   cmPkLkwTrcInd,            /* 0 - loosely coupled  */
+#endif /* LCKWMILKW */
+#ifdef SM
+   SmMiLkwTrcInd,            /* 1 - tightly coupled, layer management */
+#endif /* SM */
+};
+
+/* kw005.201 added support for L2 Measurement */
+#ifdef LTE_L2_MEAS
+static const LkwL2MeasCfm rlcMiLkwL2MeasCfmMt[] =
+{
+#ifdef LCKWMILKW
+   cmPkLkwL2MeasCfm,
+#endif
+#ifdef SM
+   SmMiLkwL2MeasCfm,
+#endif
+};
+static const LkwL2MeasStopCfm RlcMiLkwL2MeasStopCfmMt[] =
+{
+#ifdef LCKWMILKW
+   cmPkLkwL2MeasStopCfm,
+#endif
+#ifdef SM
+   SmMiLkwL2MeasStopCfm,
+#endif
+};
+#endif /*  LTE_L2_MEAS */
+
 /*********************************************************************
  *             Forward Declartion for KWU Porting Functions
  ********************************************************************/
@@ -225,8 +408,477 @@ KwuDatAckInd kwUiKwuDatAckIndMt[] =
 /* KWU AM Data confirm primitive */
 
 #endif /* KW_PDCP */
+\f  
+/****************************************************************************
+ *                         LKW Interface Mt functions
+ ***************************************************************************/
+/**
+   @brief
+   This function is called by the RlcMiRlcConfigReq function for responding
+   to configuration requests.The cfm field in the RlcMngmt  structure contains
+ the response value.
+
+   - This function calls the mapping matrix for sending the configuration
+     confirmation.
+   - The actual function called depends on the coupling at the LKW interface.
+   - For a loosely coupled interface, a common packing function is called.
+   - The packing function packs the parameter in a message buffer and posts
+     the message to the target task.
+   - For a tightly coupled interface, the actual function called depends on
+     the layer manager API provided.
+
+*/
+S16 RlcMiRlcConfigCfm
+(
+Pst        *pst,                /* post structure */
+RlcMngmt    *cfm                 /* Layer Management structure */
+)
+{
+
+   /* jump to specific primitive depending on configured selector */
+   (*rlcMiRlcConfigCfmMt[pst->selector])(pst, cfm);
+   
+   return ROK;
+}
+
+
+/**
+   @brief
+   This function is called by the RlcMiLkwCntrlReq function to send a control confirm to the layer management module.
+
+   - This function calls the mapping matrix for sending the control confirmation.
+   - Actual function called depends on the coupling of the LKW interface.
+   - For a loosely coupled interface, a common packing function is called.
+   - The packing function packs the parameter in a message buffer and posts the
+     message to the target task.
+   - For a tightly coupled interface, the actual function called depends on the
+     layer manager API provided.
+
+*/
+S16 RlcMiLkwCntrlCfm
+(
+Pst *pst,                    /* post structure */
+RlcMngmt *cfm                 /* configure */
+)
+{
+
+   /* jump to specific primitive depending on configured selector */
+   (*kwMiLkwCntrlCfmMt[pst->selector])(pst, cfm);
+
+   return ROK;
+
+} /* end of RlcMiLkwCntrlCfm */
+
+/**
+   @brief
+   Description:
+   - This function can be used by RLC to send unsolicited status information
+     to the layer manager, when the unsolicited status flag is enabled by the
+     layer manager through a previous control request.
+
+   - This function calls the mapping matrix for sending the unsolicited status
+     indication.The actual function called depends on the coupling of the
+     LKW interface.
+
+   - For a loosely coupled interface, a common packing function is called. The
+     packing function packs the parameter in a message buffer and posts the
+     message to the target task.
+
+   - For a tightly coupled interface, the actual function called depends on
+     the layer manager API provided.
+*/
+S16 RlcMiLkwStaInd
+(
+Pst     *pst,                /* post structure */
+RlcMngmt *usta                /* unsolicited status */
+)
+{
+   /* jump to specific primitive depending on configured selector */
+   (*kwMiLkwStaIndMt[pst->selector])(pst, usta);
+
+   return (ROK);
+} /* end of RlcMiLkwStaInd */
+
+
+/**
+   @brief
+   - This function is called by the RlcMiLkwStaReq function to send
+      the requested status information to the layer manager.
+
+   - This function calls the mapping matrix for sending the status
+      confirmation. The actual function called depends on the coupling
+      of the LKW interface.
+
+   - For a loosely coupled interface, a common packing function is called.
+      The packing function packs the parameter in a message buffer and
+      posts the message to the target task.
+
+   - For a tightly coupled interface, the actual function called depends
+      on the layer manager API provided.
+
+*/
+S16 RlcMiLkwStaCfm
+(
+Pst *pst,                    /* post structure */
+RlcMngmt *cfm                 /* solicited status confirmation */
+)
+{
+
+   /* jump to specific primitive depending on configured selector */
+   (*kwMiLkwStaCfmMt[pst->selector])(pst, cfm);
+
+   return ROK;
+
+} /* end of RlcMiLkwStaCfm */
+
+
+/**
+   @brief
+   - This function is called by the RlcMiLkwStsReq function for responding
+      to statistics requests.
+
+   - This function calls the mapping matrix for sending the statistics
+      confirmation. The actual function called depends on the coupling
+      of the LKW interface.
+
+   - For a loosely coupled interface, a common packing function is called.
+      The packing function packs the parameter in a message buffer and
+      posts the message to the target task.
+
+   - For a tightly coupled interface, the actual function called depends
+      on the layer manager API provided.
+
+*/
+S16 RlcMiLkwStsCfm
+(
+Pst *pst,                    /* post structure */
+Action action,               /* action */
+RlcMngmt *cfm                 /* statistics confirmation */
+)
+{
+   /* jump to specific primitive depending on configured selector */
+   (*kwMiLkwStsCfmMt[pst->selector])(pst, action, cfm);
+
+   return ROK;
+
+} /* end of RlcMiLkwStsCfm */
+
+/**
+   @brief
+   - This function can be used by RLC module to send unsolicited trace
+      indications to the layer manager, when tracing is enabled by the
+      layer manager through a previous control request.
+
+   - This function calls the mapping matrix for sending the trace indication.
+      The actual function called depends on the coupling of the LKW interface.
+
+   - For a loosely coupled interface, a common packing function is called.
+      The packing function packs the parameter in a message buffer and posts
+      the message to the target task.
+
+   - For a tightly coupled interface, the actual function called depends on
+      the layer manager API provided.
+
+*/
+S16 RlcMiLkwTrcInd
+(
+Pst *pst,                    /* post structure */
+RlcMngmt *trc,                /* trace indication */
+Buffer *mBuf                 /* message buffer */
+)
+{
+   /* jump to specific primitive depending on configured selector */
+   (*kwMiLkwTrcIndMt[pst->selector])(pst, trc, mBuf);
+
+   return ROK;
+
+} /* end of RlcMiLkwTrcInd */
 
+
+/* kw005.201 added support for L2 Measurement */
+#ifdef LTE_L2_MEAS
+S16 RlcMiLkwL2MeasCfm(Pst * pst,RlcL2MeasCfmEvt *measEvt)
+{
+
+   (*rlcMiLkwL2MeasCfmMt[pst->selector])(pst, measEvt);
+
+   return ROK;
+
+}
+S16 RlcMiLkwL2MeasStopCfm(Pst *pst,uint8_t measType,uint8_t status)
+{
+
+   (*RlcMiLkwL2MeasStopCfmMt[pst->selector])(pst, measType,status);
+
+   return ROK;
+
+}
+#endif /*  LTE_L2_MEAS */
+
+\f
+/****************************************************************************
+ *                         RGU Interface Mt functions
+ ***************************************************************************/
+/**
+ *
+ * @brief 
+ *
+ *        Handler for RGU SAP bind Request.
+ *
+ * @b Description:
+ *
+ *        This function is used by RLC to request for binding to 
+ *        MAC for accessing MAC services.This function binds MAC's 
+ *        SAP (identified by spId) with the service user's SAP 
+ *        (identified by suId).
+ *
+ *  @param[in] pst   Post structure  
+ *  @param[in] suId  Service user SAP ID 
+ *  @param[in] spId  Service provider ID
+ *
+ *  @return  S16
+ *      -# ROK 
+ */
+
+S16 RlcLiRguBndReq
+(
+Pst  *post,                       /* post structure */
+SuId suId,                      /* Service User Id */
+SpId spId                       /* Service Provider Id */
+)
+{
+
+   /* jump to specific primitive depending on configured selector */
+   (*kwLiRguBndReqMt[post->selector])(post, suId, spId);
+
+   return ROK;
+
+} /* end of RlcLiRguBndReq */
+
+\f
+/**
+ *
+ * @brief 
+ *
+ *        Handler for bind confirmation from MAC.
+ *
+ * @b Description:
+ *
+ *        This function handles the bind confirmation received
+ *        from MAC. 
+ *
+ *  @param[in] post     - Post structure  
+ *  @param[in] suId    - Service provider SAP ID 
+ *  @param[in] reason  - Reason of confirmation
+ *
+ *  @return  S16
+ *      -# ROK 
+ */
+
+S16 RlcLiRguUbndReq(Pst *post,SpId spId,Reason reason)
+{
+
+   /* jump to specific primitive depending on configured selector */
+   (*kwLiRguUbndReqMt[post->selector])(post, spId, reason);
+
+   return ROK;
+
+} /* end of RlcLiRguUbndReq */
+
+/* kw005.201 added support for L2 Measurement */
+#ifdef LTE_L2_MEAS
+#ifdef LTE_RLC_R9
 \f  
+/**
+ *
+ * @brief 
+ *
+ *        Handler for sending ulThrpMeasReqInfo from RLC to MAC for UL ip throughput measurement. 
+ *
+ * @b Description:
+ *
+ *        This function sends ulThrpMeasReqInfo from RLC to MAC whenver UL ip throughput
+ * measurement is ON for a single or multiple qci in a UE. This is an indication for MAC
+ * to start the T2/T1 time stamps for the coresponding LCHs in the UE.
+ *
+ *  @param[in] post                    Post structure  
+ *  @param[in] spId                   Service Provider ID
+ *  @param[in] ulThrpMeasReqInfo      Ul ip measurement request info
+ *
+ *  @return  S16
+ *      -# ROK 
+ *      -# RFAILED
+ *
+ */
+S16 RlcLiRguL2MUlThrpMeasReq(Pst *post,SpId spId,RguL2MUlThrpMeasReqInfo *l2mUlThrpMeasReq)
+{
+
+   /* jump to specific primitive depending on configured selector */
+   (*kwLiRguL2MUlThrpMeasReqMt[post->selector])(post, spId, l2mUlThrpMeasReq);
+
+   return ROK;
+
+} /* end of RlcLiRguL2MUlThrpMeasReq */
+
+#endif /* LTE_RLC_R9 */
+#endif /* LTE_L2_MEAS */
+
+
+#ifdef MAC_RLC_UL_RBUF
+S16 rlcUlBatchProc ARGS ((Void));
+Void rlcUtlFreeUlRBuf ARGS((void));
+
+S16 rlcUlBatchProc(Void)
+{
+/* Read from Ring Buffer and process PDCP packets */
+   RguDDatIndInfo   *datInd;
+   Void *elmIndx = NULLP;
+   static Pst rlcUlRbfuPst={1,1,ENTRLC,0,ENTMAC,0,PRIOR0,RTESPEC,EVTRLCULDAT,0,0,0,0};
+/* Read from Ring Buffer and process PDCP packets */
+
+#ifndef SS_RBUF
+   RguDedDatInd1 *rguDatInd = NULLP;
+   uint8_t rngBufDeqIndx = 0;
+
+   elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
+   while(NULLP != elmIndx)
+   {
+      rguDatInd = (RguDedDatInd1 *)elmIndx;
+      datInd = (RguDDatIndInfo*) rguDatInd->msg; 
+      SsRngInfoTbl[SS_RNG_BUF_ULMAC_TO_ULRLC].nPktProc++;//Number of pkt processed in tti
+      if(datInd != NULLP)
+      {
+         RlcProcDedLcUlData(&rlcUlRbfuPst, 0, datInd);
+      }
+      else
+      {
+         DU_LOG("\nERROR  -->  RLC UL : Received NULL buffer");
+      }
+      rguDatInd->msg=NULLP;
+      SRngIncrRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
+      elmIndx = NULLP;
+      rguDatInd = NULLP;
+
+      rngBufDeqIndx++;
+
+      //if(rngBufDeqIndx >= SS_RNG_MAX_ULMAC_TO_ULRLC_DQ_CNT)
+       // break;
+
+      if((elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC)) == NULLP)
+      break;
+   }
+#else
+   elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
+   while(NULLP != elmIndx)
+   {
+      datInd = (RguDDatIndInfo *)elmIndx;
+      RlcProcDedLcUlData(&rlcUlRbfuPst, 0, datInd);
+
+      elmIndx = NULLP;
+      datInd = NULLP;
+      SRngIncrRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
+
+      if((elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC)) == NULLP)
+       break;
+   }
+#endif
+   return ROK;
+
+}
+
+/**
+ *
+ * @brief 
+ *        Handler to clear Ring buffer from UL RLC
+ *
+ * @details
+ *         This function clears all the ring buffer content from  UL RLC
+ *
+ * @return  S16
+ *      -# ROK 
+ *      -# RFAILED
+ *
+ */
+Void rlcUtlFreeUlRBuf(void)
+{
+   RguDDatIndInfo *datInd;
+   PTR            elem;
+   uint8_t        numLch;
+   uint8_t        numPdu;
+
+   /* Free SS_RNG_BUF_ULMAC_TO_ULRLC  */
+   while((SDeqSRngBuf (SS_RNG_BUF_ULMAC_TO_ULRLC, &elem) == ROK))
+   {
+      datInd = (RguDDatIndInfo *)elem; 
+      for(numLch = 0; numLch< datInd->numLch; numLch++)
+      {
+         for(numPdu = 0; numPdu < datInd->lchData[numLch].pdu.numPdu; numPdu++)
+         {
+            if(datInd->lchData[numLch].pdu.mBuf[numPdu])
+            {
+               ODU_PUT_MSG_BUF(datInd->lchData[numLch].pdu.mBuf[numPdu]);
+            }
+         }
+      }
+      RLC_PST_FREE(0, 0, datInd, sizeof(RguDDatIndInfo)); 
+   }
+}
+#endif
+#ifdef RLC_MAC_STA_RSP_RBUF
+S16 rlcLiRguStaRspRbuf(Pst *post,SpId spId,Void *staRsp)
+{
+   S16 ret1 = ROK;
+   
+   Void *elem = NULLP;
+
+   RguDStaRspInfo  *staRspInfo = NULL;
+   elem = SRngGetWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
+   if (NULLP != elem)
+   {
+      staRspInfo = (RguDStaRspInfo *)elem;
+      memcpy(staRspInfo, staRsp, sizeof(RguDStaRspInfo)); 
+      staRspInfo->post = *post;
+      SRngIncrWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
+      SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC].pktRate++;
+   }   
+   else
+   {
+      DU_LOG("\nERROR  -->  RLC_DL : RLC DL STA RSP RBUF is FULL!!! ");
+      SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC].pktDrop++;
+      ret1 = RFAILED;
+   }
+   return (ret1);
+} /* cmPkRlcDatReq */
+
+#endif
+#ifdef RLC_MAC_DAT_REQ_RBUF
+S16 rlcLiRguDatReqRbuf(Pst *post,SpId spId,Void *datReq)
+{
+   S16 ret1 = ROK;
+   
+   Void *elem = NULLP;
+   RguInfoRingElem *datReqRing=NULLP;
+   elem = SRngGetWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ);
+   if (NULLP != elem)
+   {
+      datReqRing = (RguInfoRingElem *) elem;
+      datReqRing->spId = spId;
+      datReqRing->event = post->event;
+      datReqRing->msg =datReq;
+      SRngIncrWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ);
+      SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ].pktRate++;
+   }   
+   else
+   {
+      DU_LOG("\nERROR  -->  RLC_DL : RLC DL DAT REQ RBUF is FULL!!! \n");
+      SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ].pktDrop++;
+      ret1 = RFAILED;
+   }
+   return (ret1);
+} /* cmPkRlcDatReq */
+
+#endif
+
 /****************************************************************************
  *                         KWU Interface Mt functions
  ***************************************************************************/\f
@@ -843,6 +1495,7 @@ S16 rlcUtlDlFreeRlcRBuf(Void)
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
-/********************************************************************30**
+
+/************************************************************************
          End of file
 **********************************************************************/
similarity index 96%
rename from src/5gnrrlc/kw_tenb_stats.c
rename to src/5gnrrlc/rlc_stats.c
index 68d5527..c01228d 100755 (executable)
@@ -24,7 +24,7 @@
  
     Desc:   
  
-    File:  l2_tenb_stats.c
+    File:  rlc_stats.c
  
 **********************************************************************/
 
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_err.h"        /* RLC error options */
-#include "kw_env.h"        /* RLC environment options */
-#include "kw.h"            /* RLC defines */
-#include "kw_ul.h"
+#include "rlc_err.h"        /* RLC error options */
+#include "rlc_env.h"        /* RLC environment options */
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
-#include "kw.x"
-#include "kw_ul.x"
 #ifdef TENB_STATS
 #include "l2_tenb_stats.x"    /* Total EnodeB Stats declarations */
 #endif
 
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_ul.h"
+
 #ifdef TENB_STATS
 TSL2CellStatsCb* l2CellStats[L2_STATS_MAX_CELLS];
 TSL2UeStatsCb*   l2UeStats[L2_STATS_MAX_UES];
similarity index 99%
rename from src/5gnrrlc/kw_id.c
rename to src/5gnrrlc/rlc_sys_id.c
index bb02634..5d2971a 100755 (executable)
@@ -24,7 +24,7 @@
   
         Desc:     <description of file contents>
  
-        File:     kw_id.c
+        File:     rlc_sys_id.c
 
 *********************************************************************21*/
  
similarity index 97%
rename from src/5gnrrlc/kw_tmm_dl.c
rename to src/5gnrrlc/rlc_tmm_dl.c
index 55cc0b8..a11d2e7 100755 (executable)
                   --rlcTmmRcvFrmMac
                   --kwTmmReEstablish 
 
-     File:     kw_tmm_dl.c
+     File:     rlc_tmm_dl.c
 
 **********************************************************************/
 /** 
- * @file kw_tmm_dl.c
+ * @file rlc_tmm_dl.c
  * @brief RLC Transparent Mode module
 */
 \f
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_env.h"        /* RLC environment options */
+#include "rlc_env.h"        /* RLC environment options */
+#include "rlc_err.h"            /* RLC defines */
+
 
-#include "kw.h"            /* RLC defines */
-#include "kw_err.h"            /* RLC defines */
-#include "kw_udx.h"
-#include "kw_dl.h"
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
-#include "kw.x"
-#include "kw_udx.x"
-#include "kw_dl.x"
-#include "rlc_utils.h"
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"
 #include "rlc_mac_inf.h"
 #include "rlc_lwr_inf_api.h"
 
similarity index 97%
rename from src/5gnrrlc/kw_tmm_ul.c
rename to src/5gnrrlc/rlc_tmm_ul.c
index 20e11f5..6486538 100755 (executable)
                   --rlcTmmRcvFrmMac
                   --kwTmmReEstablish 
 
-     File:     kw_tmm_ul.c
+     File:     rlc_tmm_ul.c
 
 **********************************************************************/
 
-/** @file kw_tmm_ul.c
+/** @file rlc_tmm_ul.c
 @brief RLC Transparent Mode module
 */
 \f
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_env.h"        /* RLC environment options */
+#include "rlc_env.h"        /* RLC environment options */
 
-#include "kw.h"            /* RLC defines */
-#include "kw_err.h"            /* RLC defines */
-#include "kw_ul.h"
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
-#include "kw.x"
-#include "kw_ul.x"
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_err.h"            /* RLC defines */
+#include "rlc_ul.h"
 #include "du_app_rlc_inf.h"
-#include "rlc_utils.h"
 #include "rlc_upr_inf_api.h"
 
 #if defined(PRE_DEF_UE_CTX) || defined(PRE_DEF_UE_CTX_HO)
similarity index 98%
rename from src/5gnrrlc/kw_tmr.c
rename to src/5gnrrlc/rlc_tmr.c
index ae6333b..d7ecd63 100755 (executable)
@@ -29,7 +29,7 @@
                  - rlcTmrExpiry
                  - rlcBndTmrExpiry  
                   
-        File:    kw_tmr.c
+        File:    rlc_tmr.c
   
 *********************************************************************21*/
 
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_env.h"        /* RLC environment options */
-
-#include "kw.h"            /* RLC defines */
-#include "kw_err.h"        /* Error defines */
-#include "kw_ul.h"
-#include "kw_udx.h"
-#include "kw_dl.h"
+#include "rlc_env.h"        /* RLC environment options */
+#include "rlc_err.h"        /* Error defines */
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
-#include "kw.x"
-#include "kw_udx.x"
-#include "kw_dl.x"
-#include "kw_ul.x"
-
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"
+#include "rlc_ul.h"
 /** 
  * @file gp_tmr.c
  * @brief RLC Timer Module
similarity index 96%
rename from src/5gnrrlc/kw_ul.x
rename to src/5gnrrlc/rlc_ul.h
index 7367ee8..f00d445 100755 (executable)
 ################################################################################
 *******************************************************************************/
 
-/********************************************************************20**
+/**********************************************************************
   
-        Name:    NR RLC file for uplink and non real time tasks
+        Name:     NR RLC file for uplink and non real time tasks 
     
-        Type:    C include file
+        Type:     C include file
   
-        Desc:    This file contains all the data structures and 
-                 prototypes for RLC in the uplink.
+        Desc:     This file contains helper macros for RLC uplink
+                  and non real time tasks
  
-        File:    kw_ul.x
-  
-*********************************************************************21*/
+        File:     rlc_ul.h
+
+**********************************************************************/
 /** 
- * @file kw_ul.x
- * @brief RLC uplink structures, prototypes
+ * @file rlc_ul.h
+ * @brief RLC uplink helper macros
 */
 
-#ifndef __KW_ULX__
-#define __KW_ULX__
+#ifndef __RLC_ULH__
+#define __RLC_ULH__
+
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 
+/**
+ * @def RLC_MEAS_IS_UL_IP_MEAS_ON_FOR_RB
+ *
+ *    This macro is used to check if UL IP throughput measurement is ON
+ *    or off for the passed rb
+ *
+ *    Returns TRUE(non-zero) if measurement is ON else FALSE (zero)
+ *
+ * @param[in] _gCb     RLC UL Cb
+ * @param[in] _rbCb    RLC uplink control block
+ *
+*/ 
+#define RLC_MEAS_IS_UL_IP_MEAS_ON_FOR_RB(_gCb, _rbCb)  \
+     ((_rbCb->rlcId.rbType == CM_LTE_DRB) && \
+     (_gCb->u.ulCb->rlcL2Cb.measOn[_rbCb->qci] & LKW_L2MEAS_UL_IP) && \
+     (_rbCb->rbL2Cb.measOn & LKW_L2MEAS_UL_IP))
+
 typedef struct rlcUlUeCb RlcUlUeCb;
 
 /** 
@@ -643,10 +660,9 @@ uint8_t rlcProcDedLcUlData(Pst *pst, SuId suId, RguDDatIndInfo  *datInd);
 }
 #endif /* __cplusplus */
 
-#endif /* __KW_ULX__ */
 
-\f  
-/********************************************************************30**
+#endif /* __RLC_ULH__ */
+/**********************************************************************
   
          End of file
 **********************************************************************/
similarity index 98%
rename from src/5gnrrlc/kw_ul_ex_ms.c
rename to src/5gnrrlc/rlc_ul_msg_router.c
index 7295adf..f136927 100755 (executable)
         Desc:    C source code for the interface to System Services
                   of NR RLC
  
-        File:    kw_ul_ex_ms.c
+        File:    rlc_ul_msg_router.c
   
 *********************************************************************21*/
 
-/** @file kw_ul_ex_ms.c
+/** @file rlc_ul_msg_router.c
 @brief RLC System Services Interface
 */
 
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_err.h"        /* Err defines */
-#include "kw_env.h"        /* RLC environment options */
-#include "kw.h"            /* RLC defines */
-#include "kw_ul.h"
-#include "kw_udx.h"
+#include "rlc_err.h"        /* Err defines */
+#include "rlc_env.h"        /* RLC environment options */
+
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
 #include "ckw.x"           /* CKW */
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
-#include "kw.x"
-#include "kw_ul.x"
-#include "kw_udx.x"
 
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_ul.h"
 #include "rlc_mac_inf.h"
 #include "du_app_rlc_inf.h"
 
@@ -62,6 +60,7 @@
 #include "l2_tenb_stats.x"   
 #endif
 
+
 S16 rlcUlInitExt ARGS (( Void ));
 \f
 /**
similarity index 97%
rename from src/5gnrrlc/kw_umm_dl.c
rename to src/5gnrrlc/rlc_umm_dl.c
index 430adca..2d89241 100755 (executable)
                   --rlcUmmReAssembleSdus
                   --kwUmmReEstablish 
 
-     File:     kw_umm_dl.c
+     File:     rlc_umm_dl.c
 
 **********************************************************************/
 /** 
- * @file kw_umm_dl.c
+ * @file rlc_umm_dl.c
  * @brief RLC Unacknowledged Mode downlink module
 */
 
 #include "kwu.h"                /* RLC service user */
 #include "lkw.h"                /* LM Interface */
 #include "rgu.h"                /* MAC layer */
-#include "kw_env.h"             /* RLC environment options */
+#include "rlc_env.h"             /* RLC environment options */
+#include "rlc_err.h"
+
 
-#include "kw.h"                 /* RLC layer */
-#include "kw_err.h"
-#include "kw_udx.h"
-#include "kw_dl.h"
 
 
 /* header/extern include files (.x) */
@@ -61,9 +59,9 @@
 #include "lkw.x"                /* LM Interface */
 #include "rgu.x"                /* MAC later */
 
-#include "kw.x"                 /* RLC layer */
-#include "kw_udx.x"
-#include "kw_dl.x"
+#include "rlc_utils.h"                 /* RLC layer */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"
 
 #define RLC_MODULE (RLC_DBGMASK_UM | RLC_DBGMASK_DL)
 
@@ -241,7 +239,7 @@ void rlcUmmProcessSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *datReq)
             RLC_UPD_L2_DL_DISC_SDU_STS(gCb, rbCb);
 #endif
             rbCb->m.umDl.bo -= sdu->sduSz;
-            RLC_RMV_SDU(gCb,&rbCb->m.umDl.sduQ,sdu);
+            RLC_REMOVE_SDU(gCb,&rbCb->m.umDl.sduQ,sdu);
             continue;
          }
       }
@@ -365,7 +363,7 @@ void rlcUmmProcessSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *datReq)
               umHdr.so = 0;
          }
          rlcUmmCreatePdu(gCb, rbCb, pdu, &umHdr, pduInfo);
-         RLC_RMV_SDU(gCb,&(rbCb->m.umDl.sduQ),sdu); /* kw003.201 */
+         RLC_REMOVE_SDU(gCb,&(rbCb->m.umDl.sduQ),sdu); /* kw003.201 */
          rlcUtlIncrementKwuStsSduTx(gCb->u.dlCb->rlcKwuDlSap + rbCb->k1wuSapId);
          pdu = NULLP;
       }
@@ -600,7 +598,7 @@ Void rlcUmmDiscSdu(RlcCb *gCb,RlcDlRbCb *rbCb,uint32_t sduId)
       if (sdu->mode.um.sduId == sduId && sdu->mode.um.isSegmented == FALSE)
       {
 /* kw005.201 added support for L2 Measurement */
-         RLC_RMV_SDU(gCb,&rbCb->m.umDl.sduQ,sdu);
+         RLC_REMOVE_SDU(gCb,&rbCb->m.umDl.sduQ,sdu);
          gCb->genSts.numSduDisc++;         
       }
    }
similarity index 99%
rename from src/5gnrrlc/kw_umm_ul.c
rename to src/5gnrrlc/rlc_umm_ul.c
index a7f4d80..72064d1 100755 (executable)
                   --rlcUmUlReAssembleSdus
                   --kwUmmReEstablish 
 
-     File:     kw_umm_ul.c
+     File:     rlc_umm_ul.c
 
 **********************************************************************/
 /** 
- * @file kw_umm_ul.c
+ * @file rlc_umm_ul.c
  * @brief RLC Unacknowledged Mode uplink module
 */
 
 #include "kwu.h"                /* RLC service user */
 #include "lkw.h"                /* LM Interface */
 #include "rgu.h"                /* MAC layer */
-#include "kw_env.h"             /* RLC environment options */
-
-#include "kw.h"                 /* RLC layer */
-#include "kw_err.h"
-#include "kw_ul.h"
-
+#include "rlc_env.h"             /* RLC environment options */
 
 /* header/extern include files (.x) */
 
@@ -60,8 +55,9 @@
 #include "lkw.x"                /* LM Interface */
 #include "rgu.x"                /* MAC later */
 
-#include "kw.x"                 /* RLC layer */
-#include "kw_ul.x"
+#include "rlc_utils.h"                 /* RLC layer */
+#include "rlc_err.h"
+#include "rlc_ul.h"
 
 #define RLC_MODULE (RLC_DBGMASK_UM | RLC_DBGMASK_UL)
 
similarity index 98%
rename from src/5gnrrlc/kw_uim.c
rename to src/5gnrrlc/rlc_upr_inf_mgr.c
index 39eb209..4cbc070 100755 (executable)
@@ -38,7 +38,7 @@
 
 **********************************************************************/
 /** 
- * @file kw_uim.c
+ * @file rlc_upr_inf_mgr.c
  * @brief RLC Upper Interface Module
 */
 
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
 #include "rgu.h"           /* RGU defines */
-#include "kw_env.h"        /* RLC environment options */
-#include "kw.h"            /* RLC defines */
-#include "kw_dl.h"
-#include "kw_ul.h"
-#include "kw_udx.h"
+#include "rlc_env.h"        /* RLC environment options */
+#include "rlc_err.h"
+
 
 /* extern (.x) include files */
 #include "lkw.x"           /* LKW */
 #include "ckw.x"           /* CKW */
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
-#include "kw_err.h"
-#include "kw.x"
-#include "kw_udx.x"
-#include "kw_dl.x"
-#include "kw_ul.x"
-
 
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"
+#include "rlc_ul.h"
 /*****************************************************************************
  *                          CKW INTERFACE
  ****************************************************************************/
old mode 100644 (file)
new mode 100755 (executable)
index b40c957..0eb9b78
 ################################################################################
 *******************************************************************************/
 
+/**********************************************************************
+  
+        Name:     NR RLC file
+
+        Type:     C include file
+  
+        Desc:     This file contain the hash definations for RLC 
+        File:     kw.h
+  
+**********************************************************************/
+/** @file rlc_utils.h
+@brief RLC Hash definitions
+*/
+
+#ifndef __RLC_UTILS_H__
+#define __RLC_UTILS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "du_log.h"
+\f 
+
+#define EKWxxx 1
+#define EMG099 1
+#define EMG102 2
+#define EMG103 3
+#define EMG104 4
+
+/* RLC-SPLIT Activity */
+#define RLC_ONE       1
+#define RLC_BIT0      0x01
+#define RLC_BIT1      0x02
+#define RLC_BIT2      0x04
+#define RLC_BIT3      0x08
+
+#define RLC_2K_BYTE   2048
+
+/* RLC RB flag bits */
+#define RLC_RB_REESTABLISH_DL  RLC_BIT0
+#define RLC_RB_REESTABLISH_UL  RLC_BIT1
+#define RLC_RB_DELETE_DL       RLC_BIT2
+#define RLC_RB_DELETE_UL       RLC_BIT3
+
+
+#define RLC_MOD_1024           0x3FF  /* used for MOD 1024 */
+
+
+\f 
+/************************************************************************
+ *                            SAP States
+ ************************************************************************/
+
+#define RLC_SAP_NOT_CFG        0     /*!< SAP Not Configured */
+#define RLC_SAP_CFG            1     /*!< SAP Configured but not not bound */
+#define RLC_SAP_BND            2     /*!< SAP Bound */
+#define RLC_SAP_BINDING        3     /*!< SAP Bind initiated */
+#define RLC_SAP_UBND           4     /*!< SAP Unbind */
+
+#define RLC_MAX_SAP_BND_RETRY  3     /*!< Maximum SAP Bin Retries */
+
+#define RLC_MAX_UE             0xffffffff  /*!< Maximum number of UEs. */
+
+/* Maximum number of Saps */
+#define RLC_MAX_UDXSAPS        1     /*!< Maximum number of UDX Saps */
+#define RLC_MAX_KWUSAPS        2     /*!< Maximum number of KWU Saps. */
+#define RLC_MAX_CKWSAPS        1     /*!< Maximum number of CKW Saps. */
+/*MCELL changes*/
+#define RLC_MAX_RGUSAPS        4//5     /*!< Maximum number of RGU Saps. */
+
+#define RLC_MAX_RGUSAP_TMR     1     /*!< Maximum number of RGU SAP Timers. */
+
+#define RLC_UI_RRC             0     /*!< Upper interface RRC sap Id. */
+#define RLC_UI_PDCP            1     /*!< Upper interface PDCP sap Id. */
+
+#ifdef LTE_L2_MEAS
+/* TODO. This works for FDD only. For TDD the array dimension
+ * should be changed according to the number of Harq Procs */
+#define RLC_MAX_TB_PER_UE      64    /*!< Maximum number of tbCb for UE */
+#define RLC_INVALID_TBID       RLC_MAX_TB_PER_UE
+#endif
+/*******************************************************************************
+ *                              Memory related Defines 
+ ******************************************************************************/
+/* Allocate function */
+
+#define RLC_ALLOC(_cb,_buf, _size)                                    \
+{                                                                    \
+ if (SGetSBuf(_cb->init.region, _cb->init.pool, (Data **)&_buf,      \
+                (Size) _size) == ROK)                                \
+   {                                                                 \
+      memset((_buf), 0, _size);                              \
+   }                                                                 \
+   else                                                              \
+   {                                                                 \
+      (_buf) = NULLP;                                                \
+   }                                                                 \
+}
+
+#define RLC_FREE(_cb,_buf, _size)                          \
+{                                                         \
+   if (_buf != NULLP)                                     \
+   {                                                      \
+      (Void) SPutSBuf(_cb->init.region, _cb->init.pool,   \
+            (Data *) _buf, (Size) _size);                 \
+      _buf = NULLP;                                       \
+   }                                                      \
+}
+
+#define RLC_FREE_SHRABL_BUF(_region, _pool,_buf, _size)    \
+{                                                         \
+   if (_buf != NULLP)                                     \
+   {                                                      \
+      (Void) SPutStaticBuffer(_region, _pool,             \
+            (Data *) _buf, (Size) _size, 0);                 \
+      _buf = NULLP;                                       \
+   }                                                      \
+}
+
+#define RLC_FREE_SHRABL_BUF_WC(_region, _pool,_buf, _size) \
+{                                                         \
+  (Void) SPutStaticBuffer(_region, _pool,                 \
+        (Data *) _buf, (Size) _size, 0);                 \
+  _buf = NULLP;                                       \
+}
+
+#define RLC_ALLOC_SHRABL_BUF_WC(_region, _pool,_buf, _size)           \
+{                                                                    \
+ SGetStaticBuffer(_region, _pool, (Data **)&_buf,                    \
+                (Size) _size, 0);                                    \
+}
+
+#define RLC_ALLOC_SHRABL_BUF(_region, _pool,_buf, _size)              \
+{                                                                    \
+ if (SGetStaticBuffer(_region, _pool, (Data **)&_buf,                \
+                (Size) _size, 0) == ROK)                                \
+   {                                                                 \
+      memset((_buf), 0, _size);                              \
+   }                                                                 \
+   else                                                              \
+   {                                                                 \
+      (_buf) = NULLP;                                                \
+   }                                                                 \
+}
+
+#define RLC_ALLOC_WC(_cb,_buf, _size)  \
+           SGetSBuf(_cb->init.region, _cb->init.pool, (Data **)&_buf, (Size) _size)     
+
+#define RLC_REMOVE_SDU(_cb,_sduQ,_sdu)              \
+{                                               \
+   if(_sdu->mBuf)                               \
+   {                                            \
+      SPutMsg(_sdu->mBuf);    \
+   }                                            \
+   cmLListDelFrm(_sduQ,&_sdu->lstEnt);          \
+   RLC_FREE(_cb,_sdu, sizeof(RlcSdu));            \
+}
+
+/* kw002.201 Freeing from region of pst */
+#define RLC_PST_FREE(_region, _pool, _buf, _size)          \
+{                                                         \
+   if (_buf != NULLP)                                     \
+   {                                                      \
+      (Void) SPutSBuf(_region, _pool,                     \
+                      (Data *) _buf, (Size) _size);       \
+      _buf = NULLP;                                       \
+   }                                                      \
+}
+
+#ifdef XEON_SPECIFIC_CHANGES
+#ifdef SS_LOCKLESS_MEMORY
+#define RLC_SHRABL_STATIC_BUF_FREE(_region, _pool, _buf, _size)     \
+{                                                                  \
+   if (_buf != NULLP)                                              \
+   {                                                               \
+      (Void) SPutStaticBuffer(_region, _pool,                      \
+                      (Data *) _buf, (Size) _size, 0);             \
+      _buf = NULLP;                                                \
+   }                                                               \
+}
+
+#define RLC_SHRABL_STATIC_BUF_ALLOC(_region, _pool, _buf, _size)     \
+{                                                                        \
+ SGetStaticBuffer(_region, _pool, (Data **)&_buf,      \
+                (Size) _size, 0);                                        \
+}
+
+#else
+
+#define RLC_SHRABL_STATIC_BUF_FREE(_region, _pool, _buf, _size)     \
+{                                                                  \
+   if (_buf != NULLP)                                              \
+   {                                                               \
+      (Void) SPutSBuf(_region, _pool,                      \
+                      (Data *) _buf, (Size) _size);             \
+      _buf = NULLP;                                                \
+   }                                                               \
+}
+
+#define RLC_SHRABL_STATIC_BUF_ALLOC(_region, _pool, _buf, _size)     \
+{                                                                        \
+ SGetSBuf(_region, _pool, (Data **)&_buf,      \
+                (Size) _size);                                        \
+}
+#endif /* SS_LOCKLESS_MEMORY */
+
+#else 
+
+#define RLC_SHRABL_STATIC_BUF_FREE(_region, _pool, _buf, _size)     \
+{                                                                  \
+   if (_buf != NULLP)                                              \
+   {                                                               \
+      (Void) SPutStaticBuffer(_region, _pool,                      \
+                      (Data *) _buf, (Size) _size, 0);             \
+      _buf = NULLP;                                                \
+   }                                                               \
+}
+
+#define RLC_SHRABL_STATIC_BUF_ALLOC(_region, _pool, _buf, _size)     \
+{                                                                        \
+ SGetStaticBuffer(_region, _pool, (Data **)&_buf,      \
+                (Size) _size, 0);                                        \
+}
+#endif
+
+#define RLC_MEM_CPY(_dst, _src, _size)  memcpy(_dst, _src, _size); 
+
+#define RLC_MEM_ZERO(_buf, _size) memset((_buf), 0, _size);
+
+#define RLC_GET_MEM_REGION(_cb) (_cb->init.region)
+
+#define RLC_GET_MEM_POOL(_cb) (_cb->init.pool)
+
+#define RLC_GET_MEM_POOL_ADDRESS(_cb) (&_cb->init.pool)
+
+/* Memset to value */
+#define RLC_MEM_SET(_arg, _val, _size) memset(_arg, _val, _size); 
+
+/* Alarms */
+/* Send an alarm for sapId events */
+/* kw005.201 added support for L2 Measurement */
+#ifdef LTE_L2_MEAS
+#define RLC_GETSDUIDX(_sduIdx) \
+{\
+   _sduIdx = (((_sduIdx)+1) % RLC_L2MEAS_MAX_OUTSTNGSDU);\
+}
+#define RLC_SEND_SAPID_ALARM(_cb,_sapId, _evnt, _cause) \
+{ \
+   rlcLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, _sapId, 0, 0); \
+}
+#define RLC_SEND_UEID_ALARM(_cb,_ueId, _qci, _evnt, _cause) \
+{ \
+   rlcLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, 0, _ueId, _qci); \
+}
+#else /* LTE_L2_MEAS */
+#define RLC_SEND_SAPID_ALARM(_cb,_sapId, _evnt, _cause) \
+{ \
+   rlcLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, _sapId, 0); \
+}
+#define RLC_SEND_UEID_ALARM(_cb,_ueId, _evnt, _cause) \
+{ \
+   rlcLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, 0, _ueId); \
+}
+#endif /* LTE_L2_MEAS */
+
+/*******************************************************************************
+ *                              Common Defines 
+ ******************************************************************************/
+
+/* RLC Configuration parameters */
+#define RLC_MAX_UL_LI                (2 * RLC_MAX_LI)
+/*macro RLC_MAX_DL_LI is moved to rlc_env.h file */
+#define RLC_MAX_DAT                  RLC_MAXIMUM_DAT
+/*macro RLC_MAX_PDU is moved to rlc_env.h file */
+#define RLC_MAX_RB_PER_CELL          10
+#define RLC_MAX_SRB_PER_UE           3
+#define RLC_MAX_DRB_PER_UE           32
+#define RLC_MAX_LCH_PER_UE           12
+#define RLC_MAX_LCH_PER_CELL         6
+#define RLC_MAX_NUM_RB               24
+#define RLC_MAX_UE                   0xffffffff 
+#define RLC_UE_LIST_BUCKET_SIZE      128 
+#define RLC_CELL_LIST_BUCKET_SIZE    10 
+#define RLC_TRANS_ID_LST_BKT_SIZE    10 
+#define RLC_MAX_RB                   32
+
+/* RLC Mode defines */
+#define RLC_MODE_TM 1
+#define RLC_MODE_UM 2
+#define RLC_MODE_AM 3
+
+/* Direction defines */
+#define RLC_DIR_UL        1     /*!< Unlink direction */
+#define RLC_DIR_DL        2     /*!< Downlink direction */
+#define RLC_DIR_BOTH      3     /*!< Both Downlink and Unlink */
+
+#define RLC_DEF_SEQ_NUM 0 /**< Sequence number to pick in case of duplicate
+                              entries in hash list searches*/
+
+/**
+ * @def RLC_MIN
+ *
+ *    Macro to find the miniumum of two numbers
+ *
+ * @param[in] x    First number
+ * @param[in] y    Second number
+ *
+*/
+#define RLC_MIN(x,y) (x) < (y) ? (x) : (y)
+
+/**
+ * @def RLC_GET_RLCCB
+ *
+ *    Macro to the RLC instance
+ *
+ * @param[in] _inst    Instance Id
+ *
+*/
+#define RLC_GET_RLCCB(_inst) rlcCb[_inst]                              
+
+#define RLC_ADD_SDU            1     /*!< Add SDU. */
+#define RLC_DEL_SDU            2     /*!< Delete SDU. */
+
+#define RLC_CFM_NOK            0     /*!< Do not send DatCfm */
+#define RLC_CFM_OK             1     /*!< Send DatCfm */
+
+/* Set the unsolictated Status flag */
+#define RLC_SET_USTA_FLAG(_rlcCb, _value) \
+{ \
+   _rlcCb->init.usta = _value; \
+}
+
+/* Macros to get the init parameters */
+#define RLC_GET_DBG_MASK(_rlcCb) (_rlcCb->init.dbgMask)
+#define RLC_GET_LMPST_MEM_POOL(_rlcCb) (_rlcCb->init.lmPst.pool)
+#define RLC_GET_LMPST_MEM_REGION(_rlcCb) (_rlcCb->init.lmPst.region)
+
+/* Macros for configuration module */
+#define RLC_CFG_FILL_CFG_CFM(_entCfm, _rbId, _rbType, _status, _reason)  \
+{                                                              \
+   _entCfm->rbId  = _rbId;                                     \
+   _entCfm->rbType = _rbType;                                  \
+   _entCfm->status.status = _status;                           \
+   _entCfm->status.reason = _reason;                           \
+} 
+
+/**
+ * @def RLC_VALIDATE_UE_RBID
+ *
+ *    This macro validates whether the _rbId passed is valid or not. It checks
+ *    if the _rbId is within the maximum value depending on the _rbType.
+ *    Returns TRUE if valid else FALSE
+ *
+ * @param[in] _rbType    Type of the Radio Bearer; SRB or DRB
+ * @param[in] _rbId      RB Id of the RB to be validated
+ *
+*/ 
+#define RLC_VALIDATE_UE_RBID(_rbType, _rbId)                     \
+       ((_rbType == CM_LTE_SRB && _rbId < RLC_MAX_SRB_PER_UE) || \
+       (_rbType == CM_LTE_DRB && _rbId < RLC_MAX_DRB_PER_UE))
+
+/*******************************************************************************
+ *                              UIM Defines 
+ ******************************************************************************/
+#if (ERRCLASS & ERRCLS_INT_PAR)
+#define RLC_VALDATE_SAP(_cb,_chkSpId, _sap, _ret)                             \
+{                                                                            \
+   if (_chkSpId != _sap->spId)                                               \
+   {                                                                         \
+      RLCLOGERROR(_cb,ERRCLS_DEBUG, EKWxxx, (ErrVal) RFAILED,                 \
+            "Sap Id Validation Failed.");                                    \
+      _ret = RFAILED;                                                        \
+   }                                                                         \
+   /* SAP state validation */                                                \
+   if(_sap->state != RLC_SAP_BND)                                             \
+   {                                                                         \
+      RLCLOGERROR(_cb,ERRCLS_INT_PAR, EKWXXX, (ErrVal) RFAILED,               \
+            "Sap State Invalid.");                                           \
+      RLC_SEND_SAPID_ALARM(_cb,0, LCM_EVENT_UI_INV_EVT, LCM_CAUSE_INV_STATE); \
+      _ret = RFAILED;                                                        \
+   }                                                                         \
+}
+#else /* ERRCLASS & ERRCLS_INT_PAR */
+#define RLC_VALDATE_SAP(_cb,_chkSpId, _sap, _ret)                             \
+{                                                                            \
+   /* SAP state validation */                                                \
+   if(_sap->state != RLC_SAP_BND)                                             \
+   {                                                                         \
+      RLCLOGERROR(_cb,ERRCLS_INT_PAR, EKWXXX, (ErrVal) RFAILED,               \
+            "Sap State Invalid.");                                           \
+      RLC_SEND_SAPID_ALARM(_cb,0, LCM_EVENT_UI_INV_EVT, LCM_CAUSE_INV_STATE); \
+      _ret = RFAILED;                                                        \
+   }                                                                         \
+}
+#endif /* ERRCLASS & ERRCLS_INT_PAR */
+
+/*******************************************************************************
+ *                              Timer Defines 
+ ******************************************************************************/
+#define RLC_TMR_LEN                     10
+#define RLC_MAX_UM_TMR                  1
+#define RLC_MAX_AM_TMR                  3
+#define RLC_MAX_THPT_TMR                1
+
+/* Timer events */
+#define EVENT_RLC_UMUL_REASSEMBLE_TMR     1
+#define EVENT_RLC_AMUL_REASSEMBLE_TMR          2
+#define EVENT_RLC_AMUL_STA_PROH_TMR       3
+#define EVENT_RLC_AMDL_POLL_RETX_TMR      4
+#define EVENT_RLC_WAIT_BNDCFM             5
+/* kw005.201 added support for L2 Measurement */
+#ifdef LTE_L2_MEAS
+#define EVENT_RLC_L2_TMR                  6
+#endif /* LTE_L2_MEAS */
+#define EVENT_RLC_THROUGHPUT_TMR          7
+
+/*******************************************************************************
+ *                              DBM Defines 
+ ******************************************************************************/
+/**
+ * @def RLC_DBM_GET_RBCB_FROM_UECB
+ *
+ *    This macro makes _rbCb point to the RB in _ueCb based on the passed 
+ *    _rbId and _rbType. _rbCb can point to NULLP
+ *
+ * @param[in] _rbId      RB Id of the RB to be fetched
+ * @param[in] _rbType    Type of the RB, SRB or DRB
+ * @param[in] _ueCb      Pointer to the UECb for which to get the RB
+ * @param[out] _rbCb     Pointer to the found RbCb
+ *
+*/
+#define RLC_DBM_GET_RBCB_FROM_UECB(_rbId, _rbType, _ueCb, _rbCb)            \
+           (_rbCb) = ((_rbType) == CM_LTE_SRB) ? (_ueCb)->srbCb[(_rbId)] : \
+                                                 (_ueCb)->drbCb[(_rbId)];     
+/**
+ * @def RLC_DBM_GET_CELL_RBCB
+ *
+ *    This macro makes _rbCb point to the RB in the _rbCbLst. 
+ *    _rbCb can point to NULLP
+ *
+ * @param[in] _rbId         RB Id of the RB to be fetched
+ * @param[in] _rbCbLst      Pointer to array of RBCbs
+ * @param[out] _rbCb        Pointer to the found RbCb
+ *
+*/
+#define RLC_DBM_GET_CELL_RBCB(_rbId, _rbCbLst, _rbCb) \
+           (_rbCb) = (_rbCbLst)[(_rbId)]; 
+
+/*******************************************************************************
+ *                              UMM Defines 
+ ******************************************************************************/
+#define RLC_UMDL     rbCb->m.umDl 
+#define RLC_UMUL     rbCb->m.umUl 
+
+/* Sequence Number length defines */
+#define RLC_UM_CFG_6BIT_SN_LEN      1 /**< UM 6-bit Sequence number length 
+                                          in bytes*/   
+#define RLC_UM_CFG_12BIT_SN_LEN     2 /**< UM 12-bit Sequence number length 
+                                          in bytes*/
+/* 5GNR */
+/* Sequence Number length defines */
+#define RLC_AM_CFG_12BIT_SN_LEN      1 /**< AM 12-bit Sequence number length 
+                                          in bytes*/   
+#define RLC_AM_CFG_18BIT_SN_LEN      2 /**< AM 18-bit Sequence number length 
+                                          in bytes*/
+
+/**
+ * @def RLC_REMOVE_MAC_HDR_SZ
+ *
+ *    If PDU size is greater than 127, MAC header would be 3 bytes else 2 bytes
+ *
+ * @param[in,out] _pduSz        Size of the pdu 
+ *
+*/
+#define RLC_REMOVE_MAC_HDR_SZ(_pduSz) (_pduSz) -= ((_pduSz) > 127) ? 3 : 2;
+
+/**
+ * @def RLC_UM_GET_VALUE
+ *
+ *    This macro is used to calculate the value of UM state variables used 
+ *    in comparisons.  VR(UH) - UM Window Size is taken as the base modulus.
+ *    Returns the modifed value
+ *
+ * @param[in] _val               Value of the state variable 
+ * @param[in] _kwUmUl        Um Uplink control block
+ *
+*/ 
+#define RLC_UM_GET_VALUE(_val,_kwUmUl)  \
+     (((_val) - ((_kwUmUl).vrUh - (_kwUmUl).umWinSz)) & ((_kwUmUl).modBitMask))
+     
+/*******************************************************************************
+ *                              AMM Defines 
+ ******************************************************************************/ 
+#define RLC_AMDL                           rbCb->m.amDl 
+#define RLC_AMUL                           rbCb->m.amUl
+
+/* PDU Types */
+#define RLC_DATA_PDU  1
+#define RLC_CNTRL_PDU 0
+
+#define RLC_FI_FIRST_SEG                0x02
+#define RLC_FI_LAST_SEG                 0x01
+#define RLC_SI_FIRST_SEG                0x01
+#define RLC_SI_LAST_SEG                 0x02
+#define RLC_SI_MID_SEG                  0x03
+
+#define RLC_POLL_SET                    0x40 /* 01000000 */
+#define RLC_POLL_UNSET                  0xbf /* 10111111 */
+#define RLC_MAX_NACK_CNT                100
+/*RLC_MAX_CNTRL_FIELDS (Maximum size of Status Pdu) 
+ *  = MAX_NACK_CNT * sizeof(NACK_SN,E1,E2,E3,soStart,soEnd, nackRange)
+ * for 18 bit SN + Fixed Header*/
+#define RLC_MAX_CNTRL_FIELDS            ((RLC_MAX_NACK_CNT * 8) + 3)  
+
+/* Each LI(Length Indicator) holds approx 1+1/2 byte and some other fields thus keeping Header Size equal to twice of MAX LI */
+/* 5GNR_RLC: Need to change value of HDRSZ as per number of PDUs going in one datReq */
+#define RLC_MIN_HDRSZ                         1
+#define RLC_MAX_HDRSZ                         5 
+#define RLC_AM_PDU_FIXED_HDRSZ                2
+#define RLC_AM_PDU_12BIT_SN_HDRSZ             2
+#define RLC_AM_PDU_18BIT_SN_HDRSZ             3
+#define RLC_AM_SEG_12BIT_SN_WITH_SO_HDRSZ     4
+#define RLC_AM_SEG_18BIT_SN_WITH_SO_HDRSZ     5
+#define RLC_AM_SEG_12BIT_SN_WITHOUT_SO_HDRSZ  2
+#define RLC_AM_SEG_18BIT_SN_WITHOUT_SO_HDRSZ  3
+#define RLC_EXTN_HDRSZ                  2
+#define RLC_CNTRL_PDU_FIXED_HDRSZ       3
+#define RLC_MAC_HDR_SZ2                 2
+#define RLC_MAC_HDR_SZ3                 3
+#define RLC_BYTE_LEN                    8
+#define RLC_2BYTE_LEN                   16
+#define RLC_E1_LEN                      1
+#define RLC_NACK_E1E2_LEN               12
+#define RLC_SO_LEN                      15
+#define RLC_DC_LEN                      1
+#define RLC_CPT_LEN                     3
+#define RLC_RF_LEN                      1
+#define RLC_P_LEN                       1
+#define RLC_FI_LEN                      2
+#define RLC_SI_LEN                      2
+#define RLC_E_LEN                       1
+#define RLC_SN_LEN                      10
+#define RLC_SN_LEN_12BITS               12
+#define RLC_SN_LEN_18BITS               18
+#define RLC_LSF_LEN                     1
+#define RLC_LI_LEN                      11
+#define RLC_STA_PDU_R_BITS_ACKSN_12BITS 7  /* 5GNR : Num Reserved bits in STATUS PDU */
+#define RLC_STA_PDU_R_BITS_ACKSN_18BITS 1
+#define RLC_STA_PDU_R_BITS_NACKSN_12BITS 1
+#define RLC_STA_PDU_R_BITS_NACKSN_18BITS 3
+#define RLC_NACK_RANGE_LEN               8
+#define RLC_SO_LEN_5GNR                  16
+
+#define RLC_DC_POS                      0x80
+#define RLC_DC_SHT                      7      
+#define RLC_POLL_POS                    0x40 /* 5GNR */
+#define RLC_POLL_SHT                    6    /* 5GNR */
+#define RLC_SI_POS                      0x30 /* 5GNR */
+#define RLC_SI_SHT                      4    /* 5GNR */
+#define RLC_SN_POS_12BIT                0x0F
+#define RLC_SN_POS_18BIT                0x03
+#define RLC_AM_GET_WIN_SZ(_snLen)       ((RLC_AM_CFG_12BIT_SN_LEN == (_snLen)) ? (2048) : (131072)) /* 5GNR */
+#define RLC_RCV_BUF_BIN_SIZE 512   /* receive buffer size */
+#define RLC_TX_BUF_BIN_SIZE 512   /* receive buffer size */
+
+#define RLC_SDU_LST                     1
+#define RLC_SEG_LST                     2
+#define RLC_RETX_LST                    3
+#define RLC_ALL_BYTES_MISSING           0xffff
+
+#define RLC_MAX_PDU_MAP                 30       /*!< Maximum PDU Map. */
+
+#define RLC_LLIST_FIRST_SDU(lstCp, nod)          \
+{                                               \
+   CmLList *tmpNode;                            \
+   /*CM_LLIST_FIRST_NODE(&(lstCp), tmpNode);*/      \
+   /*if (tmpNode != NULLP)*/                        \
+   if((tmpNode=cmLListFirst(&lstCp)))            \
+      nod = (RlcSdu *)tmpNode->node;             \
+   else                                         \
+      nod = NULLP;                              \
+}                                                          
+
+                                                           
+#define RLC_LLIST_FIRST_SEG(lstCp, nod)         \
+{                                              \
+   CmLList *tmpNode;                           \
+   /*CM_LLIST_FIRST_NODE(&(lstCp), tmpNode);*/     \
+   /*if (tmpNode != NULLP)*/                       \
+   if((tmpNode=cmLListFirst(&lstCp)))            \
+      nod = (RlcSeg *)tmpNode->node;            \
+   else                                        \
+      nod = NULLP;                             \
+}                                                          
+
+#define RLC_LLIST_FIRST_RETX(lstCp, nod)        \
+{                                              \
+   CmLList *tmpNode;                           \
+   /*CM_LLIST_FIRST_NODE(&(lstCp), tmpNode);*/     \
+   /*if (tmpNode != NULLP)*/                       \
+   if((tmpNode=cmLListFirst(&lstCp)))            \
+      nod = (RlcRetx *)tmpNode->node;           \
+   else                                        \
+      nod = NULLP;                             \
+}
+
+#define RLC_LLIST_NEXT_SDU(lstCp, nod)          \
+{                                              \
+   CmLList *tmpNode;                           \
+   /*CM_LLIST_NEXT_NODE(&(lstCp), tmpNode);*/      \
+   /*if (tmpNode != NULLP)  */                     \
+   if((tmpNode = cmLListNext(&lstCp)))          \
+      nod = (RlcSdu *)tmpNode->node;            \
+   else                                        \
+      nod = NULLP;                             \
+}                                              
+
+
+#define RLC_LLIST_NEXT_SEG(lstCp, nod)          \
+{                                              \
+   CmLList *tmpNode;                           \
+   (lstCp).crnt = &((nod)->lstEnt);            \
+   /*CM_LLIST_NEXT_NODE(&(lstCp), tmpNode);*/      \
+   /*if (tmpNode != NULLP)*/                       \
+   if((tmpNode = cmLListNext(&lstCp)))           \
+      nod = (RlcSeg *)tmpNode->node;            \
+   else                                        \
+      nod = NULLP;                             \
+}      
+
+                                        
+#define RLC_LLIST_NEXT_RETX(lstCp, nod)         \
+{                                              \
+   CmLList *tmpNode;                           \
+   /*CM_LLIST_NEXT_NODE(&(lstCp), tmpNode);*/      \
+   /*if (tmpNode != NULLP) */                      \
+   if ((tmpNode = cmLListNext(&lstCp)))          \
+      nod = (RlcRetx *)tmpNode->node;           \
+   else                                        \
+      nod = NULLP;                             \
+}
+
+
+#define RLC_LLIST_LAST_RETX(lstCp, nod)         \
+{                                              \
+   CmLList *tempNode = NULLP;                  \
+   cmLListLast(&lstCp);                        \
+   tempNode = cmLListCrnt(&lstCp);             \
+   if (tempNode != NULLP)                      \
+      nod = (RlcRetx *)tempNode->node;          \
+   else                                        \
+      nod = NULLP;                             \
+}
+
+#define RLC_LLIST_LAST_SEG(lstCp, nod)          \
+{                                              \
+   CmLList *tempNode = NULLP;                  \
+   cmLListLast(&lstCp);                        \
+   tempNode = cmLListCrnt(&lstCp);             \
+   if (tempNode != NULLP)                      \
+      nod = (RlcSeg *)tempNode->node;           \
+   else                                        \
+      nod = NULLP;                             \
+}
+
+#define RLC_LLIST_LAST_SDU(lstCp, nod)          \
+{                                              \
+   CmLList *tempNode = NULLP;                  \
+   cmLListLast(&lstCp);                        \
+   tempNode = cmLListCrnt(&lstCp);             \
+   if (tempNode != NULLP)                      \
+      nod = (RlcSdu *)tempNode->node;           \
+   else                                        \
+      nod = NULLP;                             \
+}
+
+#define CM_LLIST_INS_AFT_CRNT(lstCp, nod)      \
+{                                              \
+   CmLList *nodeToIns = &nod->lstEnt;\
+   nodeToIns->node = (PTR) nod;\
+   cmLListInsAfterCrnt(&lstCp, nodeToIns);     \
+}
+
+#define CM_LLIST_INS_BEF_CRNT(lstCp, nod)      \
+{                                              \
+   CmLList *nodeToIns = &nod->lstEnt;          \
+   nodeToIns->node = (PTR) nod;                \
+   cmLListInsCrnt(&lstCp, nodeToIns);          \
+}
+
+#define RLC_LLIST_DEL_RECBUF(_recBuf)                      \
+{                                                          \
+   RlcSeg  *_seg = NULLP;                                  \
+   RLC_LLIST_FIRST_SEG(_recBuf->segLst, _seg);             \
+   while (_seg)                                            \
+   {                                                       \
+      cmLListDelFrm(&_recBuf->segLst, &_seg->lstEnt);      \
+      RLC_FREE(_seg, sizeof(RlcSeg));                      \
+      RLC_LLIST_NEXT_SEG(_recBuf->segLst, _seg);           \
+   }                                                       \
+}
+
+#define RLC_UMM_LLIST_FIRST_SEG(lstCp, nod)         \
+{                                              \
+   CmLList *tmpNode;                           \
+   if((tmpNode=cmLListFirst(&lstCp)))            \
+      nod = (RlcUmSeg *)tmpNode->node;            \
+   else                                        \
+      nod = NULLP;                             \
+} /*!< um mode first segment of linked list*/
+
+#define RLC_UMM_LLIST_NEXT_SEG(lstCp, nod)          \
+{                                              \
+   CmLList *tmpNode;                           \
+   (lstCp).crnt = &((nod)->lstEnt);            \
+   if((tmpNode = cmLListNext(&lstCp)))           \
+      nod = (RlcUmSeg *)tmpNode->node;            \
+   else                                        \
+      nod = NULLP;                             \
+}/*!< next segment in um mode linked list*/
+
+#define MODAMT(x, y, z,_snModMask)   \
+{                         \
+   y = (x - z) & _snModMask;   \
+}                                                         
+
+#define MODAMR(x, y, z , _snModMask)   \
+{                         \
+   y = (x - z) & (_snModMask);   \
+}
+
+/**
+ * @def RLC_AM_IS_TRANS_WIN_STALLED
+ *
+ *    This macro is used to check if the AM transmit window is stalled or not.
+ *    The tramist window is stalled when the distance between txNext and txNextAck
+ *    is greater than equal to Window Size. Actually it should never be greater 
+ *    than Window Size.
+ *    Returns TRUE if the window is stalled else FALSE
+ *
+ * @param[in] _amDl     AM Downlink control block
+ *
+*/ 
+#define RLC_AM_IS_TRANS_WIN_STALLED(_amDl)  \
+     ((((_amDl)->txNext - (_amDl)->txNextAck) & _amDl->snModMask) >= (RLC_AM_GET_WIN_SZ(_amDl->snLen)))
+
+#ifdef TENB_STATS
+#define RLC_AM_TRANS_WIN_SIZE(_amDl)  \
+     (((_amDl)->txNext - (_amDl)->txNextAck) & _amDl->snModMask)
+#endif
+
+#define RLC_AM_IS_POLL_BIT_SET(_amDl) \
+  (RLC_AMDL.pollSn == ((RLC_AMDL.txNext - 1) & RLC_AMDL.snModMask))
+
+#define RLC_FILL_CNTRL_INFO(cntrlInfo, _val, _len, _idx, _eb)\
+{                                                           \
+   cntrlInfo.val = _val;                                    \
+   cntrlInfo.len = _len;                                    \
+   cntrlInfo.idx = _idx;                                    \
+   cntrlInfo.emtBits = _eb;                                 \
+}
+#define RLC_FILL_PREV_IDX(cntrlInfo, _e1Idx, _e1eb, _idx, _eb) \
+{                                                                     \
+  _e1Idx = cntrlInfo.e1Idx;                                           \
+  _e1eb  = cntrlInfo.e1eb;                                            \
+  _idx   = cntrlInfo.idx;                                             \
+  _eb    = cntrlInfo.emtBits;                                         \
+}
+
+#define RLC_FILL_HDR_ARGS(hdrInfo, _val, _len)  \
+{                                              \
+   hdrInfo.val = _val;                         \
+   hdrInfo.len = _len;                         \
+}
+
+/* kw003.201 - This macro provides the header size other than the */
+/*             fixed header of 2 bytes for each AMD PDU or 4 bytes*/
+/*             for an AM PDU segment                              */
+#define RLC_AM_EXTN_HDRSZ(_numLi, _eHdrSz)       \
+{                                               \
+   if ((_numLi - 1) % 2)                        \
+   {                                            \
+      _eHdrSz = ((3 * (_numLi - 2)) >> 1) + 2;  \
+   }                                            \
+   else                                         \
+   {                                            \
+      _eHdrSz = (3 * (_numLi - 1)) >> 1;        \
+   }                                            \
+}
+
+/* Update poll bit in the buffer */
+#define RLC_UPD_POLL_BIT(_gCb, _retx, _poll)                \
+{                                                          \
+   uint8_t fHdr;                                                \
+                                                           \
+   if (_poll != _retx->amHdr.p)                            \
+   {                                                       \
+      /* Get the first byte of the buffer */               \
+      SRemPreMsg((Data *)&fHdr, _retx->seg);               \
+      if (_poll == TRUE)                                   \
+      {                                                    \
+         fHdr = fHdr | RLC_POLL_SET;                        \
+      }                                                    \
+      else                                                 \
+      {                                                    \
+         fHdr = fHdr & RLC_POLL_UNSET;                      \
+      }                                                    \
+      /* Concatenated updated hdr to the mBuf */           \
+      SAddPreMsg ((Data)fHdr, _retx->seg);                 \
+   }                                                       \
+   /* Update poll bit in the hdrInfo */                    \
+   _retx->amHdr.p = _poll;                                 \
+}
+
+#define RLC_AM_ELIMINATE_EXTN_HDR(_pduSz, _sduSz, _numLi)   \
+{                                                          \
+   if ( (_pduSz > _sduSz) && (_sduSz < 2048) )             \
+   {                                                       \
+      _pduSz -= (_numLi % 2) ? 1 : 2;                      \
+   }                                                       \
+}
+/**
+ * @def RLC_AM_CHK_SN_WITHIN_RECV_WINDOW
+ *
+ *    This macro is used to check if a Sequence Number falls within the AM
+ *    reception window or not.
+ *    The condition is VR(R) <= SN < VR(MR), which are subtracting the base
+ *    modulus becomes 0 <= (SN - VR(R)) % SNLen < (VR(MR) - VR(R)) % SnLen
+ *    NOTE: Careful with the parantheses
+ *
+ *    Returns TRUE if within the window; FALSE otherwise
+ *
+ * @param[in] _sn       The sequence number to be checked
+ * @param[in] _amUl     AM Uplink control block
+ *
+*/
+#define RLC_AM_CHK_SN_WITHIN_RECV_WINDOW(_sn, _amUl)          \
+  ((((_sn) - (_amUl->rxNext)) & (_amUl->snModMask)) < (((_amUl->vrMr) - (_amUl->rxNext)) & (_amUl->snModMask))) 
+
+#define RLC_POWER(x, y)  x << (y-1); 
+
+#ifndef L2_OPTMZ
+#define rlcCpyMsg(_cb,x, y) \
+      (SAddMsgRef((x), RLC_GET_MEM_REGION(_cb), RLC_GET_MEM_POOL(_cb), (y)))
+#else
+/* L2 optimization for mUe/Tti: Removing dup buf*/
+#define rlcCpyMsg(_cb,x, y) \
+      (SIncMsgRef((x), RLC_GET_MEM_REGION(_cb), RLC_GET_MEM_POOL(_cb), (y)))
+#endif
+
+//      printf("Copy Msg %x \n",x);
+
+/*******************************************************************************
+ *                              Debugging Defines 
+ ******************************************************************************/
+#define RLC_DBG_SUB_MASK   DBGMASK_MI             /**< Use for sub-mask */
+#define RLC_DBGMASK_DETAIL (RLC_DBG_SUB_MASK << 0) /**< Parameters, It will give
+                                                      in depth info */
+#define RLC_DBGMASK_BRIEF  (RLC_DBG_SUB_MASK << 1) /**< Info, It will give info at
+                                                    entry and exit places along
+                                                   with certain state changes */
+#define RLC_DBGMASK_ERROR  (RLC_DBG_SUB_MASK << 2) /**< Error information */
+#define RLC_DBGMASK_FATAL  (RLC_DBG_SUB_MASK << 3) /**< FATAL errors like memory
+                                                    resource failure etc., */
+
+#define RLC_DBG_MDL_MASK (RLC_DBG_SUB_MASK << 4)
+
+#define RLC_DBGMASK_TM         (RLC_DBG_MDL_MASK << 0)    /**< TM */
+#define RLC_DBGMASK_UM         (RLC_DBG_MDL_MASK << 1)    /**< UM */
+#define RLC_DBGMASK_AM         (RLC_DBG_MDL_MASK << 2)    /**< AM */
+#define RLC_DBGMASK_DL         (RLC_DBG_MDL_MASK << 3)    /**< DL */
+#define RLC_DBGMASK_UL         (RLC_DBG_MDL_MASK << 4)    /**< UL */
+#define RLC_DBGMASK_CFG        (RLC_DBG_MDL_MASK << 5)    /**< CFG */
+#define RLC_DBGMASK_LMM        (RLC_DBG_MDL_MASK << 6)    /**< LMM */
+#define RLC_DBGMASK_INF        (RLC_DBG_MDL_MASK << 7)    /**< UI, LI */
+#define RLC_DBGMASK_DUT        (RLC_DBG_MDL_MASK << 8)    /**< DBM, UTL, TMR */
+#define RLC_DBGMASK_MBUF_PRNT  (RLC_DBG_MDL_MASK << 9)    /**< MBUF, useful in
+                                                             integrated 
+                                                             testing */
+#define RLC_DBGMASK_MEM_INFO   (RLC_DBG_MDL_MASK << 10)   /**< Print SSI memory
+                                                             information*/
+#define RLC_DBGMASK_UDX        (RLC_DBG_MDL_MASK << 11)   /**< UDX interface */
+
+#ifdef DEBUGP
+#define RLC_PRNT_BORDER                                   \
+do                                                       \
+{                                                        \
+   RLC_PRNT((_kwPBuf, "\n==========================\n")); \
+}while(0)
+
+#define RLC_PRNT_HLINE(_cb,_pMsg)                                              \
+{                                                                             \
+   sprintf((_cb)->init.prntBuf, "[RLC_LAYER: %s:%d]::", __FILE__, __LINE__);  \
+   SPrint((_cb)->init.prntBuf);                                               \
+   RLC_PRNT_TSTAMP(_cb);                                                       \
+   sprintf((_cb)->init.prntBuf, _pMsg);                                       \
+   SPrint((_cb)->init.prntBuf);                                               \
+}
+
+#define RLC_PRNT(_cb,_prntbuf)  \
+{                              \
+   sprintf _prntbuf;           \
+   SPrint(_cb->init.prntBuf);  \
+}
+
+#define RLC_PRINT_TO_BUFFER(_cb,...)                             \
+{                                                               \
+   snprintf((_cb)->init.prntBuf, PRNTSZE, "[%s]::", __func__);  \
+   SPrint((_cb)->init.prntBuf);                                 \
+   snprintf(_cb->init.prntBuf, PRNTSZE,__VA_ARGS__);            \
+   SPrint(_cb->init.prntBuf);                                   \
+}
+
+#define RLC_PRNT_TSTAMP(_cb)                                   \
+{                                                             \
+   S8 _buf[60];                                               \
+   DateTime dt;                                               \
+   memset((&dt), 0, sizeof(DateTime));                \
+   SGetDateTime(&dt);                                         \
+   sprintf(_buf, "date: %02d/%02d/%04d time: %02d:%02d:%02d", \
+     (int)dt.month,(int)dt.day,(int)dt.year + 1900,           \
+     (int)dt.hour,(int)dt.min,(int)dt.sec);                   \
+   RLC_PRNT(_cb,(_cb->init.prntBuf,("[%s]", _buf)));           \
+}
+
+#define RLC_PRNT_MBUF(_cb,_mBufPtr)                          \
+do                                                          \
+{                                                           \
+   if(_cb->init.dbgMask & (RLC_DBGMASK_MBUF_PRNT))           \
+   {                                                        \
+     RLC_PRNT_HLINE(_cb,("\nMessage Buffer Contents:\n"));   \
+     SPrntMsg ((Buffer *)_mBufPtr, 0, 0);                   \
+   }                                                        \
+}while(0)
+
+#define RLC_PRNT_MEMINFO(_cb)                                  \
+do                                                            \
+{                                                             \
+   uint32_t  _memInfo;                                             \
+   if(_cb->init.dbgMask & (RLC_DBGMASK_MEM_INFO))              \
+   {                                                          \
+     RLC_PRNT_HLINE(_cb,("\nMemory Information:\n"));          \
+     SRegInfoShow(0, &_memInfo);                              \
+   }                                                          \
+}while(0)
+
+#define RLCDBGP_INTERNAL(_cb,_mask,...)           \
+do                                               \
+{                                                \
+   if (!((_cb->init.dbgMask & _mask) ^ _mask))   \
+   {                                             \
+      RLC_PRINT_TO_BUFFER(_cb, __VA_ARGS__);      \
+   }                                             \
+}while(0)
+
+#define RLCDBGP_ERROR(_cb, ...) \
+   RLCDBGP_INTERNAL(_cb,(RLC_DBGMASK_ERROR | RLC_MODULE),__VA_ARGS__)
+
+#define RLCDBGP_DETAIL(_cb, ...) \
+   RLCDBGP_INTERNAL(_cb,(RLC_DBGMASK_DETAIL | RLC_MODULE),__VA_ARGS__)
+
+#define RLCDBGP_BRIEF(_cb, ...) \
+   RLCDBGP_INTERNAL(_cb,(RLC_DBGMASK_BRIEF | RLC_MODULE),__VA_ARGS__)   
+   
+#else  /* DEBUGP */ 
+#define RLC_PRNT_HLINE(_cb,_pMsg)
+#define RLC_PRNT(_cb,_prntbuf)
+#define RLC_PRNT_TSTAMP(_cb)
+#define RLC_PRNT_MBUF(_cb,_mBufPtr)
+#define RLC_PRNT_MEMINFO(_cb)
+#define RLCDBGP(_cb,_mask, _arg)
+#define RLCDBGP_ERROR(_cb, ...) 
+#define RLCDBGP_DETAIL(_cb, ...)
+#define RLCDBGP_BRIEF(_cb, ...)
+#endif /* DEBUGP */
+
+/*******************************************************************************
+ *                              LMM Defines 
+ ******************************************************************************/
+#define RLC_LMM_RB_STS_INC(_cb)    (_cb)->genSts.numOfRb++;
+
+#define RLC_LMM_RB_STS_DEC(_cb)    (_cb)->genSts.numOfRb--;
+
+#if defined(SS_MULTICORE_SUPPORT) && defined(SS_M_PROTO_REGION)
+#define RLC_FILL_SAP_HELPER(_Sap, _cfg, _gCb)\
+{\
+   _Sap->pst.selector = _cfg->selector; \
+   _Sap->pst.route = _cfg->route; \
+   _Sap->pst.prior =  _cfg->priority; \
+   _Sap->pst.region = _gCb->init.region;\
+   _Sap->pst.pool = _gCb->init.pool;\
+   _Sap->pst.dstProcId = _cfg->procId; \
+   _Sap->pst.dstEnt = _cfg->ent; \
+   _Sap->pst.dstInst = _cfg->inst; \
+   _Sap->pst.srcProcId = _gCb->init.procId; \
+   _Sap->pst.srcEnt = _gCb->init.ent; \
+   _Sap->pst.srcInst = _gCb->init.inst; \
+   _Sap->pst.event = EVTNONE; \
+   _Sap->spId = _cfg->sapId; \
+   _Sap->state = RLC_SAP_CFG; \
+}
+#else /* defined(SS_MULTICORE_SUPPORT) && defined(SS_M_PROTO_REGION) */
+#define RLC_FILL_SAP_HELPER(_Sap, _cfg, _gCb)\
+{\
+   _Sap->pst.selector = _cfg->selector; \
+   _Sap->pst.route = _cfg->route; \
+   _Sap->pst.prior =  _cfg->priority; \
+   _Sap->pst.region = _cfg->mem.region;\
+   _Sap->pst.pool = _cfg->mem.pool;\
+   _Sap->pst.dstProcId = _cfg->procId;\
+   _Sap->pst.dstEnt = _cfg->ent;\
+   _Sap->pst.dstInst = _cfg->inst;\
+   _Sap->pst.srcProcId = _gCb->init.procId;\
+   _Sap->pst.srcEnt = _gCb->init.ent;\
+   _Sap->pst.srcInst = _gCb->init.inst;\
+   _Sap->pst.event = EVTNONE;\
+   _Sap->spId = _cfg->sapId;\
+   _Sap->state = RLC_SAP_CFG;\
+}
+#endif
+
+/*******************************************************************************
+ *                              UDX Defines 
+ ******************************************************************************/
+#define RLC_GET_DL_SAPCB(_cb, _rbCb) (_cb->u.dlCb->udxDlSap + _rbCb->udxSapId)
+#define RLC_GET_UDX_SAP(_cb) (_cb->u.ulCb->udxUlSap)
+
+/* kw005.201 added support for L2 Measurement */
+#ifdef LTE_L2_MEAS
+#define RLC_L2_MAX_TIMERS        1
+#define RLC_QCI_LIST_BUCKET_SIZE 10
+#define RLC_TB_LIST_BUCKET_SIZE  10
+#define RLC_MAX_L2MEAS_EVT       10
+/* L2 Measurement index to be used in rbCb to store measData */                                       
+#define RLC_L2MEAS_ACT_UE       0                                       
+#define RLC_L2MEAS_DL_DELAY     1                                       
+#define RLC_L2MEAS_DL_DISC      2
+#define RLC_L2MEAS_UU_LOSS      3
+#define RLC_L2MEAS_DL_IP        4
+#define RLC_L2MEAS_UL_IP        5
+#endif /* LTE_L2_MEAS */
+
+#define RLC_RDWR_LOCK(_lockPtr)
+#define RLC_RDWR_UNLOCK(_lockPtr)
+#define RLC_TIME_DIFF(t1,t2)                  \
+   (t1<t2 ? ((0xffffffff - t2) + t1 ): (t1 - t2)) 
+
+/*******************************************************************/
+
 /* Memory */
 #define RLC_MEM_REGION_UL    1
 #define RLC_MEM_REGION_DL    4
    pst.intfVer   = 0;                                  \
 }
 
+/** @brief global variables */
 uint16_t getTransId();
 
+/** @brief Local typedefs */
+typedef uint32_t    RlcSn;   /*!< Sequence Number length */
+
+typedef RguDDatIndInfo KwDatIndInfo;
+
+typedef RguDStaIndInfo KwDStaIndInfo;
+
+typedef RguPduInfo KwPduInfo; /* kw002.201 : Aligning the structure with RGU */
+
+typedef struct _amRlcStats
+{
+   uint32_t   numDLStaPduSent;
+   uint32_t   numDLNacksInStaPdu;
+   uint32_t   numDLBytesUnused;
+   uint32_t   numDLPollTimerExpiresSrb;
+   uint32_t   numDLPollTimerExpiresDrb;
+   uint32_t   numDLMaxRetx;
+   uint32_t   numDLRetransPdus;
+   uint32_t   numULPdusDiscarded;
+   uint32_t   numULReAsmblTimerExpires;
+   uint32_t   numULStaPduRcvd;
+   uint32_t   numULNackInStaPduRcvd;
+   uint32_t   numRlcAmCellSduTx; /* Count of SDUs transmitted in DL for all UEs */
+   uint32_t   numRlcAmCellSduBytesTx; /*Total number of bytes transmitted in DL for all Ues */
+   uint32_t   numRlcAmCellRetxPdu; /*Count of PDUs retransmitted for all Ues */
+   uint32_t   numRlcAmMaxRetx; /*Total number of Max-RLC retransmissions hit for all the Ues */
+   uint32_t   numRlcAmCellDupPduRx; /*Count of Duplicate PDUs detected for a UE in UL for all Ues */
+   uint32_t   numRlcAmCellDropOutWinRx; /*Count of PDUs dropped due to Out of Window reception for all Ues */
+   uint32_t   numRlcAmCellSduRx; /* Count of SDUs received in UL for all UEs*/
+   uint32_t   numRlcAmCellSduBytesRx;/*Total number of bytes received in UL for all Ues*/
+   uint32_t   numRlcAmCellNackRx; /*Total number of UL PDUs nacked for all the Ues*/
+   uint32_t   numRlcAmCellWinStall; /*Number of window stalls detected for all the Ues */
+}AMRLCStats;
+
+typedef struct _umRlcStats
+{
+   uint32_t   numDLBytesUnused;
+   uint32_t   numDLMaxRetx;
+   uint32_t   numULPdusDiscarded;
+   uint32_t   numULReAsmblTimerExpires;
+   uint32_t   numULPdusOutsideWindow;
+}UMRLCStats;
+
+typedef struct _rlcStats
+{
+   AMRLCStats   amRlcStats;
+   UMRLCStats   umRlcStats;
+}RLCStats;
+
+RLCStats gRlcStats;
+
+/* kw005.201 added support for L2 Measurement */
+#ifdef LTE_L2_MEAS
+typedef struct rlcSduSnMap RlcSduSnMap;
+typedef RguLchMapInfo KwLchMapInfo;
+#endif /*  LTE_L2_MEAS */
+
+/** @defgroup ummode UM Module Info 
+*/
+/** 
+ * @brief  Structure to hold an Unacknowledged Mode header
+ *
+ * @details
+ *    - si    : Segmentation Info
+ *    - sn    : Sequence number
+ *    - so    : Segmentation offset
+*/
+typedef struct rlcUmHdr
+{
+   uint8_t     si;              /*!< Segmentation Info */
+   RlcSn       sn;              /*!< Sequence number */
+   uint16_t    so;              /*!< Segmentation offset */
+}RlcUmHdr;
+
+/** 
+ * @brief  Structure to hold an Acknowledged Mode header
+ *
+ * @details
+ *    - dc    : Data/Control PDU
+ *    - rf    : Resegmentation flag
+ *    - p     : Poll bit
+ *    - fi    : Framing Info
+ *    - e     : Extension bit
+ *    - lsf   : Last segment flat
+ *    - sn    : Sequence number
+ *    - so    : Segment offset
+ *    - numLi : Number of length indicators in the following array (li)
+ *    - li    : Length indicators
+*/
+typedef struct rlcAmHdr
+{
+   uint8_t     dc;              /*!< Data/Control PDU */
+   uint8_t     p;               /*!< Poll bit */
+   uint8_t     si;              /*!< Segmentation Info: 5GNR */ 
+   RlcSn       sn;              /*!< Sequence number */
+   uint32_t    so;              /*!< Segment offset */
+}RlcAmHdr;
+
+/* structures used for encoding/decoding the headers */
+typedef struct rlcCntrlInfo
+{
+   uint16_t  val;
+   uint8_t   len;
+   uint16_t  idx;
+   uint8_t   emtBits;
+   uint16_t  e1Idx;
+   uint16_t  e2Idx;   
+   uint8_t   e1eb;
+}RlcCntrlInfo;
+
+typedef struct rlcHdrInfo
+{
+   uint32_t  val;
+   uint8_t   len;
+   uint8_t   eb;
+   uint8_t   *hdr;
+   uint16_t  idx;
+   uint8_t   pEb;
+   uint8_t   pLen;
+}RlcHdrInfo;
+
+typedef struct rlcExtHdr
+{
+   uint32_t val;
+   uint16_t len;
+   uint8_t  hdr;
+   uint8_t  pLen;
+}RlcExtHdr;
+
+/** 
+ * @brief  Structure to hold information about a Logical channel
+ *
+ * @details
+ *    - lChId    : Logical channel Id
+ *    - lChType  : Logical channel type 
+*/ 
+typedef struct rlcLchInfo
+{
+   CmLteLcId     lChId;     /*!< Logical channel Id */
+   CmLteLcType   lChType;   /*!< Logical channel type */
+}RlcLchInfo;
+
+/* kw005.201 added support for L2 Measurement */
+#ifdef LTE_L2_MEAS
+
+/** @struct RlcL2Cntr
+ * RLC L2 Counter  */
+typedef struct rlcL2Cntr
+{
+   struct
+   {
+      uint32_t  numActvUe;        /*!< number of active Ue */
+      uint32_t  sampOc;           /*!< Total number of sampling occasion */
+   }actUe;
+   struct
+   {
+      uint32_t  dLoss;            /*!< Total number of lost packets */  
+      uint32_t  posPkts;          /*!< Total number of positively acknowlegded 
+                                  packets */
+   }uuLoss;
+   struct                    /*!< For DL IP throughput */
+   {
+      uint32_t volSummation;      /*!< Sum of data in bytes */
+      uint32_t timeSummation;     /*!< Sum of time difference in milli sec*/
+   }dlIpThruput;
+   struct                    /*!< For UL IP throughput */
+   {
+      uint32_t volSummation;      /*!< Sum of data in bytes */
+      uint32_t timeSummation;     /*!< Sum of time difference in milli sec*/
+   }ulIpThruput;
+   /* Discard new changes starts */
+   struct                    /*!< For UL IP throughput */
+   {
+      uint32_t discSdus;          /*!< Total RLC SDUs discarded */
+      uint32_t totSdus;           /*!< Total RLC SDUs received */
+   }dlDisc;
+   struct                    /*!< For UL IP throughput */
+   {
+      uint64_t sduDelay;          /*!< Total SDUs delay */
+      uint32_t numSdus;
+   }dlPjSduDelay;
+   uint32_t    totDrbsPerQci;     /*!< Total Count of DRB's for this QCI */
+}RlcL2Cntr;
+
+struct rlcSduSnMap
+{
+   CmLList     lstEnt;
+   Bool        failMarked;
+   Bool        fullySent;
+   uint32_t    sduId;
+   uint16_t    numSn;
+   uint16_t    snList[RLC_MAX_PDU_MAP];
+   uint16_t    harqAck;
+   uint16_t    reqSent;
+   uint16_t    rspRcvd;
+};
+
+typedef struct rlcSnSduMap
+{
+   uint16_t         sn;
+   CmLteLcId        lChId;              /*!< Logical channel Id */
+   uint16_t         numSdu;
+#ifdef LTE_RLC_R9
+   Bool        isBurstSplitted;    /*!< true: burst for this LCH is splitted */
+#endif /* LTE_RLC_R9 */
+   RlcSduSnMap  *sduList[RLC_MAX_DL_LI];
+}RlcSnSduMap;
+
+typedef struct rlcTbSnMap
+{
+   CmHashListEnt  hlTbEnt;
+   uint32_t       tbId;
+   uint16_t       prevNumSn;
+   uint16_t       numSn;
+   RlcSnSduMap    snSduMap[RGU_MAX_PDU * RGU_MAX_LC];
+}RlcTbSnMap;
+
+typedef struct rlcL2MeasCbUeMeasInfo
+{
+   CmLteRnti   ueId;                    /*!< UE ID (Used only for IP Throughput
+                                             in UL/DL */
+   CmLteCellId cellId;                  /*!< UE ID (Used only for IP Throughput
+                                             in UL/DL */
+   Bool        isValid;                 /*! < is this UE entry valid */
+   uint8_t     numLcId;                 /*!< Holds the number of LCh for which Ul Ip
+                                             measurement is ON */
+   uint8_t     lcId[RLC_MAX_LCH_PER_UE]; /*!< Holds the list of LCh for which Ul ip
+                                             measurement is ON */
+   RlcL2Cntr    measData[LKW_MAX_QCI];
+   uint16_t     numQci;                  /*!< number of valid qcI */
+   uint8_t      qci[LKW_MAX_QCI];        /*!< list of valid qcI */
+}RlcL2MeasCbUeMeasInfo;
+
+typedef struct rlcL2MeasCbIpThMeas
+{
+   uint8_t                   numUes;
+   uint8_t                   totNumQci;
+   uint8_t                   totQci[LKW_MAX_QCI];
+   RlcL2MeasCbUeMeasInfo ueInfoLst[LKW_MAX_UE]; /*Added for handling meas for multiple ues*/ 
+}RlcL2MeasCbIpThMeas;
+
+typedef struct rlcL2MeasCbNonIpThMeas
+{
+   uint16_t    numSamples;              /*!< Number of samples to take on numActUe */
+   uint16_t    numQci;                  /*!< number of valid qcI */
+   uint8_t     qci[LKW_MAX_QCI];        /*!< list of valid qcI */
+   RlcL2Cntr   measData[LKW_MAX_QCI];   /*!< Measurement CB */
+}RlcL2MeasCbNonIpThMeas;
+
+typedef union rlcL2MeasCbIpNonIpThMeasVal
+{
+   RlcL2MeasCbIpThMeas    ipThMeas;
+   RlcL2MeasCbNonIpThMeas nonIpThMeas;
+}RlcL2MeasCbIpNonIpThMeasVal;
+
+/** @struct RlcL2MeasCb
+ * RLC L2 Measurement CB */
+typedef struct rlcL2MeasCb
+{
+   uint8_t        measType;        /*!< Bit-wise set measurement types */
+   RlcL2MeasCbIpNonIpThMeasVal val;   /* Union of IP tpt or non-ip tpt */
+}RlcL2MeasCb;
+
+/** @struct RlcL2MeasEvtCb
+ * RLC L2 Measurement Evt CB */
+typedef struct rlcL2MeasEvtCb
+{
+   uint32_t      transId;                /*!< TransId of Measurement Req */
+   uint32_t      cbIdx;                  /*!< TransId of Measurement Req */
+   CmTimer       l2Tmr; /* NOT USED */                 /*!< L2 Timer per request */
+   TmrCfg        l2TmrCfg; /* NOT USED */               /*!< Time period of measurement */
+   RlcL2MeasCb   measCb;                 /*!< Measurement CB */ 
+   EpcTime       startTime; /* NOT USED */            /*!<  start time when meas starts*/ 
+}RlcL2MeasEvtCb;
+
+/** @struct RlcL2MeasRbCb
+ * RLC L2 Measurement Rb CB */
+typedef struct rlcL2MeasRbCb
+{
+   uint8_t        measOn;                      /*!< Measurements that are running */ 
+   RlcL2Cntr      *l2Sts[RLC_MAX_L2MEAS_EVT];  /*!< L2 Mesurement statistics */     
+}RlcL2MeasRbCb;
+
+/** @struct RlcL2Cb
+ * RLC L2  CB */
+typedef struct rlcL2Cb
+{
+   uint16_t        rlcNumMeas;                   /*!< Number of measurements going on */
+   RlcL2MeasEvtCb  rlcL2EvtCb[LKW_MAX_L2MEAS];  /*!< Pointers to Measurement Cb */
+   uint8_t         measOn[LKW_MAX_QCI];          /*!< Measurement on */
+   uint32_t        numActUe[LKW_MAX_QCI];       /*!< Measurement on */
+}RlcL2Cb;
+
+
+typedef enum _dlIpThrputState
+{
+   KW_DL_IPTHRU_RESET = 0,
+   KW_DL_IPTHRU_BURST_STARTED,
+   KW_DL_IPTHRU_BURST_CONTINUE,
+   KW_DL_IPTHRU_BURST_COMPLETED
+}DlIpThrputState;
+
+/** 
+* @struct rlcL2MeasSduLst
+* Structure to hold parameters of 
+* burst sdus in DL for a RB */
+typedef struct rlcOutStngSduInfo
+{
+   uint32_t  sduId;            /*!< SDU Id of sdu */
+   MsgLen    sduLen;           /*!< Size of sdu */
+   uint32_t  numTb;            /*!< Hold the number of TBs for this sdu in DL */
+}RlcOutStngSduInfo;
+
+/** 
+* @struct rlcL2MeasDlIpTh
+* Structure to hold parameters for DL ip 
+* throughput for a RB */
+typedef struct rlcL2MeasDlIpTh
+{
+   Bool               isBurstAct;            /*!< Set to TRUE when burst is active in DL */
+   uint64_t           burstStartTime;        /*!< Holds the starting time of the burst */
+   uint32_t           burstEndSduId;         /*!< Sdu ID when burst ends */
+   uint8_t            lastSduIdx;            /*!< Holds the index of last outStanding sdu */
+   RlcOutStngSduInfo  outStngSduArr[RLC_L2MEAS_MAX_OUTSTNGSDU];/*!< Hold the burst sdu information */
+}RlcL2MeasDlIpTh;
+
+/** 
+* @struct rlcL2MeasIpThruput
+* Structure to hold parameters for UL/DL ip 
+* throughput for a RB */
+typedef struct rlcL2MeasIpThruput
+{
+   uint32_t         dataVol;                 /*!< Holds volume of new data in bytes
+                                              for UL IP throughput */
+   uint32_t         ttiCnt;                  /*!< Holds ttiCnt received from MAC in UL */
+   uint32_t         prevTtiCnt;        /*!< Holds previous ttiCnt received from MAC in UL */
+   RlcL2MeasDlIpTh  dlIpTh;
+}RlcL2MeasIpThruput;
+
+#endif /* LTE_L2_MEAS */
+
+/** 
+ * @brief  Structure to hold an UE key for the UE hast lists
+ *
+ * @details
+ *    - ueId    : UE Id
+ *    - cellId  : Cell Id 
+*/
+typedef struct rlcUeKey
+{
+   CmLteRnti     ueId;     /*!< UE Id */
+   CmLteCellId   cellId;   /*!< Cell Id */
+}RlcUeKey;
+
+/** 
+ * @brief  Structure to hold an information about the CKW SAP
+ *
+ * @details
+ *    - pst   : Service user post structure
+ *    - spId  : Service provider Id
+ *    - suId  : Service user Id
+ *    - state : State of the SAP
+ *    - sts   : SAP specific statistics 
+*/
+typedef struct rlcCkwSapCb
+{
+   Pst           pst;     /*!< Service user post structure */
+   SpId          spId;    /*!< Service provider Id */
+   SuId          suId;    /*!< Service user Id */
+   uint8_t       state;   /*!< Sap Status */
+   RlcCkwCntSts   sts;     /*!< Statistics */
+}RlcCkwSapCb;
+
+/** 
+ * @brief  Structure to hold an information about the KWU SAP
+ *
+ * @details
+ *    - pst   : Service user post structure
+ *    - spId  : Service provider Id
+ *    - suId  : Service user Id
+ *    - state : State of the SAP
+ *    - sts   : SAP specific statistics 
+*/
+typedef struct rlcKwuSapCb
+{
+   Pst           pst;     /*!< Service user post structure */
+   SpId          spId;    /*!< Service provider Id */
+   SuId          suId;    /*!< Service user Id */
+   uint8_t       state;   /*!< Sap Status */
+   RlcKwuSapSts  sts;     /*!< Statistics */
+}RlcKwuSapCb;
+
+/** 
+ * @brief  Structure to hold an information about the RGU SAP
+ *
+ * @details
+ *    - pst       : Service user post structure
+ *    - spId      : Service provider Id
+ *    - suId      : Service user Id
+ *    - state     : State of the SAP
+ *    - bndTmr    : Bind Timer
+ *    - bndTmrInt : Timer Interval
+ *    - retryCnt  : Bind Retry Count
+*/
+typedef struct rlcRguSapCb
+{
+   Pst       pst;         /*!< Service user post structure */
+   SpId      spId;        /*!< Service provider Id */
+   SuId      suId;        /*!< Service user Id */
+   uint8_t   state;       /*!< Sap Status */
+   CmTimer   bndTmr;      /*!< Bind Timer */
+   uint16_t  bndTmrInt;   /*!< Timer Interval */
+   uint8_t   retryCnt;    /*!< Bind Retry Count */
+}RlcRguSapCb;
+
+/** 
+ * @brief  Structure to hold an information about the UDX UL SAP
+ *
+ * @details
+ *    - pst       : Service user post structure
+ *    - spId      : Service provider Id
+ *    - suId      : Service user Id
+ *    - state     : State of the SAP
+ *    - bndTmr    : Bind Timer
+ *    - bndTmrInt : Timer Interval
+ *    - retryCnt  : Bind Retry Count
+*/
+typedef struct rlcUdxUlSapCb
+{
+   Pst       pst;         /*!< Service user post structure */
+   SpId      spId;        /*!< Service provider Id */
+   SuId      suId;        /*!< Service user Id */
+   uint8_t   state;       /*!< Sap Status */
+   CmTimer   bndTmr;      /*!< Bind Timer */
+   uint16_t  bndTmrInt;   /*!< Timer Interval */
+   uint8_t   retryCnt;    /*!< Bind Retry Count */
+}RlcUdxUlSapCb;
+
+/** 
+ * @brief  Structure to hold an information about the UDX DL SAP
+ *
+ * @details
+ *    - pst       : Service user post structure
+ *    - spId      : Service provider Id
+ *    - suId      : Service user Id
+ *    - state     : State of the SAP
+*/
+typedef struct rlcUdxDlSapCb
+{
+   Pst     pst;     /*!< Service user post structure */
+   SpId    spId;    /*!< Service provider Id */
+   SuId    suId;    /*!< Service user Id */
+   uint8_t state;   /*!< Sap Status */
+}RlcUdxDlSapCb;
+
+/** 
+ * @brief  Structure to hold info about memory to be freed
+ *
+ * @details
+ *    - sduLst  : The SDU queues are appended to this queue, used 
+ *                for the UM SDU queues
+ *    - txLst   : Stores to be released AM Mode TX PDUs
+ *    - reTxLst : Stores to be released AM Re TX PDU's
+ *    - rbLst   : List of AM DL RBs to be freed 
+*/
+typedef struct rlcDlDataToBeFreed
+{
+   CmLListCp   sduLst;     /*!< Queue of SDU's to be freed  */
+   CmLListCp   txLst;     /*!< Stores to be released TX PDUs */
+   CmLListCp   reTxLst;   /*!< Stores to be released ReTX PDUs */
+   CmLListCp   rbLst;     /*!< List of AM DL RBs to be freed */
+}RlcDlDataToBeFreed;
+
+/** 
+ * @brief  Structure to hold an information about DL RLC instance
+ *
+ * @details
+ *    - numKwuSaps        : Number of RLC KWU Saps
+ *    - numUdxSaps        : Number of RLC UDX Saps
+ *    - rlcKwuDlSap          : Pointer to the array of KWU SAPS
+ *    - udxDlSap          : Pointer to the array of UDX SAPS
+ *    - rguDlSap          : RGU Sap Control Block
+ *    - cellLstCp         : Hashlist of CellCb
+ *    - ueLstCp           : Hashlist of UeCb 
+ *    - toBeFreed         : Pointer to data to be freed
+ *    - shutdownReveived  : Request for shutdown recevied or not
+ *    - eventInQueue      : Event for cleanup exists in queue or not
+ */
+typedef struct rlcDlCb
+{
+   uint8_t             numKwuSaps;         /*!< Number of RLC Data Saps */
+   uint8_t             numUdxSaps;         /*!< Number of RLC Data Saps */
+   RlcKwuSapCb         *rlcKwuDlSap;          /*!< KWU Sap Control Block */
+   RlcUdxDlSapCb       *udxDlSap;          /*!< UDX DL Sap Control Block */
+   RlcRguSapCb         *rguDlSap;          /*!< RGU Sap Control Block */
+   CmHashListCp        cellLstCp;          /*!< Hashlist of CellCb */
+   CmHashListCp        ueLstCp;            /*!< Hashlist of UeCb */
+   RlcDlDataToBeFreed  toBeFreed;          /*!< Pointer to data to be freed */        
+   Pst                 selfPst;            /*!< Pst to post events to self */
+   Buffer              *selfPstMBuf;       /*!< Buffer used for self post */
+   Bool                shutdownReceived;   /*!< Request for shutdown recevied */
+   Bool                eventInQueue;       /*!< Event exists in queue or not */
+#ifdef LTE_L2_MEAS
+   RlcL2Cb              rlcL2Cb; /*!< Control Block for L2 Measurements in RLC */
+#endif /* LTE_L2_MEAS */
+}RlcDlCb;
+
+/** 
+ * @brief  Structure to hold an information about UL RLC instance
+ *
+ * @details
+ *    - ckwSap       : CKW Sap Conrol Block
+ *    - numKwuSaps   : Number of RLC KWU Saps
+ *    - numUdxSaps   : Number of RLC UDX Saps
+ *    - udxUlSap     : Pointer to the array of UDX SAPS 
+ *    - rlcKwuUlSap     : Pointer to the array of KWU SAPS
+ *    - rguUlSap     : RGU Sap Control Block
+ *    - cellLstCp    : Hashlist of CellCb
+ *    - ueLstCp      : Hashlist of UeCb 
+ *    - transIdLstCp : Hashlist of cfg trans
+ */
+typedef struct rlcUlCb
+{
+   RlcCkwSapCb     ckwSap;         /*!< CKW Sap Conrol Block */ 
+   uint8_t         numKwuSaps;     /*!< Number of RLC Data Saps */
+   uint8_t         numUdxSaps;     /*!< Number of RLC Data Saps */
+   RlcUdxUlSapCb   *udxUlSap;      /*!< UDX DL Sap Control Block */
+   RlcKwuSapCb     *rlcKwuUlSap;      /*!< KWU Sap Control Block */
+   RlcRguSapCb     *rguUlSap;      /*!< RGU Sap Control Block */
+   CmHashListCp   cellLstCp;      /*!< Hashlist of CellCb */
+   CmHashListCp   ueLstCp;        /*!< Hashlist of UeCb */
+   CmHashListCp   transIdLstCp;   /*!< Hashlist of cfg trans */
+   uint8_t        rlcUlUdxEventType;  /*!<Ue Create/ReConfig> */
+/* kw005.201 added support for L2 Measurement */
+#ifdef LTE_L2_MEAS
+   RlcL2Cb        rlcL2Cb; /*!< Control Block for L2 Measurements in RLC */
+#endif /* LTE_L2_MEAS */
+}RlcUlCb;
+
+typedef struct rlcThptPerUe
+{
+   uint16_t ueIdx;
+   uint64_t dataVol;
+}RlcThptPerUe;
+
+/**
+ * @brief  Structure to hold information about throughput at  RLC
+ * 
+ */
+typedef struct rlcThpt
+{
+   Inst          inst;                      /* RLC instance */
+   CmTimer       thptTmr;                   /* Throughput Timer */
+   uint8_t       numActvUe;                 /* Number of Active UEs */
+   RlcThptPerUe  thptPerUe[MAX_NUM_UE];     /* Throughput calculated per UE */
+}RlcThpt;
+
+/** 
+ * @brief  Structure to hold an information about a RLC instance
+ *
+ * @details
+ *    - init    : Task Initialization Info
+ *    - genCfg  : General Configuration
+ *    - genSts  : General Statistics
+ *    - trcLen  : Trace Length
+ *    - trcMask : Trace Mask
+ *    - rlcTq    : Timer queue
+ *    - rlcTqCp  : Timer queue control point
+ *    - u       : Union depending on whether the instance is UL or DL
+ *      - ulCb  : UL instance Control Block
+ *      - dlCb  : DL instance Control Block
+ */
+typedef struct rlcCb
+{
+   TskInit    init;               /*!< Task Initialization Info */
+   RlcGenCfg   genCfg;             /*!< General Configuration Structure */
+   RlcGenSts   genSts;             /*!< General Statistics */
+   S16        trcLen;             /*!< Trace Length */
+   uint8_t         trcMask;            /*!< Trace Mask */
+   CmTqType   rlcTq[RLC_TMR_LEN];   /*!< Timer queue */
+   CmTqCp     rlcTqCp;             /*!< Timer queue control point */
+   union 
+   {
+      RlcUlCb   *ulCb;   /*!< Ul Control Block */
+      RlcDlCb   *dlCb;   /*!< Dl Control Block */
+   } u;
+   uint8_t    dlSduId;   /*!< Downlink SDU ID */
+   RlcThpt    rlcThpt;   /*!< Throughput at RLC*/
+}RlcCb;
+
+RlcCb *rlcCb[MAX_RLC_INSTANCES];   /*!< RLC global control block */
+
+/****************************************************************************
+ *                      Declarations
+ ***************************************************************************/
+S16 rlcGetSId ARGS((SystemId *s));
+
+Void rlcTmrExpiry ARGS((PTR cb, S16 tmrEvnt));
+
+S16 rlcLmmSendTrc ARGS ((RlcCb *gCb, Event event, Buffer *mBuf));
+
+void rlcStartTmr ARGS((RlcCb *gCb, PTR cb, S16 tmrEvnt));
+
+void rlcStopTmr  ARGS((RlcCb *gCb, PTR cb, uint8_t tmrType));
+
+bool rlcChkTmr ARGS((RlcCb *gCb,PTR cb, S16 tmrEvnt));
+
+#ifdef LTE_L2_MEAS
+Void rlcLmmSendAlarm ARGS (( RlcCb *gCb,
+                                   uint16_t category, 
+                                   uint16_t event, 
+                                   uint16_t cause, 
+                                   SuId suId, 
+                                   uint32_t ueId, 
+                                   uint8_t qci));
+
+S16 RlcMiRlcDlL2MeasReq ARGS (( Pst *pst, RlcL2MeasReqEvt *measReqEvt ));
+S16 RlcMiRlcDlL2MeasSendReq ARGS((Pst *pst,uint8_t measType));
+S16 RlcMiRlcDlL2MeasStopReq ARGS((Pst *pst,uint8_t measType));
+S16 RlcMiRlcUlL2MeasReq ARGS (( Pst *pst, RlcL2MeasReqEvt *measReqEvt ));
+S16 RlcMiRlcUlL2MeasSendReq ARGS((Pst *pst,uint8_t measType));
+S16 RlcMiRlcUlL2MeasStopReq ARGS((Pst *pst,uint8_t measType));
+Void rlcUtlPlcMeasDatInL2Sts ARGS((RlcL2Cntr *measData, 
+                                         RlcL2MeasRbCb *rbL2Cb,
+                                         uint8_t measType));
+#else /* LTE_L2_MEAS */
+Void rlcLmmSendAlarm ARGS ((RlcCb *gCb,
+                                  uint16_t category, 
+                                  uint16_t event, 
+                                  uint16_t cause, 
+                                  SuId suId, 
+                                  uint32_t ueId));
+#endif /* LTE_L2_MEAS */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __RLC_UTILS_H__ */
 /**********************************************************************
+  
          End of file
 **********************************************************************/
similarity index 99%
rename from src/5gnrrlc/kw_utl_dl.c
rename to src/5gnrrlc/rlc_utl_dl.c
index 6375aa9..4050de7 100755 (executable)
                   --rlcUtlSendUlDataToDu 
                   --kwUtlShutDown
 
-     File:     kw_utl_dl.c
+     File:     rlc_utl_dl.c
 
 **********************************************************************/
 
-/** @file kw_utl_dl.c
+/** @file rlc_utl_dl.c
 @brief RLC Utility Module 
 */
 
 #include "lkw.h"           /* LKW defines */
 #include "rgu.h"           /* RGU defiens */
 
-#include "kw_env.h"        /* RLC environment options */
-#include "kw.h"            /* RLC defines */
-#include "kw_err.h"        /* Error defines */
-#include "kw_udx.h"
-#include "kw_dl.h"
+#include "rlc_env.h"        /* RLC environment options */
+#include "rlc_err.h"        /* Error defines */
+
 
 /* extern (.x) include files */
 #include "ckw.x"           /* CKW includes */
 #include "lkw.x"           /* LKW inlcudes */
 #include "rgu.x"           /* RGU includes */
 
-#include "kw.x"            /* RLC includes */
-#include "kw_udx.x"        /* UDX interface includes */
-#include "kw_dl.x"         /* RLC downlink includes */
-
-#include "rlc_utils.h"
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_dl_ul_inf.h"
+#include "rlc_dl.h"         /* RLC downlink includes */
 #include "rlc_mac_inf.h"
 #include "du_app_rlc_inf.h"
 #include "rlc_lwr_inf_api.h"
@@ -1182,7 +1178,7 @@ Void rlcUtlFreeDlMemory(RlcCb *gCb)
 #endif
    {
       RlcSdu* sdu = (RlcSdu *)(lst->first->node);
-      RLC_RMV_SDU(gCb, lst, sdu);
+      RLC_REMOVE_SDU(gCb, lst, sdu);
       toBeFreed--;
    }      
 
similarity index 98%
rename from src/5gnrrlc/kw_utl_ul.c
rename to src/5gnrrlc/rlc_utl_ul.c
index f3ce80f..4604f19 100755 (executable)
                   --rlcUtlSendUlDataToDu 
                   --kwUtlShutDown
 
-     File:     kw_utl_ul.c
+     File:     rlc_utl_ul.c
 
 **********************************************************************/
 
-/** @file kw_utl_ul.c
+/** @file rlc_utl_ul.c
 @brief RLC Utility Module 
 */
 
 #include "kwu.h"           /* KWU defines */
 #include "lkw.h"           /* LKW defines */
 #include "rgu.h"           /* RGU defines */
+#include "rlc_env.h"        /* RLC environment options */
+#include "rlc_err.h"        /* Error defines */
 
-#include "kw_env.h"        /* RLC environment options */
-#include "kw.h"            /* RLC defines */
-#include "kw_err.h"        /* Error defines */
-#include "kw_ul.h"         /* RLC Uplink defines */
 
 /* extern (.x) include files */
 #include "ckw.x"           /* CKW includes */
@@ -62,9 +60,8 @@
 #include "lkw.x"           /* LKW includes */
 #include "rgu.x"           /* RGU includes */
 
-#include "kw.x"            /* RLC inlcudes */
-#include "kw_ul.x"         /* RLC uplink includes */
-#include "rlc_utils.h"
+#include "rlc_utils.h"            /* RLC defines */
+#include "rlc_ul.h"         /* RLC Uplink defines */
 #include "du_app_rlc_inf.h"
 #include "rlc_upr_inf_api.h"
 
similarity index 98%
rename from src/5gnrsch/rg_sch_ex_ms.c
rename to src/5gnrsch/sch_msg_router.c
index a340352..83d3624 100755 (executable)
 
 /************************************************************************
  
-     Name:     LTE-MAC layer
+     Name:     NR-SCH layer
   
      Type:     C source file
   
      Desc:     C source code SSI Interface Implementation
   
-     File:     rg_sch_ex_ms.c 
+     File:     sch_msg_router.c
   
 **********************************************************************/
 
-/** @file rg_ex_ms.c
+/** @file sch_msg_router.c
 @brief This file contains the implementation of callback functions 
 registered with SSI during the LTE MAC Task initialization.
 */
similarity index 99%
rename from src/du_app/du_mgr_ex_ms.c
rename to src/du_app/du_mgr_msg_router.c
index 25c1842..45ec532 100644 (file)
@@ -15,7 +15,7 @@
 #   limitations under the License.                                             #
 ################################################################################
  *******************************************************************************/
-
+/* File : du_mgr_msg_router.c */
 /* This file contains message handling functionality for DU APP */
 #include "common_def.h"
 #include "lrg.h"
index e711858..920afca 100644 (file)
@@ -1166,7 +1166,6 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t ueIdx, uint16_t crnti, \
             }
          }
          ret = fillAmbr(&macUeCfg->ambrCfg, ueCfgDb->ambrCfg);
-
          duFillModulationDetails(macUeCfg, duMacDb, ueCfgDb->ueNrCapability);
       }