Merge "VES PNF Registration Request changes."
authorHariomGupta(HCL) <hariom.g@hcl.com>
Wed, 26 May 2021 06:10:51 +0000 (06:10 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Wed, 26 May 2021 06:10:51 +0000 (06:10 +0000)
60 files changed:
build/odu/makefile
src/5gnrmac/lwr_mac_fsm.c
src/5gnrmac/lwr_mac_handle_phy.c
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.c
src/5gnrsch/sch.h
src/5gnrsch/sch_common.c
src/5gnrsch/sch_msg_router.c [moved from src/5gnrsch/rg_sch_ex_ms.c with 98% similarity]
src/5gnrsch/sch_rach.c
src/5gnrsch/sch_utils.c
src/cm/cm_math.c
src/cm/cm_math.h
src/cm/cm_math.x [deleted file]
src/cm/common_def.h
src/cm/mac_sch_interface.h
src/du_app/du_f1ap_msg_hdl.c
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
src/mt/mt_ss.c

index 99cd9df..e5dc99d 100644 (file)
@@ -86,6 +86,9 @@ ifeq ($(PHY), INTEL_L1)
        PLTFRM_FLAGS+=-DSS_USE_WLS_MEM -DINTEL_WLS_MEM -DDEBUG_MODE
 ifeq ($(PHY_MODE),TIMER)
        PLTFRM_FLAGS+=-DINTEL_TIMER_MODE
+else
+   #TODO: Remove below flag for testing RACH.indication onward
+   PLTFRM_FLAGS+=-DTEMP_INTG_FLAG
 endif
 endif
 
index 164f038..4fea616 100644 (file)
@@ -52,8 +52,8 @@ LwrMacCb lwrMacCb;
 
 uint8_t UnrestrictedSetNcsTable[MAX_ZERO_CORR_CFG_IDX];
 void fapiMacConfigRsp(uint16_t cellId);
-uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo, p_fapi_api_queue_elem_t headerElem);
-uint16_t fillUlTtiReq(SlotIndInfo currTimingInfo, p_fapi_api_queue_elem_t headerElem);
+uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo, p_fapi_api_queue_elem_t prevElem);
+uint16_t fillUlTtiReq(SlotIndInfo currTimingInfo, p_fapi_api_queue_elem_t prevElem);
 
 void lwrMacLayerInit(Region region, Pool pool)
 {
@@ -3162,37 +3162,45 @@ uint8_t calcTxDataReqPduCount(DlSchedInfo *dlInfo)
  * @return ROK
  *
  * ********************************************************************/
-uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc,MacCellCfg *macCellCfg,
-      uint16_t pduIndex)
+uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc, uint16_t pduIndex, MacCellCfg *macCellCfg,
+      PdschCfg pdschCfg)
 {
-   uint32_t pduLen = 0;
-   uint8_t *sib1TxdataValue = NULLP;
+   uint16_t payloadSize = 0;
+   uint8_t *sib1Payload = NULLP;
+   fapi_api_queue_elem_t *payloadElem = NULLP;
+#ifdef INTEL_WLS_MEM
+   void * wlsHdlr = NULLP;
+#endif
 
    pduDesc[pduIndex].pdu_index = pduIndex;
    pduDesc[pduIndex].num_tlvs = 1;
 
    /* fill the TLV */
-   /* as of now, memory is allocated from SSI, later WLS memory needs to be taken */
+   payloadSize = pdschCfg.codeword[0].tbSize;
    pduDesc[pduIndex].tlvs[0].tl.tag = FAPI_TX_DATA_PTR_TO_PAYLOAD_64;
-   pduDesc[pduIndex].tlvs[0].tl.length = macCellCfg->sib1Cfg.sib1PduLen;
-   LWR_MAC_ALLOC(sib1TxdataValue,macCellCfg->sib1Cfg.sib1PduLen);
-   if(sib1TxdataValue == NULLP)
+   pduDesc[pduIndex].tlvs[0].tl.length = payloadSize;
+   LWR_MAC_ALLOC(sib1Payload, payloadSize);
+   if(sib1Payload == NULLP)
    {
       return RFAILED;
    }
-   memcpy(sib1TxdataValue,macCellCfg->sib1Cfg.sib1Pdu,
-        macCellCfg->sib1Cfg.sib1PduLen);
-   pduDesc[pduIndex].tlvs[0].value = sib1TxdataValue;
+   payloadElem = (fapi_api_queue_elem_t *)sib1Payload;
+   FILL_FAPI_LIST_ELEM(payloadElem, NULLP, FAPI_VENDOR_MSG_PHY_ZBC_BLOCK_REQ, 1, \
+      macCellCfg->sib1Cfg.sib1PduLen);
+   memcpy(sib1Payload + TX_PAYLOAD_HDR_LEN, macCellCfg->sib1Cfg.sib1Pdu, macCellCfg->sib1Cfg.sib1PduLen);
 
-   /* The total length of the PDU description and   PDU data */
-   pduLen += 8; /* size of PDU length 2 bytes, PDU index 2 bytes, numTLV 4 bytes */
-   pduLen += sizeof(fapi_uint8_ptr_tlv_t); /* only 1 TLV is present */
-   pduDesc[pduIndex].pdu_length = pduLen; 
+#ifdef INTEL_WLS_MEM
+   mtGetWlsHdl(&wlsHdlr);
+   pduDesc[pduIndex].tlvs[0].value = WLS_VA2PA(wlsHdlr, sib1Payload);
+#else
+   pduDesc[pduIndex].tlvs[0].value = sib1Payload;
+#endif
+   pduDesc[pduIndex].pdu_length = payloadSize; 
 
 #ifdef INTEL_WLS_MEM   
-   addWlsBlockToFree(sib1TxdataValue, macCellCfg->sib1Cfg.sib1PduLen, (lwrMacCb.phySlotIndCntr-1));
+   addWlsBlockToFree(sib1Payload, payloadSize, (lwrMacCb.phySlotIndCntr-1));
 #else
-   LWR_MAC_FREE(sib1TxdataValue, macCellCfg->sib1Cfg.sib1PduLen);
+   LWR_MAC_FREE(sib1Payload, payloadSize);
 #endif
 
    return ROK;
@@ -3216,41 +3224,44 @@ uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc,MacCellCfg *macCellCfg,
  * @return ROK
  *
  * ********************************************************************/
-uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, RarInfo *rarInfo,
-      uint16_t pduIndex)
+uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, uint16_t pduIndex, RarInfo *rarInfo, PdschCfg pdschCfg)
 {
-   uint32_t pduLen = 0;
-   uint8_t *rarTxdataValue = NULLP;
+   uint16_t payloadSize;
+   uint8_t  *rarPayload = NULLP;
+   fapi_api_queue_elem_t *payloadElem = NULLP;
+#ifdef INTEL_WLS_MEM
+   void * wlsHdlr = NULLP;
+#endif
 
    pduDesc[pduIndex].pdu_index = pduIndex;
    pduDesc[pduIndex].num_tlvs = 1;
 
    /* fill the TLV */
-   /* as of now, memory is allocated from SSI, later WLS memory needs to be taken */
+   payloadSize = pdschCfg.codeword[0].tbSize;
    pduDesc[pduIndex].tlvs[0].tl.tag = FAPI_TX_DATA_PTR_TO_PAYLOAD_64;
-   pduDesc[pduIndex].tlvs[0].tl.length = rarInfo->rarPduLen;
-   LWR_MAC_ALLOC(rarTxdataValue,rarInfo->rarPduLen);
-   if(rarTxdataValue == NULLP)
+   pduDesc[pduIndex].tlvs[0].tl.length = payloadSize;
+   LWR_MAC_ALLOC(rarPayload, payloadSize);
+   if(rarPayload == NULLP)
    {
       return RFAILED;
    }
-   memcpy(rarTxdataValue,rarInfo->rarPdu,rarInfo->rarPduLen);
-   pduDesc[pduIndex].tlvs[0].value = rarTxdataValue;
-
-   /* The total length of the PDU description and   PDU data */
-   pduLen += 8; /* size of PDU length 2 bytes, PDU index 2 bytes, numTLV 4 bytes */
-   pduLen += sizeof(fapi_uint8_ptr_tlv_t); /* only 1 TLV is present */
-   pduDesc[pduIndex].pdu_length = pduLen; 
+   payloadElem = (fapi_api_queue_elem_t *)rarPayload;
+   FILL_FAPI_LIST_ELEM(payloadElem, NULLP, FAPI_VENDOR_MSG_PHY_ZBC_BLOCK_REQ, 1, rarInfo->rarPduLen);
+   memcpy(rarPayload + TX_PAYLOAD_HDR_LEN, rarInfo->rarPdu, rarInfo->rarPduLen);
 
-   /* TODO: The pointer value which was stored, needs to be free-ed at PHY *
-    * But since we did not implement WLS, this has to be done here
-    */
-#ifdef INTEL_WLS_MEM   
-   addWlsBlockToFree(rarTxdataValue, rarInfo->rarPduLen, (lwrMacCb.phySlotIndCntr-1));
+#ifdef INTEL_WLS_MEM
+   mtGetWlsHdl(&wlsHdlr);
+   pduDesc[pduIndex].tlvs[0].value = WLS_VA2PA(wlsHdlr, rarPayload);
 #else
-   LWR_MAC_FREE(rarTxdataValue, rarInfo->rarPduLen);
+   pduDesc[pduIndex].tlvs[0].value = rarPayload;
 #endif
+   pduDesc[pduIndex].pdu_length = payloadSize;
 
+#ifdef INTEL_WLS_MEM
+   addWlsBlockToFree(rarPayload, payloadSize, (lwrMacCb.phySlotIndCntr-1));
+#else
+   LWR_MAC_FREE(rarPayload, payloadSize);
+#endif
    return ROK;
 }
 
@@ -3272,46 +3283,49 @@ uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, RarInfo *rarInfo,
  * @return ROK
  *
  * ********************************************************************/
-uint8_t fillDlMsgTxDataReq(fapi_tx_pdu_desc_t *pduDesc, DlMsgInfo *dlMsgInfo,
-      uint16_t pduIndex)
+uint8_t fillDlMsgTxDataReq(fapi_tx_pdu_desc_t *pduDesc, uint16_t pduIndex, DlMsgInfo *dlMsgInfo, PdschCfg pdschCfg)
 {
-   uint32_t pduLen = 0;
-   uint8_t *dedMsgTxDataValue = NULLP;
+   uint16_t payloadSize;
+   uint8_t  *dlMsgPayload = NULLP;
+   fapi_api_queue_elem_t *payloadElem = NULLP;
+#ifdef INTEL_WLS_MEM
+   void * wlsHdlr = NULLP;
+#endif
 
    pduDesc[pduIndex].pdu_index = pduIndex;
    pduDesc[pduIndex].num_tlvs = 1;
 
    /* fill the TLV */
-   /* as of now, memory is allocated from SSI, later WLS memory needs to be taken */
+   payloadSize = pdschCfg.codeword[0].tbSize;
    pduDesc[pduIndex].tlvs[0].tl.tag = FAPI_TX_DATA_PTR_TO_PAYLOAD_64;
-   pduDesc[pduIndex].tlvs[0].tl.length = dlMsgInfo->dlMsgPduLen;
-   LWR_MAC_ALLOC(dedMsgTxDataValue, dlMsgInfo->dlMsgPduLen);
-   if(dedMsgTxDataValue == NULLP)
+   pduDesc[pduIndex].tlvs[0].tl.length = payloadSize;
+   LWR_MAC_ALLOC(dlMsgPayload, payloadSize);
+   if(dlMsgPayload == NULLP)
    {
       return RFAILED;
    }
-   memcpy(dedMsgTxDataValue, dlMsgInfo->dlMsgPdu, dlMsgInfo->dlMsgPduLen);
-   pduDesc[pduIndex].tlvs[0].value = dedMsgTxDataValue;
+   payloadElem = (fapi_api_queue_elem_t *)dlMsgPayload;
+   FILL_FAPI_LIST_ELEM(payloadElem, NULLP, FAPI_VENDOR_MSG_PHY_ZBC_BLOCK_REQ, 1, dlMsgInfo->dlMsgPduLen);
+   memcpy(dlMsgPayload + TX_PAYLOAD_HDR_LEN, dlMsgInfo->dlMsgPdu, dlMsgInfo->dlMsgPduLen);
 
-   /* The total length of the PDU description and PDU data */
-   pduLen += 8; /* size of PDU length 2 bytes, PDU index 2 bytes, numTLV 4 bytes */
-   pduLen += sizeof(fapi_uint8_ptr_tlv_t); /* only 1 TLV is present */
-   pduDesc[pduIndex].pdu_length = pduLen;
-
-   /* TODO: The pointer value which was stored, needs to be free-ed at PHY *
-    * But since we did not implement WLS, this has to be done here
-    */
-#ifdef INTEL_WLS_MEM   
-   addWlsBlockToFree(dedMsgTxDataValue, dlMsgInfo->dlMsgPduLen, (lwrMacCb.phySlotIndCntr-1));
+#ifdef INTEL_WLS_MEM
+   mtGetWlsHdl(&wlsHdlr);
+   pduDesc[pduIndex].tlvs[0].value = WLS_VA2PA(wlsHdlr, dlMsgPayload);
 #else
-   LWR_MAC_FREE(dedMsgTxDataValue, dlMsgInfo->dlMsgPduLen);
+   pduDesc[pduIndex].tlvs[0].value = dlMsgPayload;
 #endif
+   pduDesc[pduIndex].pdu_length = payloadSize;
 
+#ifdef INTEL_WLS_MEM
+   addWlsBlockToFree(dlMsgPayload, payloadSize, (lwrMacCb.phySlotIndCntr-1));
+#else
+   LWR_MAC_FREE(dlMsgPayload, payloadSize);
+#endif
    return ROK;
 }
 
-
 #endif /* FAPI */
+
 /*******************************************************************
  *
  * @brief Sends DL TTI Request to PHY
@@ -3487,9 +3501,11 @@ uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo)
            DU_LOG("\nDEBUG  -->  LWR_MAC: Sending DL TTI Request");
 #endif     
            /* Intel L1 expects UL_TTI.request following DL_TTI.request */
-            fillUlTtiReq(currTimingInfo, headerElem);
+           msgHeader->num_msg++;
+            fillUlTtiReq(currTimingInfo, dlTtiElem);
            /* send Tx-DATA req message */
-           sendTxDataReq(dlTtiReqTimingInfo, &currDlSlot->dlInfo, headerElem);
+           msgHeader->num_msg++;
+           sendTxDataReq(dlTtiReqTimingInfo, &currDlSlot->dlInfo, dlTtiElem->p_next);
             LwrMacSendToL1(headerElem);
         }
         else
@@ -3499,7 +3515,8 @@ uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo)
 #endif     
 
            /* Intel L1 expects UL_TTI.request following DL_TTI.request */
-           fillUlTtiReq(currTimingInfo, headerElem);
+           msgHeader->num_msg++;
+           fillUlTtiReq(currTimingInfo, dlTtiElem);
             LwrMacSendToL1(headerElem);
         }
         memset(currDlSlot, 0, sizeof(MacDlSlot));
@@ -3537,14 +3554,13 @@ uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo, p_fapi_api_queue_elem_t headerElem)
+uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo, p_fapi_api_queue_elem_t prevElem)
 {
 #ifdef INTEL_FAPI
    uint8_t nPdu = 0;
    uint16_t cellIdx;
    uint16_t pduIndex = 0;
    fapi_tx_data_req_t       *txDataReq =NULLP;
-   fapi_msg_header_t        *msgHeader =NULLP;
    p_fapi_api_queue_elem_t  txDataElem = 0;
 
    GET_CELL_IDX(currTimingInfo.cellId, cellIdx);
@@ -3570,14 +3586,15 @@ uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo, p_fapi_a
       txDataReq->slot = currTimingInfo.slot;
       if(dlInfo->brdcstAlloc.sib1Trans)
       {
-        fillSib1TxDataReq(txDataReq->pdu_desc,
-              &macCb.macCell[cellIdx]->macCellCfg, pduIndex);
+        fillSib1TxDataReq(txDataReq->pdu_desc, pduIndex, &macCb.macCell[cellIdx]->macCellCfg, \
+           dlInfo->brdcstAlloc.sib1Alloc.sib1PdschCfg);
         pduIndex++;
         txDataReq->num_pdus++;
       }
       if(dlInfo->rarAlloc != NULLP)
       {
-        fillRarTxDataReq(txDataReq->pdu_desc, &dlInfo->rarAlloc->rarInfo, pduIndex);
+        fillRarTxDataReq(txDataReq->pdu_desc, pduIndex, &dlInfo->rarAlloc->rarInfo,\
+           dlInfo->rarAlloc->rarPdschCfg);
         pduIndex++;
         txDataReq->num_pdus++;
 
@@ -3586,8 +3603,8 @@ uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo, p_fapi_a
       }
       if(dlInfo->dlMsgAlloc != NULLP)
       {
-         fillDlMsgTxDataReq(txDataReq->pdu_desc, \
-           &dlInfo->dlMsgAlloc->dlMsgInfo, pduIndex);
+         fillDlMsgTxDataReq(txDataReq->pdu_desc, pduIndex, &dlInfo->dlMsgAlloc->dlMsgInfo,\
+           dlInfo->dlMsgAlloc->dlMsgPdschCfg);
          pduIndex++;
          txDataReq->num_pdus++;
 
@@ -3600,9 +3617,7 @@ uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo, p_fapi_a
 
       /* Fill message header */
       DU_LOG("\nDEBUG  -->  LWR_MAC: Sending TX DATA Request");
-      msgHeader = (fapi_msg_header_t *)(headerElem + 1);
-      msgHeader->num_msg++;
-      headerElem->p_next->p_next->p_next = txDataElem;
+      prevElem->p_next = txDataElem;
    }
 #endif
    return ROK;
@@ -3888,7 +3903,7 @@ void fillPucchPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg,\
  *         RFAILED - failure
  *
  ******************************************************************/
-uint16_t fillUlTtiReq(SlotIndInfo currTimingInfo, p_fapi_api_queue_elem_t headerElem)
+uint16_t fillUlTtiReq(SlotIndInfo currTimingInfo, p_fapi_api_queue_elem_t prevElem)
 {
 #ifdef INTEL_FAPI
    uint16_t   cellIdx =0;
@@ -3897,7 +3912,6 @@ uint16_t fillUlTtiReq(SlotIndInfo currTimingInfo, p_fapi_api_queue_elem_t header
    MacUlSlot *currUlSlot = NULLP;
    MacCellCfg macCellCfg;
    fapi_ul_tti_req_t *ulTtiReq = NULLP;
-   fapi_msg_header_t *msgHeader = NULLP;
    p_fapi_api_queue_elem_t ulTtiElem;
 
    if(lwrMacCb.phyState == PHY_STATE_RUNNING)
@@ -3947,11 +3961,7 @@ uint16_t fillUlTtiReq(SlotIndInfo currTimingInfo, p_fapi_api_queue_elem_t header
 #ifdef ODU_SLOT_IND_DEBUG_LOG
          DU_LOG("\nDEBUG  -->  LWR_MAC: Sending UL TTI Request");
 #endif
-
-        /* Fill message header */
-         msgHeader = (fapi_msg_header_t *)(headerElem + 1); 
-         msgHeader->num_msg++;
-        headerElem->p_next->p_next = ulTtiElem;
+        prevElem->p_next = ulTtiElem;
 
         memset(currUlSlot, 0, sizeof(MacUlSlot));
         return ROK;
index 54a6643..ebcd761 100644 (file)
@@ -180,6 +180,9 @@ uint8_t procStopInd()
  * ****************************************************************/
 uint8_t procRachInd(fapi_rach_indication_t  *fapiRachInd)
 {
+/* TODO : Remove the following #ifndef TEMP_INTG_FLAG, when testing 
+ * RACH.indication in radio mode integration */
+#ifndef TEMP_INTG_FLAG
    Pst          pst;
    uint8_t      pduIdx;
    uint8_t      prmbleIdx;
@@ -217,7 +220,9 @@ uint8_t procRachInd(fapi_rach_indication_t  *fapiRachInd)
    /* Fill post and sent to MAC */
    FILL_PST_LWR_MAC_TO_MAC(pst, EVENT_RACH_IND_TO_MAC);
    return (*sendRachIndOpts[pst.selector])(&pst, rachInd);
-
+#else
+   return ROK;
+#endif
 }/* handleRachInd */
 
 /*******************************************************************
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"
 
index 5de50fd..f68015d 100644 (file)
@@ -412,15 +412,12 @@ uint16_t schGetPeriodicityInMsec(DlUlTxPeriodicity tddPeriod)
 void schInitTddSlotCfg(SchCellCb *cell, SchCellCfg *schCellCfg)
 {
    uint16_t periodicityInMicroSec = 0;
-   uint32_t slotBitPos, symbBitPos, bitMask;
    int8_t slotIdx, symbIdx;
 
    periodicityInMicroSec = schGetPeriodicityInMsec(schCellCfg->tddCfg.tddPeriod);
    cell->numSlotsInPeriodicity = (periodicityInMicroSec * pow(2, schCellCfg->numerology))/1000;
-cell->slotFrmtBitMap = 0;
+   cell->slotFrmtBitMap = 0;
    cell->symbFrmtBitMap = 0;
-   slotBitPos = (cell->numSlotsInPeriodicity*2)-1; /* considering 2 bits to represent a slot */
-   symbBitPos = (MAX_SYMB_PER_SLOT*2)-1; /* considering 2 bits to represent a symbol */
    for(slotIdx = cell->numSlotsInPeriodicity-1; slotIdx >= 0; slotIdx--)
    {
       symbIdx = 0;
@@ -433,23 +430,13 @@ cell->slotFrmtBitMap = 0;
             case DL_SLOT:
             {
                /*BitMap to be set to 00 */
-               bitMask = 1<<slotBitPos;
-               cell->slotFrmtBitMap = (cell->slotFrmtBitMap & ~(bitMask)) | ((0<<slotBitPos) & bitMask);
-               slotBitPos--;
-               bitMask = 1<<slotBitPos;
-               cell->slotFrmtBitMap = (cell->slotFrmtBitMap & ~(bitMask)) | ((0<<slotBitPos) & bitMask);
-               slotBitPos--;
+               cell->slotFrmtBitMap = (cell->slotFrmtBitMap<<2);
                break;
             }
             case UL_SLOT:
             {
                /*BitMap to be set to 01 */
-               bitMask = 1<<slotBitPos;
-               cell->slotFrmtBitMap = (cell->slotFrmtBitMap & ~(bitMask)) | ((0<<slotBitPos) & bitMask);
-               slotBitPos--;
-               bitMask = 1<<slotBitPos;
-               cell->slotFrmtBitMap = (cell->slotFrmtBitMap & ~(bitMask)) | ((1<<slotBitPos) & bitMask);
-               slotBitPos--;
+               cell->slotFrmtBitMap = ((cell->slotFrmtBitMap<<2) | (UL_SLOT));
                break;
             }
             default:
@@ -458,12 +445,8 @@ cell->slotFrmtBitMap = 0;
          continue;
       }
       /* slot config is flexible. First set slotBitMap to 10 */
-      bitMask = 1<<slotBitPos;
-      cell->slotFrmtBitMap = (cell->slotFrmtBitMap & ~(bitMask)) | ((1<<slotBitPos) & bitMask);
-      slotBitPos--;
-      bitMask = 1<<slotBitPos;
-      cell->slotFrmtBitMap = (cell->slotFrmtBitMap & ~(bitMask)) | ((0<<slotBitPos) & bitMask);
-      slotBitPos--;
+      cell->slotFrmtBitMap = ((cell->slotFrmtBitMap<<2) | (FLEXI_SLOT));
+
       /* Now set symbol bitmap */ 
       for(symbIdx = MAX_SYMB_PER_SLOT-1; symbIdx >= 0; symbIdx--)
       {
@@ -472,34 +455,19 @@ cell->slotFrmtBitMap = 0;
             case DL_SLOT:
             {
                /*symbol BitMap to be set to 00 */
-               bitMask = 1<<symbBitPos;
-               cell->symbFrmtBitMap = (cell->symbFrmtBitMap & ~(bitMask)) | ((0<<symbBitPos) & bitMask);
-               symbBitPos--;
-               bitMask = 1<<symbBitPos;
-               cell->symbFrmtBitMap = (cell->symbFrmtBitMap & ~(bitMask)) | ((0<<symbBitPos) & bitMask);
-               symbBitPos--;
+               cell->symbFrmtBitMap = (cell->symbFrmtBitMap<<2);
                break;
             }
             case UL_SLOT:
             {
                /*symbol BitMap to be set to 01 */
-               bitMask = 1<<symbBitPos;
-               cell->symbFrmtBitMap = (cell->symbFrmtBitMap & ~(bitMask)) | ((0<<symbBitPos) & bitMask);
-               symbBitPos--;
-               bitMask = 1<<symbBitPos;
-               cell->symbFrmtBitMap = (cell->symbFrmtBitMap & ~(bitMask)) | ((1<<symbBitPos) & bitMask);
-               symbBitPos--;
+               cell->symbFrmtBitMap = ((cell->symbFrmtBitMap<<2) | (UL_SLOT));
                break;
             }
             case FLEXI_SLOT:
             {
                /*symbol BitMap to be set to 10 */
-               bitMask = 1<<symbBitPos;
-               cell->symbFrmtBitMap = (cell->symbFrmtBitMap & ~(bitMask)) | ((1<<symbBitPos) & bitMask);
-               symbBitPos--;
-               bitMask = 1<<symbBitPos;
-               cell->symbFrmtBitMap = (cell->symbFrmtBitMap & ~(bitMask)) | ((0<<symbBitPos) & bitMask);
-               symbBitPos--;
+               cell->symbFrmtBitMap = ((cell->symbFrmtBitMap<<2) | (FLEXI_SLOT));
                break;
             }
             default:
@@ -507,7 +475,6 @@ cell->slotFrmtBitMap = 0;
          }
       }
    }
-
 }
 #endif
 
@@ -719,7 +686,7 @@ void fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots, SchSib1Cfg
    uint8_t slotIndex = 0;
    uint8_t FreqDomainResource[6] = {0};
    uint16_t tbSize = 0;
-   uint8_t numPdschSymbols = 12; /* considering pdsch region from 2 to 13 */
+   uint8_t numPdschSymbols = 11; /* considering pdsch region from symbols 3 to 13 */
    uint8_t ssbIdx = 0;
 
    PdcchCfg *pdcch = &(sib1SchCfg->sib1PdcchCfg);
@@ -814,14 +781,14 @@ void fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots, SchSib1Cfg
       pdsch->codeword[cwCount].mcsIndex = sib1SchCfg->sib1Mcs;
       pdsch->codeword[cwCount].mcsTable = 0; /* notqam256 */
       pdsch->codeword[cwCount].rvIndex = 0;
-      tbSize = schCalcTbSize(sib1SchCfg->sib1PduLen);
+      tbSize = schCalcTbSize(sib1SchCfg->sib1PduLen + TX_PAYLOAD_HDR_LEN);
       pdsch->codeword[cwCount].tbSize = tbSize;
    }
    pdsch->dataScramblingId                   = pci;
    pdsch->numLayers                          = 1;
    pdsch->transmissionScheme                 = 0;
    pdsch->refPoint                           = 0;
-   pdsch->dmrs.dlDmrsSymbPos                 = 2;
+   pdsch->dmrs.dlDmrsSymbPos                 = 4; /* Bitmap value 00000000000100 i.e. using 3rd symbol for PDSCH DMRS */
    pdsch->dmrs.dmrsConfigType                = 0; /* type-1 */
    pdsch->dmrs.dlDmrsScramblingId            = pci;
    pdsch->dmrs.scid                          = 0;
@@ -837,7 +804,8 @@ void fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots, SchSib1Cfg
    pdsch->pdschFreqAlloc.freqAlloc.numPrb    = schCalcNumPrb(tbSize,sib1SchCfg->sib1Mcs,numPdschSymbols);
    pdsch->pdschFreqAlloc.vrbPrbMapping       = 0; /* non-interleaved */
    pdsch->pdschTimeAlloc.rowIndex            = 1;
-   pdsch->pdschTimeAlloc.timeAlloc.startSymb = 2; /* spec-38.214, Table 5.1.2.1-1 */
+   /* This is Intel's requirement. PDSCH should start after PDSCH DRMS symbol */
+   pdsch->pdschTimeAlloc.timeAlloc.startSymb = 3; /* spec-38.214, Table 5.1.2.1-1 */
    pdsch->pdschTimeAlloc.timeAlloc.numSymb   = numPdschSymbols;
    pdsch->beamPdschInfo.numPrgs              = 1;
    pdsch->beamPdschInfo.prgSize              = 1;
@@ -921,6 +889,9 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo)
    uint8_t  lcId = 0;
    uint16_t ueIdx = 0;
    uint16_t slot;
+#ifdef NR_TDD
+   uint16_t slotIdx = 0;
+#endif
    SchUeCb *ueCb = NULLP;
    SchCellCb *cell = NULLP;
    SchDlSlotInfo *schDlSlotInfo = NULLP;
@@ -946,6 +917,18 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo)
    }
 
    slot = (cell->slotInfo.slot + SCHED_DELTA + PHY_DELTA_DL + BO_DELTA) % cell->numSlots;
+#ifdef NR_TDD
+   while(schGetSlotSymbFrmt(cell->slotFrmtBitMap, slot) != DL_SLOT)
+   {
+      slot = (slot + 1)%cell->numSlots;
+      slotIdx++;
+      if(slotIdx==cell->numSlots)
+      {
+          DU_LOG("\nERROR  -->  SCH : No DL Slot available");
+          return RFAILED;
+      }
+   }
+#endif
    schDlSlotInfo = cell->schDlSlotInfo[slot];
 
    SCH_ALLOC(schDlSlotInfo->dlMsgInfo, sizeof(DlMsgInfo));
index 4ca3bc6..9bfc6ed 100644 (file)
@@ -46,8 +46,8 @@
 #define SI_RNTI 0xFFFF
 #define P_RNTI  0xFFFE
 #define DMRS_MAP_TYPE_A 1
-#define NUM_DMRS_SYMBOLS 12
-#define DMRS_ADDITIONAL_POS 2
+#define NUM_DMRS_SYMBOLS 1
+#define DMRS_ADDITIONAL_POS 0
 #define SCH_DEFAULT_K1 1
 #define SCH_TQ_SIZE 10
 
index d92d513..e064b83 100644 (file)
@@ -181,6 +181,7 @@ void schPrachResAlloc(SchCellCb *cell, UlSchedInfo *ulSchedInfo, SlotIndInfo pra
    uint8_t  prachOcas = 0;
    uint8_t  dataType = 0;
    uint8_t  idx = 0;
+   uint8_t  subFrame = 0;
    SchUlSlotInfo *schUlSlotInfo = NULLP;
 
    puschScs      = cell->cellCfg.schInitialUlBwp.bwp.scs;
@@ -194,45 +195,59 @@ void schPrachResAlloc(SchCellCb *cell, UlSchedInfo *ulSchedInfo, SlotIndInfo pra
 
    if((prachOccasionTimingInfo.sfn%x) == y)
    {
+#ifdef NR_TDD
+      subFrame = prachOccasionTimingInfo.slot/2;
+#else
+      subFrame = prachOccasionTimingInfo.slot;
+#endif
       /* check for subFrame number */
-      if ((1 << prachOccasionTimingInfo.slot) & prachSubframe)
+      if ((1 << subFrame) & prachSubframe)
       {
-        /* prach ocassion present in this subframe */
-
-        prachFormat      = prachCfgIdxTable[prachCfgIdx][0];
-        prachStartSymbol = prachCfgIdxTable[prachCfgIdx][4];
-        prachOcas        = prachCfgIdxTable[prachCfgIdx][6];
-
-        /* freq domain resource determination for RACH*/
-        freqStart = cell->cellCfg.schRachCfg.msg1FreqStart;
-        /* numRa determined as 𝑛 belonging {0,1,.., M − 1}, 
-         * where M is given by msg1Fdm */
-        numRa = (cell->cellCfg.schRachCfg.msg1Fdm - 1);
-        for(idx=0; idx<MAX_RACH_NUM_RB_IDX; idx++)
-        {
-           if(numRbForPrachTable[idx][0] == cell->cellCfg.schRachCfg.rootSeqLen)
-           {
-              if(numRbForPrachTable[idx][1] == cell->cellCfg.schRachCfg.prachSubcSpacing)
-              {
-                 if(numRbForPrachTable[idx][2] == puschScs)
-                 {
-                    break;
-                 }
-              }
-           }
-        }
-        numPrachRb = numRbForPrachTable[idx][3];
-        dataType |= SCH_DATATYPE_PRACH;
-        /* Considering first slot in the frame for PRACH */
-        idx = 0;
-        schUlSlotInfo->assignedPrb[idx] = freqStart+numPrachRb;
+         /* prach ocassion present in this subframe */
+#ifdef NR_TDD
+         if(UL_SLOT != schGetSlotSymbFrmt(prachOccasionTimingInfo.slot, cell->slotFrmtBitMap))
+         {
+            DU_LOG("\nERROR  --> SCH : PrachCfgIdx %d doesn't support UL slot", prachCfgIdx);
+         }
+         else
+#endif
+         {
+            prachFormat      = prachCfgIdxTable[prachCfgIdx][0];
+            prachStartSymbol = prachCfgIdxTable[prachCfgIdx][4];
+            prachOcas        = prachCfgIdxTable[prachCfgIdx][6];
+
+            /* freq domain resource determination for RACH*/
+            freqStart = cell->cellCfg.schRachCfg.msg1FreqStart;
+            /* numRa determined as 𝑛 belonging {0,1,.., M − 1}, 
+             * where M is given by msg1Fdm */
+            numRa = (cell->cellCfg.schRachCfg.msg1Fdm - 1);
+            for(idx=0; idx<MAX_RACH_NUM_RB_IDX; idx++)
+            {
+               if(numRbForPrachTable[idx][0] == cell->cellCfg.schRachCfg.rootSeqLen)
+               {
+                  if(numRbForPrachTable[idx][1] == cell->cellCfg.schRachCfg.prachSubcSpacing)
+                  {
+                     if(numRbForPrachTable[idx][2] == puschScs)
+                     {
+                        break;
+                     }
+                  }
+               }
+            }
+            numPrachRb = numRbForPrachTable[idx][3];
+            dataType |= SCH_DATATYPE_PRACH;
+            /* Considering first slot in the frame for PRACH */
+            idx = 0;
+            schUlSlotInfo->assignedPrb[idx] = freqStart+numPrachRb;
+         }
+         ulSchedInfo->dataType = dataType;
+         /* prach info */
+         ulSchedInfo->prachSchInfo.numPrachOcas   = prachOcas;
+         ulSchedInfo->prachSchInfo.prachFormat    = prachFormat;
+         ulSchedInfo->prachSchInfo.numRa          = numRa;
+         ulSchedInfo->prachSchInfo.prachStartSymb = prachStartSymbol;
+         DU_LOG("\nINFO  --> SCH : RACH occassion set for slot %d", prachOccasionTimingInfo.slot);
       }
-      ulSchedInfo->dataType = dataType;
-      /* prach info */
-      ulSchedInfo->prachSchInfo.numPrachOcas   = prachOcas;
-      ulSchedInfo->prachSchInfo.prachFormat    = prachFormat;
-      ulSchedInfo->prachSchInfo.numRa          = numRa;
-      ulSchedInfo->prachSchInfo.prachStartSymb = prachStartSymbol;
    }
 }
 
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.
 */
index 2681a0d..d3ea542 100644 (file)
@@ -106,14 +106,10 @@ void createSchRaCb(uint16_t tcrnti, Inst schInst)
  *  @return  void
  **/
 uint8_t schAllocMsg3Pusch(Inst schInst, uint16_t slot, uint16_t crnti, \
-   uint16_t *msg3StartRb, uint8_t *msg3NumRb)
+   uint16_t *msg3StartRb, uint8_t *msg3NumRb, uint16_t msg3SlotAlloc)
 {
    SchCellCb      *cell         = NULLP;
    SchUlSlotInfo  *schUlSlotInfo    = NULLP;
-   uint8_t    puschMu       = 0;
-   uint8_t    msg3SlotAlloc = 0;
-   uint8_t    delta         = 0;
-   uint8_t    k2            = 0; 
    uint8_t    startSymb     = 0;
    uint8_t    symbLen       = 0; 
    uint8_t    startRb       = 0;
@@ -124,16 +120,9 @@ uint8_t schAllocMsg3Pusch(Inst schInst, uint16_t slot, uint16_t crnti, \
    uint16_t   tbSize         = 0;
 
    cell = schCb[schInst].cells[schInst];
-   //  puschMu = cell->cellCfg.puschMu;
-   delta = puschDeltaTable[puschMu];
-   k2 = cell->cellCfg.schInitialUlBwp.puschCommon.k2;
    startSymb = cell->cellCfg.schInitialUlBwp.puschCommon.startSymbol;
    symbLen = cell->cellCfg.schInitialUlBwp.puschCommon.lengthSymbol;
 
-   /* Slot allocation for msg3 based on 38.214 section 6.1.2.1 */
-   msg3SlotAlloc = slot + k2 + delta;
-   msg3SlotAlloc = msg3SlotAlloc % cell->numSlots; 
-
    startRb = cell->schUlSlotInfo[msg3SlotAlloc]->puschCurrentPrb;
    tbSize = schCalcTbSize(8); /* 6 bytes msg3  and 2 bytes header */
    numRb = schCalcNumPrb(tbSize, mcs, numPdschSymbols);
@@ -157,7 +146,7 @@ uint8_t schAllocMsg3Pusch(Inst schInst, uint16_t slot, uint16_t crnti, \
    }
    tbSize = 0;  /* since nPrb has been incremented, recalculating tbSize */
    tbSize = schCalcTbSizeFromNPrb(numRb, mcs, numPdschSymbols);
-
+   tbSize = tbSize/8;/*bits to byte conversion*/
    schUlSlotInfo->schPuschInfo->crnti             = crnti;
    schUlSlotInfo->schPuschInfo->harqProcId        = SCH_HARQ_PROC_ID;
    schUlSlotInfo->schPuschInfo->resAllocType      = SCH_ALLOC_TYPE_1;
@@ -204,9 +193,43 @@ uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst)
    uint16_t msg3StartRb;
    uint8_t  msg3NumRb;
    uint8_t  ret = ROK;
-
+   uint8_t delta = 0;
+   uint8_t k2 = 0; 
+   uint8_t puschMu = 0;
+   uint16_t msg3Slot = 0;
+#ifdef NR_TDD
+   uint16_t slotIdx = 0;
+#endif
+
+   //puschMu = cell->cellCfg.puschMu;
+   delta = puschDeltaTable[puschMu];
+   k2 = cell->cellCfg.schInitialUlBwp.puschCommon.k2;
    /* RAR will sent with a delay of RAR_DELAY */
    rarSlot = (rachInd->timingInfo.slot+RAR_DELAY+PHY_DELTA_DL)%cell->numSlots;
+#ifdef NR_TDD
+   for(slotIdx=0; slotIdx<cell->numSlots;slotIdx++)
+   {
+      /* Slot allocation for msg3 based on 38.214 section 6.1.2.1 */
+      msg3Slot = (rarSlot+delta+k2)%cell->numSlots;
+
+      if((schGetSlotSymbFrmt(rarSlot, cell->slotFrmtBitMap) != DL_SLOT) &&\
+         (schGetSlotSymbFrmt(msg3Slot, cell->slotFrmtBitMap) != UL_SLOT))
+      {
+         rarSlot = (rarSlot + 1) % cell->numSlots;
+         continue;
+      }
+      break;
+   }
+   if(slotIdx>=cell->numSlots)
+   {
+       DU_LOG("\nERROR  -->  SCH : NO Slot for Msg2 with Msg3 Grant\n");
+       return RFAILED;
+   }
+#else
+   /* Slot allocation for msg3 based on 38.214 section 6.1.2.1 */
+   msg3Slot = rarSlot + k2 + delta;
+   msg3Slot = msg3Slot % cell->numSlots; 
+#endif
 
    SchDlSlotInfo *schDlSlotInfo = cell->schDlSlotInfo[rarSlot]; /* RAR will sent in the next slot */
 
@@ -227,7 +250,7 @@ uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst)
    createSchRaCb(rachInd->crnti,schInst);
 
    /* allocate resources for msg3 */
-   ret = schAllocMsg3Pusch(schInst, rarSlot, rachInd->crnti, &msg3StartRb, &msg3NumRb);
+   ret = schAllocMsg3Pusch(schInst, rarSlot, rachInd->crnti, &msg3StartRb, &msg3NumRb, msg3Slot);
    if(ret == ROK)
    {
       /* fill RAR info */
index 4cb93c6..e1809fa 100644 (file)
@@ -133,6 +133,288 @@ uint16_t numRbForPrachTable[MAX_RACH_NUM_RB_IDX][5] = {
 {   139,  120,   120,  12,  2    }, /* index 15 */
 };
 
+#ifdef NR_TDD
+
+/* prach config index Table 6.3.3.2-3 spec 38.211 
+ * PRACH format given as follows:
+ * 0 = 0
+ * 1 = 1
+ * 2 = 2
+ * 3 = 3
+ * 4 = A1
+ * 5 = A2
+ * 6 = A3
+ * 7 = B1
+ * 8 = B4
+ * 9 = C0
+ * 10 = C2
+ * 11 = A1/B1
+ * 12 = A2/B2
+ * 13 = A3/B3 
+ * Subframe num is represented considering 0-9 bits and
+ * value 1 corresponds to the subframe that is valid 
+ */
+
+uint16_t prachCfgIdxTable[MAX_PRACH_CONFIG_IDX][8] = {
+{ 0, 16,  1,  512,  0,  0,  0,  0 }, /* index 0   */
+{ 0,  8,  1,  512,  0,  0,  0,  0 }, /* index 1   */
+{ 0,  4,  1,  512,  0,  0,  0,  0 }, /* index 2   */
+{ 0,  2,  0,  512,  0,  0,  0,  0 }, /* index 3   */
+{ 0,  2,  1,  512,  0,  0,  0,  0 }, /* index 4   */
+{ 0,  2,  0,   16,  0,  0,  0,  0 }, /* index 5   */
+{ 0,  2,  1,   16,  0,  0,  0,  0 }, /* index 6   */
+{ 0,  1,  0,  512,  0,  0,  0,  0 }, /* index 7   */
+{ 0,  1,  0,  256,  0,  0,  0,  0 }, /* index 8   */
+{ 0,  1,  0,  128,  0,  0,  0,  0 }, /* index 9   */
+{ 0,  1,  0,   64,  0,  0,  0,  0 }, /* index 10  */
+{ 0,  1,  0,   32,  0,  0,  0,  0 }, /* index 11  */
+{ 0,  1,  0,   16,  0,  0,  0,  0 }, /* index 12  */
+{ 0,  1,  0,    8,  0,  0,  0,  0 }, /* index 13  */
+{ 0,  1,  0,    4,  0,  0,  0,  0 }, /* index 14  */
+{ 0,  1,  0,   66,  0,  0,  0,  0 }, /* index 15  */
+{ 0,  1,  0,   66,  7,  0,  0,  0 }, /* index 16  */
+{ 0,  1,  0,  528,  0,  0,  0,  0 }, /* index 17  */
+{ 0,  1,  0,  264,  0,  0,  0,  0 }, /* index 18  */
+{ 0,  1,  0,  132,  0,  0,  0,  0 }, /* index 19  */
+{ 0,  1,  0,  768,  0,  0,  0,  0 }, /* index 20  */
+{ 0,  1,  0,  784,  0,  0,  0,  0 }, /* index 21  */
+{ 0,  1,  0,  536,  0,  0,  0,  0 }, /* index 22  */
+{ 0,  1,  0,  896,  0,  0,  0,  0 }, /* index 23  */
+{ 0,  1,  0,  792,  0,  0,  0,  0 }, /* index 24  */
+{ 0,  1,  0,  960,  0,  0,  0,  0 }, /* index 25  */
+{ 0,  1,  0,  594,  0,  0,  0,  0 }, /* index 26  */
+{ 0,  1,  0,  682,  0,  0,  0,  0 }, /* index 27  */
+{ 1, 16,  1,  128,  0,  0,  0,  0 }, /* index 28  */
+{ 1,  8,  1,  128,  0,  0,  0,  0 }, /* index 29  */
+{ 1,  4,  1,  128,  0,  0,  0,  0 }, /* index 30  */
+{ 1,  2,  0,  128,  0,  0,  0,  0 }, /* index 31  */
+{ 1,  2,  1,  128,  0,  0,  0,  0 }, /* index 32  */
+{ 1,  1,  0,  128,  0,  0,  0,  0 }, /* index 33  */
+{ 2, 16,  1,   64,  0,  0,  0,  0 }, /* index 34  */
+{ 2,  8,  1,   64,  0,  0,  0,  0 }, /* index 35  */
+{ 2,  4,  1,   64,  0,  0,  0,  0 }, /* index 36  */
+{ 2,  2,  0,   64,  7,  0,  0,  0 }, /* index 37  */
+{ 2,  2,  1,   64,  7,  0,  0,  0 }, /* index 38  */
+{ 2,  1,  0,   64,  7,  0,  0,  0 }, /* index 39  */
+{ 3, 16,  1,  512,  0,  0,  0,  0 }, /* index 40  */
+{ 3,  8,  1,  512,  0,  0,  0,  0 }, /* index 41  */
+{ 3,  4,  1,  512,  0,  0,  0,  0 }, /* index 42  */
+{ 3,  2,  0,  512,  0,  0,  0,  0 }, /* index 43  */
+{ 3,  2,  1,  512,  0,  0,  0,  0 }, /* index 44  */
+{ 3,  2,  0,   16,  0,  0,  0,  0 }, /* index 45  */
+{ 3,  2,  1,   16,  0,  0,  0,  0 }, /* index 46  */
+{ 3,  1,  0,  512,  0,  0,  0,  0 }, /* index 47  */
+{ 3,  1,  0,  256,  0,  0,  0,  0 }, /* index 48  */
+{ 3,  1,  0,  128,  0,  0,  0,  0 }, /* index 49  */
+{ 3,  1,  0,   64,  0,  0,  0,  0 }, /* index 50  */
+{ 3,  1,  0,   32,  0,  0,  0,  0 }, /* index 51  */
+{ 3,  1,  0,   16,  0,  0,  0,  0 }, /* index 52  */
+{ 3,  1,  0,    8,  0,  0,  0,  0 }, /* index 53  */
+{ 3,  1,  0,    4,  0,  0,  0,  0 }, /* index 54  */
+{ 3,  1,  0,   66,  0,  0,  0,  0 }, /* index 55  */
+{ 3,  1,  0,   66,  7,  0,  0,  0 }, /* index 56  */
+{ 3,  1,  0,  528,  0,  0,  0,  0 }, /* index 57  */
+{ 3,  1,  0,  264,  0,  0,  0,  0 }, /* index 58  */
+{ 3,  1,  0,  132,  0,  0,  0,  0 }, /* index 59  */
+{ 3,  1,  0,  768,  0,  0,  0,  0 }, /* index 60  */
+{ 3,  1,  0,  784,  0,  0,  0,  0 }, /* index 61  */
+{ 3,  1,  0,  536,  0,  0,  0,  0 }, /* index 62  */
+{ 3,  1,  0,  896,  0,  0,  0,  0 }, /* index 63  */
+{ 3,  1,  0,  792,  0,  0,  0,  0 }, /* index 64  */
+{ 3,  1,  0,  594,  0,  0,  0,  0 }, /* index 65  */
+{ 3,  1,  0,  682,  0,  0,  0,  0 }, /* index 66  */
+{ 4, 16,  1,  512,  0,  2,  6,  2 }, /* index 67  */
+{ 4,  8,  1,  512,  0,  2,  6,  2 }, /* index 68  */
+{ 4,  4,  1,  512,  0,  1,  6,  2 }, /* index 69  */
+{ 4,  2,  1,  512,  0,  1,  6,  2 }, /* index 70  */
+{ 4,  2,  1,  528,  7,  1,  3,  2 }, /* index 71  */
+{ 4,  2,  1,  640,  7,  1,  3,  2 }, /* index 72  */
+{ 4,  2,  1,  640,  0,  1,  6,  2 }, /* index 73  */
+{ 4,  2,  1,  768,  0,  2,  6,  2 }, /* index 74  */
+{ 4,  2,  1,  528,  0,  2,  6,  2 }, /* index 75  */
+{ 4,  2,  1,  924,  0,  1,  6,  2 }, /* index 76  */
+{ 4,  1,  0,  512,  0,  2,  6,  2 }, /* index 77  */
+{ 4,  1,  0,  512,  7,  1,  3,  2 }, /* index 78  */
+{ 4,  1,  0,  512,  0,  1,  6,  2 }, /* index 79  */
+{ 4,  1,  0,  768,  0,  2,  6,  2 }, /* index 80  */
+{ 4,  1,  0,  528,  0,  1,  6,  2 }, /* index 81  */
+{ 4,  1,  0,  640,  7,  1,  3,  2 }, /* index 82  */
+{ 4,  1,  0,  792,  0,  1,  6,  2 }, /* index 83  */
+{ 4,  1,  0,  792,  0,  2,  6,  2 }, /* index 84  */
+{ 4,  1,  0,  682,  0,  1,  6,  2 }, /* index 85  */
+{ 4,  1,  0, 1023,  7,  1,  3,  2 }, /* index 86  */
+{ 5, 16,  1,  512,  0,  2,  3,  4 }, /* index 87  */
+{ 5,  8,  1,  512,  0,  2,  3,  4 }, /* index 88  */
+{ 5,  4,  1,  512,  0,  1,  3,  4 }, /* index 89  */
+{ 5,  2,  1,  640,  0,  1,  3,  4 }, /* index 90  */
+{ 5,  2,  1,  768,  0,  2,  3,  4 }, /* index 91  */
+{ 5,  2,  1,  640,  9,  1,  1,  4 }, /* index 92  */
+{ 5,  2,  1,  528,  9,  1,  1,  4 }, /* index 93  */
+{ 5,  2,  1,  528,  0,  2,  3,  4 }, /* index 94  */
+{ 5,  2,  1,  924,  0,  1,  3,  4 }, /* index 95  */
+{ 5,  1,  0,    4,  0,  1,  3,  4 }, /* index 96  */
+{ 5,  1,  0,  128,  0,  1,  3,  4 }, /* index 97  */
+{ 5,  2,  1,  512,  0,  1,  3,  4 }, /* index 98  */
+{ 5,  1,  0,  512,  0,  2,  3,  4 }, /* index 99  */
+{ 5,  1,  0,  512,  9,  1,  1,  4 }, /* index 100  */
+{ 5,  1,  0,  512,  0,  1,  3,  4 }, /* index 101  */
+{ 5,  1,  0,  132,  0,  1,  3,  4 }, /* index 102  */
+{ 5,  1,  0,  768,  0,  2,  3,  4 }, /* index 103  */
+{ 5,  1,  0,  528,  0,  1,  3,  4 }, /* index 104  */
+{ 5,  1,  0,  640,  9,  1,  1,  4 }, /* index 105  */
+{ 5,  1,  0,  792,  0,  1,  3,  4 }, /* index 106  */
+{ 5,  1,  0,  792,  0,  2,  3,  4 }, /* index 107  */
+{ 5,  1,  0,  682,  0,  1,  3,  4 }, /* index 108  */
+{ 5,  1,  0, 1023,  9,  1,  1,  4 }, /* index 109  */
+{ 6, 16,  1,  512,  0,  2,  2,  6 }, /* index 110  */
+{ 6,  8,  1,  512,  0,  2,  2,  6 }, /* index 111  */
+{ 6,  4,  1,  512,  0,  1,  2,  6 }, /* index 112  */
+{ 6,  2,  1,  528,  7,  1,  1,  6 }, /* index 113  */
+{ 6,  2,  1,  640,  7,  1,  1,  6 }, /* index 114  */
+{ 6,  2,  1,  640,  0,  1,  2,  6 }, /* index 115  */
+{ 6,  2,  1,  528,  0,  2,  2,  6 }, /* index 116  */
+{ 6,  2,  1,  768,  0,  2,  2,  6 }, /* index 117  */
+{ 6,  2,  1,  924,  0,  1,  2,  6 }, /* index 118  */
+{ 6,  1,  0,    4,  0,  1,  2,  6 }, /* index 119  */
+{ 6,  1,  0,  128,  0,  1,  2,  6 }, /* index 120  */
+{ 6,  2,  1,  512,  0,  1,  2,  6 }, /* index 121  */
+{ 6,  1,  0,  512,  0,  2,  2,  6 }, /* index 122  */
+{ 6,  1,  0,  512,  7,  1,  1,  6 }, /* index 123  */
+{ 6,  1,  0,  512,  0,  1,  2,  6 }, /* index 124  */
+{ 6,  1,  0,  132,  0,  1,  2,  6 }, /* index 125  */
+{ 6,  1,  0,  768,  0,  2,  2,  6 }, /* index 126  */
+{ 6,  1,  0,  528,  0,  1,  2,  6 }, /* index 127  */
+{ 6,  1,  0,  640,  7,  1,  1,  6 }, /* index 128  */
+{ 6,  1,  0,  792,  0,  1,  2,  6 }, /* index 129  */
+{ 6,  1,  0,  792,  0,  2,  2,  6 }, /* index 130  */
+{ 6,  1,  0,  682,  0,  1,  2,  6 }, /* index 131  */
+{ 6,  1,  0, 1023,  7,  1,  1,  6 }, /* index 132  */
+{ 7,  4,  1,  512,  2,  1,  6,  2 }, /* index 133  */
+{ 7,  2,  1,  512,  2,  1,  6,  2 }, /* index 134  */
+{ 7,  2,  1,  640,  2,  1,  6,  2 }, /* index 135  */
+{ 7,  2,  1,  528,  8,  1,  3,  2 }, /* index 136  */
+{ 7,  2,  1,  528,  2,  2,  6,  2 }, /* index 137  */
+{ 7,  1,  0,  512,  2,  2,  6,  2 }, /* index 138  */
+{ 7,  1,  0,  512,  8,  1,  3,  2 }, /* index 139  */
+{ 7,  1,  0,  512,  2,  1,  6,  2 }, /* index 140  */
+{ 7,  1,  0,  768,  2,  2,  6,  2 }, /* index 141  */
+{ 7,  1,  0,  528,  2,  1,  6,  2 }, /* index 142  */
+{ 7,  1,  0,  640,  8,  1,  3,  2 }, /* index 143  */
+{ 7,  1,  0,  682,  2,  1,  6,  2 }, /* index 144  */
+{ 8, 16,  1,  512,  0,  2,  1, 12 }, /* index 145  */
+{ 8,  8,  1,  512,  0,  2,  1, 12 }, /* index 146  */
+{ 8,  4,  1,  512,  2,  1,  1, 12 }, /* index 147  */
+{ 8,  2,  1,  512,  0,  1,  1, 12 }, /* index 148  */
+{ 8,  2,  1,  512,  2,  1,  1, 12 }, /* index 149  */
+{ 8,  2,  1,  640,  2,  1,  1, 12 }, /* index 150  */
+{ 8,  2,  1,  528,  2,  1,  1, 12 }, /* index 151  */
+{ 8,  2,  1,  528,  0,  2,  1, 12 }, /* index 152  */
+{ 8,  2,  1,  768,  0,  2,  1, 12 }, /* index 153  */
+{ 8,  2,  1,  924,  0,  1,  1, 12 }, /* index 154  */
+{ 8,  1,  0,    2,  0,  1,  1, 12 }, /* index 155  */
+{ 8,  1,  0,    4,  0,  1,  1, 12 }, /* index 156  */
+{ 8,  1,  0,   16,  0,  1,  1, 12 }, /* index 157  */
+{ 8,  1,  0,  128,  0,  1,  1, 12 }, /* index 158  */
+{ 8,  1,  0,  512,  0,  1,  1, 12 }, /* index 159  */
+{ 8,  1,  0,  512,  2,  1,  1, 12 }, /* index 160  */
+{ 8,  1,  0,  512,  0,  2,  1, 12 }, /* index 161  */
+{ 8,  1,  0,  528,  2,  1,  1, 12 }, /* index 162  */
+{ 8,  1,  0,  640,  2,  1,  1, 12 }, /* index 163  */
+{ 8,  1,  0,  768,  0,  2,  1, 12 }, /* index 164  */
+{ 8,  1,  0,  792,  2,  1,  1, 12 }, /* index 165  */
+{ 8,  1,  0,  682,  2,  1,  1, 12 }, /* index 166  */
+{ 8,  1,  0, 1023,  0,  2,  1, 12 }, /* index 167  */
+{ 8,  1,  0, 1023,  2,  1,  1, 12 }, /* index 168  */
+{ 9, 16,  1,  512,  2,  2,  6,  2 }, /* index 169  */
+{ 9,  8,  1,  512,  2,  2,  6,  2 }, /* index 170  */
+{ 9,  4,  1,  512,  2,  1,  6,  2 }, /* index 171  */
+{ 9,  2,  1,  512,  2,  1,  6,  2 }, /* index 172  */
+{ 9,  2,  1,  768,  2,  2,  6,  2 }, /* index 173  */
+{ 9,  2,  1,  640,  2,  1,  6,  2 }, /* index 174  */
+{ 9,  2,  1,  640,  8,  1,  3,  2 }, /* index 175  */
+{ 9,  2,  1,  528,  8,  1,  3,  2 }, /* index 176  */
+{ 9,  2,  1,  528,  2,  2,  6,  2 }, /* index 177  */
+{ 9,  2,  1,  924,  2,  1,  6,  2 }, /* index 178  */
+{ 9,  1,  0,  512,  2,  2,  6,  2 }, /* index 179  */
+{ 9,  1,  0,  512,  8,  1,  3,  2 }, /* index 180  */
+{ 9,  1,  0,  512,  2,  1,  6,  2 }, /* index 181  */
+{ 9,  1,  0,  768,  2,  2,  6,  2 }, /* index 182  */
+{ 9,  1,  0,  528,  2,  1,  6,  2 }, /* index 183  */
+{ 9,  1,  0,  640,  8,  1,  3,  2 }, /* index 184  */
+{ 9,  1,  0,  792,  2,  1,  6,  2 }, /* index 185  */
+{ 9,  1,  0,  792,  2,  2,  6,  2 }, /* index 186  */
+{ 9,  1,  0,  682,  2,  1,  6,  2 }, /* index 187  */
+{ 9,  1,  0, 1023,  8,  1,  3,  2 }, /* index 188  */
+{10, 16,  1,  512,  2,  2,  2,  6 }, /* index 189  */
+{10,  8,  1,  512,  2,  2,  2,  6 }, /* index 190  */
+{10,  4,  1,  512,  2,  1,  2,  6 }, /* index 191  */
+{10,  2,  1,  512,  2,  1,  2,  6 }, /* index 192  */
+{10,  2,  1,  768,  2,  2,  2,  6 }, /* index 193  */
+{10,  2,  1,  640,  2,  1,  2,  6 }, /* index 194  */
+{10,  2,  1,  640,  8,  1,  1,  6 }, /* index 195  */
+{10,  2,  1,  528,  8,  1,  1,  6 }, /* index 196  */
+{10,  2,  1,  528,  2,  2,  2,  6 }, /* index 197  */
+{10,  2,  1,  924,  2,  1,  2,  6 }, /* index 198  */
+{10,  8,  1,  512,  8,  2,  1,  6 }, /* index 199  */
+{10,  4,  1,  512,  8,  1,  1,  6 }, /* index 200  */
+{10,  1,  0,  512,  2,  2,  2,  6 }, /* index 201  */
+{10,  1,  0,  512,  8,  1,  1,  6 }, /* index 202  */
+{10,  1,  0,  512,  2,  1,  2,  6 }, /* index 203  */
+{10,  1,  0,  768,  2,  2,  2,  6 }, /* index 204  */
+{10,  1,  0,  528,  2,  1,  2,  6 }, /* index 205  */
+{10,  1,  0,  640,  8,  1,  1,  6 }, /* index 206  */
+{10,  1,  0,  792,  2,  1,  2,  6 }, /* index 207  */
+{10,  1,  0,  792,  2,  2,  2,  6 }, /* index 208  */
+{10,  1,  0,  682,  2,  1,  2,  6 }, /* index 209  */
+{10,  1,  0, 1023,  8,  1,  1,  6 }, /* index 210  */
+{11,  2,  1,  512,  2,  1,  6,  2 }, /* index 211  */
+{11,  2,  1,  528,  8,  1,  3,  2 }, /* index 212  */
+{11,  2,  1,  640,  8,  1,  3,  2 }, /* index 213  */
+{11,  2,  1,  640,  2,  1,  6,  2 }, /* index 214  */
+{11,  2,  1,  528,  2,  2,  6,  2 }, /* index 215  */
+{11,  2,  1,  768,  2,  2,  6,  2 }, /* index 216  */
+{11,  1,  0,  512,  2,  2,  6,  2 }, /* index 217  */
+{11,  1,  0,  512,  8,  1,  3,  2 }, /* index 218  */
+{11,  1,  0,  512,  2,  1,  6,  2 }, /* index 219  */
+{11,  1,  0,  768,  2,  2,  6,  2 }, /* index 220  */
+{11,  1,  0,  528,  2,  1,  6,  2 }, /* index 221  */
+{11,  1,  0,  640,  8,  1,  3,  2 }, /* index 222  */
+{11,  1,  0,  792,  2,  2,  6,  2 }, /* index 223  */
+{11,  1,  0,  682,  2,  1,  6,  2 }, /* index 224  */
+{11,  1,  0, 1023,  8,  1,  3,  2 }, /* index 225  */
+{12,  2,  1,  512,  0,  1,  3,  4 }, /* index 226  */
+{12,  2,  1,  528,  6,  1,  2,  4 }, /* index 227  */
+{12,  2,  1,  640,  6,  1,  2,  4 }, /* index 228  */
+{12,  2,  1,  528,  0,  2,  3,  4 }, /* index 229  */
+{12,  2,  1,  768,  0,  2,  3,  4 }, /* index 230  */
+{12,  1,  0,  512,  0,  2,  3,  4 }, /* index 231  */
+{12,  1,  0,  512,  6,  1,  2,  4 }, /* index 232  */
+{12,  1,  0,  512,  0,  1,  3,  4 }, /* index 233  */
+{12,  1,  0,  768,  0,  2,  3,  4 }, /* index 234  */
+{12,  1,  0,  528,  0,  1,  3,  4 }, /* index 235  */
+{12,  1,  0,  640,  6,  1,  2,  4 }, /* index 236  */
+{12,  1,  0,  792,  0,  1,  3,  4 }, /* index 237  */
+{12,  1,  0,  792,  0,  2,  3,  4 }, /* index 238  */
+{12,  1,  0,  682,  0,  1,  3,  4 }, /* index 239  */
+{12,  1,  0, 1023,  6,  1,  2,  4 }, /* index 240  */
+{13,  2,  1,  512,  0,  1,  2,  6 }, /* index 241  */
+{13,  2,  1,  528,  2,  1,  2,  6 }, /* index 242  */
+{13,  2,  1,  640,  0,  1,  2,  6 }, /* index 243  */
+{13,  2,  1,  640,  2,  1,  2,  6 }, /* index 244  */
+{13,  2,  1,  528,  0,  2,  2,  6 }, /* index 245  */
+{13,  2,  1,  768,  0,  2,  2,  6 }, /* index 246  */
+{13,  1,  0,  512,  0,  2,  2,  6 }, /* index 247  */
+{13,  1,  0,  512,  2,  1,  2,  6 }, /* index 248  */
+{13,  1,  0,  512,  0,  1,  2,  6 }, /* index 249  */
+{13,  1,  0,  768,  0,  2,  2,  6 }, /* index 250  */
+{13,  1,  0,  528,  0,  1,  2,  6 }, /* index 251  */
+{13,  1,  0,  640,  2,  1,  2,  6 }, /* index 252  */
+{13,  1,  0,  792,  0,  2,  2,  6 }, /* index 253  */
+{13,  1,  0,  682,  0,  1,  2,  6 }, /* index 254  */
+{13,  1,  0, 1023,  2,  1,  2,  6 }  /* index 255  */
+};
+
+#else
 /* prach config index Table 6.3.3.2-2 spec 38.211 
  * PRACH format given as follows:
  * 0 = 0
@@ -411,6 +693,7 @@ uint16_t prachCfgIdxTable[MAX_PRACH_CONFIG_IDX][8] = {
 {10,  1,  0, 1023,  0,  2,  2,  6 }, /* index 254  */
 {10,  1,  0,  682,  0,  2,  2,  6 }  /* index 255  */
 };
+#endif
 
 /* Defintion of delta value Table 6.1.2.1.1-5 spec 38.214 */
 uint8_t puschDeltaTable[MAX_MU_PUSCH] = { 2, 3, 4, 6 };
@@ -535,6 +818,7 @@ uint16_t schCalcNumPrb(uint16_t tbSize, uint16_t mcs, uint8_t numSymbols)
    uint8_t  qm     = mcsTable[mcs][1];
    uint16_t rValue = mcsTable[mcs][2];
    uint8_t  numLayer = 1;       /* v value */
+   uint8_t  numDmrsRePerPrb = 12;
 
    tbSize = tbSize * 8; //Calculate tbSize in bits
 
@@ -545,7 +829,7 @@ uint16_t schCalcNumPrb(uint16_t tbSize, uint16_t mcs, uint8_t numSymbols)
 
    nre = ceil( (float)tbSize * 1024 / (qm * rValue * numLayer));
 
-   nreDash = ceil( (12 * numSymbols) - NUM_DMRS_SYMBOLS - 0);
+   nreDash = ceil( (12 * numSymbols) - numDmrsRePerPrb - 0);
 
    if (nreDash > 156)
       nre = 156;
@@ -553,6 +837,7 @@ uint16_t schCalcNumPrb(uint16_t tbSize, uint16_t mcs, uint8_t numSymbols)
    numPrb = ceil((float)nre / nreDash);   
    return numPrb;
 }
+
 /**
 * @brief calculation of transport block size.
 *
@@ -569,36 +854,65 @@ uint16_t schCalcNumPrb(uint16_t tbSize, uint16_t mcs, uint8_t numSymbols)
 **/
 uint16_t schCalcTbSizeFromNPrb(uint16_t numPrb, uint16_t mcs, uint8_t numSymbols)
 {   
-   uint16_t tbSize = 0;
-   uint16_t tbsIndex = 0;
-   uint16_t nre = 0;
-   uint16_t nreDash = 0;
    uint8_t  qm     = mcsTable[mcs][1];
    uint16_t rValue = mcsTable[mcs][2];
-   uint8_t  numLayer = 1;       /* v value */
+   uint16_t tbsIndex = 0;
+   uint32_t tbSize = 0;
+   uint32_t nre = 0;
+   uint32_t nreDash = 0;
+   uint32_t nInfo = 0;
+   uint32_t n = 0;
+   uint32_t nInfoDash = 0;
+   uint32_t c = 0;
+   const uint8_t  numLayer = 1;
+   const uint16_t numRbSc = 12;
+   const uint16_t numDmrsRes = 12;
+   const uint16_t sf = 1;
+//   uint16_t numPrbOvrHead = 0;
    
-   /* formula used for calculation of rbSize, 38.213 section 5.1.3.2 *
-   * Ninfo = Nre . R . Qm . v   where [ NInfo is tbSize]                *
+  /* formula used for calculation of rbSize, 38.214 section 5.1.3.2  *
+   * Ninfo = Nre . R . Qm . v   where [ NInfo is tbSize]             *
    * Nre' = Nsc . NsymPdsch - NdmrsSymb - Noh                        *
    * Nre = min(156,Nre') . nPrb                                      */
-   
-   nreDash = ceil( (12 * numSymbols) - NUM_DMRS_SYMBOLS - 0);
-  
-   if(nreDash > 156)
-      nreDash = 156;
 
+   nreDash = MIN(156, ceil( (numRbSc * numSymbols) - numDmrsRes - 0));
    nre = nreDash * numPrb;
-   tbSize = ceil(nre * qm * numLayer * rValue/1024.0);
-   tbSize = ceil(tbSize/8.0);
-   
-   while(tbSize > tbSizeTable[tbsIndex])
+   nInfo = ceil(nre * qm * numLayer * rValue/(1024.0 * sf));
+
+   if(nInfo <= 3824)
    {
-      tbsIndex++;
+      n = MAX(3, (uint32_t)cmLog2(nInfo) - 6);
+      nInfoDash = MAX(24, (1<<n)*(nInfo/(1<<n)));
+      while(nInfoDash > tbSizeTable[tbsIndex])
+      {
+         tbsIndex++;
+      }
+      tbSize = tbSizeTable[tbsIndex];
    }
-   tbSize = tbSizeTable[tbsIndex];
+   else
+   {
+      n = (uint32_t)cmLog2(nInfo - 24) - 5;
+      nInfoDash = MAX(3840, (1<<n)*ceil((nInfo - 24)/(1<<n)));
 
+      if(rValue<256)
+      {
+         c = ceil((nInfoDash + 24)/3816);
+         tbSize = 8 * c * ceil((nInfoDash + 24)/(8 * c)) - 24;
+      }
+      else
+      {
+         if(nInfoDash > 8424)
+         {
+            c = ceil((nInfoDash + 24)/8424);
+            tbSize = 8 * c * ceil((nInfoDash + 24)/(8 * c)) - 24;
+         }
+         else
+         {
+            tbSize = 8 * ceil((nInfoDash + 24)/(8)) - 24;
+         }
+      }
+   }
    return tbSize;
-
 }
 /**
  * @brief fetching ueCb from cellCb
@@ -684,7 +998,7 @@ void schInitDlSlot(SchDlSlotInfo *schDlSlotInfo)
 #ifdef NR_TDD
 
 /**
- * @brief determines slot format
+ * @brief determines slot/symbol format
  *
  * @details
  *
@@ -701,10 +1015,13 @@ void schInitDlSlot(SchDlSlotInfo *schDlSlotInfo)
  **/
 SlotConfig schGetSlotSymbFrmt(uint16_t slot, uint32_t bitMap)
 {
+   uint32_t offset = (slot)*2;
+   return (bitMap & 0x3<<offset)>>offset;
+#if 0
    SlotConfig slotFrmt;
    int mask1 = 0, mask2 = 0;
 
-   slot = (slot%10)*2;
+   slot = (slot%n)*2;//n num of slots in defined periodicity or num of symbols
    mask1 = 1<<(slot);
    mask2 = 1<<(slot+1);
    slotFrmt = ((mask1 & bitMap)>>slot) + (2*((mask2 & bitMap)>>(slot+1)));
@@ -712,6 +1029,7 @@ SlotConfig schGetSlotSymbFrmt(uint16_t slot, uint32_t bitMap)
    //printf("\n\n\n\n*****FormatType:%d Slot:%d****\n\n\n\n", slotFrmt, slot/2);
 
    return slotFrmt;
+#endif
 }
 
 #endif
index 3a2e272..4167831 100755 (executable)
 #include "ssi.h"                /* system services interface */
 
 #include "cm_math.h"
-#include "cm_math.x"
-
 #include <stdlib.h>
-
 #include <math.h>
 
-
 #ifdef SS_FLOAT
 /*
 *
@@ -161,6 +157,24 @@ F64 cmLog10(F64 x)
 } /* end of cmLog10 */
 #endif /* SS_FLOAT */
 
+/*
+*
+*       Fun:   cmLog
+*
+*       Desc:  common primitive for computing the base 2 logrithm of x.
+*
+*       Ret:   log2(x)
+*
+*       Notes: None
+*
+*       File:  cm_math.c
+*
+*/
+float cmLog2(uint32_t x)
+{
+   return ((float) log2(x));
+}
+
 /**********************************************************************
          End of file
 **********************************************************************/
index 83a5e63..a79d0ec 100755 (executable)
 #ifndef __CMMATHH__
 #define __CMMATHH__
 
+#include <math.h>
+
+#ifdef SS_FLOAT
+/* Math library function prototypes */
+uint32_t cmAbs ARGS((F64 val));
+F64 cmPow ARGS((F64 x, F64 y));
+F64 cmFloor ARGS((F64 x));
+F64 cmLog ARGS((F64 x));
+F64 cmLog10 ARGS((F64 x));
+#endif
+
+float cmLog2(uint32_t x);
+
 #endif /* __CMMATHH__ */
 
 \f 
diff --git a/src/cm/cm_math.x b/src/cm/cm_math.x
deleted file mode 100755 (executable)
index f6bcea2..0000000
+++ /dev/null
@@ -1,62 +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:     common math library
-
-     Type:     C include file
-
-     Desc:     Extern defintions
-
-     File:     cm_math.x
-
-*********************************************************************21*/
-
-#ifndef __CMMATHX__
-#define __CMMATHX__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef SS_FLOAT
-
-/* environment dependent include files */
-#include <math.h>
-
-/* Math library function prototypes */
-uint32_t cmAbs ARGS((F64 val));
-F64 cmPow ARGS((F64 x, F64 y));
-F64 cmFloor ARGS((F64 x));
-F64 cmLog ARGS((F64 x));
-F64 cmLog10 ARGS((F64 x));
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __CMMATHX__ */ 
-
-\f
-/********************************************************************30**
-
-         End of file
-**********************************************************************/
index a130832..230445a 100644 (file)
 #include <stdint.h>
 
 #include "cm_mem.h"
-#include "cm_math.h"
 #include "envopt.h"
 #include "envdep.h"
 #include "envind.h"
 #include "gen.h" 
 #include "ssi.h" 
+#include "cm_math.h"
 #include "cm5.h"
 #include "cm_tkns.h"
 #include "cm_mblk.h"
@@ -43,7 +43,6 @@
 #include "cm.h"
 #include "gen.x"           /* general */
 #include "ssi.x"           /* system services */
-#include "cm_math.x"
 #include "cm_tpt.x"
 #include "cm_tkns.x" 
 #include "cm_mblk.x"
index 285d200..599b638 100644 (file)
@@ -92,6 +92,8 @@
 #define MAX_NUM_DL_DATA_TO_UL_ACK 15
 #define SD_SIZE   3
 
+#define TX_PAYLOAD_HDR_LEN 32           /* Intel L1 requires adding a 32 byte header to transmitted payload */
+
 #define ADD_DELTA_TO_TIME(crntTime, toFill, incr)          \
 {                                                          \
    if ((crntTime.slot + incr) > (MAX_SLOTS - 1))           \
index e51b461..524fe27 100644 (file)
@@ -9291,91 +9291,98 @@ void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap)
 {
    UE_NR_Capability_t *ueNrCap=NULLP;
 
-   if(ueCap)
+   if(!ueCap)
+   {
+      memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));     
+      memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
+   }
+   else
+   {
       ueNrCap = (UE_NR_Capability_t *)ueCap;
 
-   /* Filling DL modulation info */
-   if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsDownlinkPerCC && \
+      /* Filling DL modulation info */
+      if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsDownlinkPerCC && \
          ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0] && \
          ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL)
-   {
-      switch(*(ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL))
       {
-         case ModulationOrder_qpsk:
-            {
-               ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK;
-               break;
-            }
-         case ModulationOrder_qam16:
-            {
-               ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM16;
-               break;
-            }
-         case ModulationOrder_qam64:
-            {
-               ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM64;
-               ueCfg->dlModInfo.mcsIndex = PDSCH_MCS_INDEX;
-               ueCfg->dlModInfo.mcsTable = MCS_TABLE_QAM64;
-               break;
-            }
-         case ModulationOrder_qam256:
-            {
-               ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM256;
-               break;
-            }
-         default:
-            {
-               DU_LOG("\nERROR  -->  DU APP: Incorrect downlink modulation order received. Reatining old modulation configuration");
-               memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
-               break;
-            }
+         switch(*(ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL))
+         {
+            case ModulationOrder_qpsk:
+               {
+                  ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK;
+                  break;
+               }
+            case ModulationOrder_qam16:
+               {
+                  ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM16;
+                  break;
+               }
+            case ModulationOrder_qam64:
+               {
+                  ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM64;
+                  ueCfg->dlModInfo.mcsIndex = PDSCH_MCS_INDEX;
+                  ueCfg->dlModInfo.mcsTable = MCS_TABLE_QAM64;
+                  break;
+               }
+            case ModulationOrder_qam256:
+               {
+                  ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM256;
+                  break;
+               }
+            default:
+               {
+                  DU_LOG("\nERROR  -->  DU APP: Incorrect downlink modulation order received. Reatining old modulation configuration");
+                  memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
+                  break;
+               }
+         }
+      }
+      else
+      {
+         memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
       }
-   }
-   else
-   {
-      memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
-   }
 
-   /* Filling UL modulation info */
-   if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsUplinkPerCC && \
+      /* Filling UL modulation info */
+      if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsUplinkPerCC && \
          ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0] && \
          ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL)
-   {
-      switch(*(ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL))
       {
-         case ModulationOrder_qpsk:
-            {
-               ueCfg->ulModInfo.modOrder = MOD_ORDER_QPSK;
-               break;
-            }
-         case ModulationOrder_qam16:
-            {
-               ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM16;
-               ueCfg->ulModInfo.mcsIndex = PUSCH_MCS_INDEX;
-               ueCfg->ulModInfo.mcsTable = MCS_TABLE_QAM64;
-               break;
-            }
-         case ModulationOrder_qam64:
-            {
-               ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM64;
-               break;
-            }
-         case ModulationOrder_qam256:
-            {
-               ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM256;
-               break;
-            }
-         default:
-            {
-               DU_LOG("\nERROR  -->  DU APP: Incorrect uplink modulation order received. Reatining old modulation configuration");
-               memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
-               break;
-            }
+         switch(*(ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL))
+         {
+            case ModulationOrder_qpsk:
+               {
+                  ueCfg->ulModInfo.modOrder = MOD_ORDER_QPSK;
+                  break;
+               }
+            case ModulationOrder_qam16:
+               {
+                  ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM16;
+                  ueCfg->ulModInfo.mcsIndex = PUSCH_MCS_INDEX;
+                  ueCfg->ulModInfo.mcsTable = MCS_TABLE_QAM64;
+                  break;
+               }
+            case ModulationOrder_qam64:
+               {
+                  ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM64;
+                  break;
+               }
+            case ModulationOrder_qam256:
+               {
+                  ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM256;
+                  break;
+               }
+            default:
+               {
+                  DU_LOG("\nERROR  -->  DU APP: Incorrect uplink modulation order received. Reatining old modulation configuration");
+                  memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
+                  break;
+               }
+         }
+      }
+      else
+      {
+         memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
       }
-   }
-   else
-   {
-      memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
    }
 }
 
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 73ceca3..920afca 100644 (file)
@@ -1166,10 +1166,7 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t ueIdx, uint16_t crnti, \
             }
          }
          ret = fillAmbr(&macUeCfg->ambrCfg, ueCfgDb->ambrCfg);
-         if(ueCfgDb->ueNrCapability != NULLP)
-         {
-            duFillModulationDetails(macUeCfg, duMacDb, ueCfgDb->ueNrCapability);
-         }
+         duFillModulationDetails(macUeCfg, duMacDb, ueCfgDb->ueNrCapability);
       }
 
       /* Filling LC Context */
index a6a5410..840cb7c 100644 (file)
@@ -766,7 +766,7 @@ MtMemCfg mtMemoCfg =
         }
       },
       {
-        SS_DFLT_REGION + 5,                         /* region id */
+        SS_DFLT_REGION + 6,                         /* region id */
         MT_MAX_BKTS,                            /* number of buckets */
         MT_HEAP_SIZE,                           /* heap size */
         {