Changes for SR, BSR and MSG5 Handling
[o-du/l2.git] / src / 5gnrrlc / kw_tmm_ul.c
index 4e3b487..6accebd 100755 (executable)
@@ -42,18 +42,7 @@ static int RLOG_FILE_ID=201;
 */
 \f
 /* header (.h) include files */
-#include "envopt.h"        /* environment options */
-#include "envdep.h"        /* environment dependent */
-#include "envind.h"        /* environment independent */
-
-#include "gen.h"           /* general */
-#include "ssi.h"           /* system services */
-#include "cm5.h"           /* common timer defines */
-#include "cm_tkns.h"       /* common tokens defines */
-#include "cm_mblk.h"       /* common memory allocation library defines */
-#include "cm_llist.h"      /* common link list  defines  */
-#include "cm_hash.h"       /* common hash list  defines */
-#include "cm_lte.h"        /* common LTE defines */
+#include "common_def.h"
 #include "lkw.h"           /* LKW defines */
 #include "ckw.h"           /* CKW defines */
 #include "kwu.h"           /* KWU defines */
@@ -65,16 +54,6 @@ static int RLOG_FILE_ID=201;
 #include "kw_ul.h"
 
 /* extern (.x) include files */
-#include "gen.x"           /* general */
-#include "ssi.x"           /* system services */
-
-#include "cm5.x"           /* common timer library */
-#include "cm_tkns.x"       /* common tokens */
-#include "cm_mblk.x"       /* common memory allocation */
-#include "cm_llist.x"      /* common link list */
-#include "cm_hash.x"       /* common hash list */
-#include "cm_lte.x"        /* common LTE includes */
-#include "cm_lib.x"        /* common memory allocation library */
 #include "lkw.x"           /* LKW */
 #include "ckw.x"           /* CKW */
 #include "kwu.x"           /* KWU */
@@ -82,6 +61,9 @@ static int RLOG_FILE_ID=201;
 
 #include "kw.x"
 #include "kw_ul.x"
+#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)
 #ifdef EG_GEN_LOAD_5GTF
@@ -147,7 +129,7 @@ U8 rrcUeCapabilityInfo[] =
 
    RLOG1(L_INFO,"Profiling Framework Sending RRC Connection Req to RRC for UE :%d\n",crnti);
    printf("Profiling Framework Sending RRC Connection Req to RRC for UE :%d\n",crnti);
-   KwUiKwuDatInd(&ulPst1, 1, datIndInfo, pdu);
+   KwUiKwuDatInd(&ulPst1, datIndInfo, pdu);
  }
  else if(2 == rrcMsgType)
  {
@@ -266,15 +248,15 @@ U8 rrcUeCapabilityInfo[] =
 #ifdef ANSI
 PUBLIC Void kwTmmRcvFrmLi
 (
-KwCb        *gCb,
-KwUlRbCb    *rbCb,  
+RlcCb        *gCb,
+RlcUlRbCb    *rbCb,  
 CmLteRnti   tCrnti,  
 Buffer      *pdu      
 )
 #else
 PUBLIC Void kwTmmRcvFrmLi(gCb,rbCb, tCrnti, pdu)
-KwCb        *gCb;
-KwUlRbCb    *rbCb;  
+RlcCb        *gCb;
+RlcUlRbCb    *rbCb;  
 CmLteRnti   tCrnti; 
 Buffer      *pdu;  
 #endif
@@ -282,57 +264,65 @@ Buffer      *pdu;
 #ifdef ANSI
 PUBLIC Void kwTmmRcvFrmLi
 (
-KwCb       *gCb,
-KwUlRbCb   *rbCb,         
+RlcCb       *gCb,
+RlcUlRbCb   *rbCb,         
 Buffer     *pdu            
 )
 #else
 PUBLIC Void kwTmmRcvFrmLi(gCb,rbCb, pdu)
-KwCb       *gCb;
-KwUlRbCb   *rbCb;         
+RlcCb       *gCb;
+RlcUlRbCb   *rbCb;         
 Buffer     *pdu;         
 #endif
 #endif 
 {
-   KwuDatIndInfo   *datIndInfo;   /* Data Indication Information */
-   MsgLen          msgLen;
+   RlcUlRrcMsgInfo  *ulRrcMsgInfo;
+   uint16_t         msgLen;
+   uint16_t         copyLen;    /* Number of bytes copied */
+   Pst              pst;
  
    TRC2(kwTmmRcvFrmLi) 
 
-   /* Creating static memory for KwuDatIndInfo. #else will be 
-    * removed once the sanity testing is performed for all platforms */
-   KwuDatIndInfo datIndInfoTmp;
-   datIndInfo = &datIndInfoTmp;
-#if (ERRCLASS & ERRCLS_ADD_RES)
-   if ( datIndInfo == NULLP )
-   {   
-      RLOG_ARG2(L_FATAL,DBG_RBID,rbCb->rlcId.rbId,
-            "Memory Allocation failed UEID:%d CELLID:%d",
-            rbCb->rlcId.ueId,
-            rbCb->rlcId.cellId);   
-      RETVOID;
-   }
-#endif /* ERRCLASS & ERRCLS_ADD_RES */
-   KW_MEM_CPY(&(datIndInfo->rlcId),&(rbCb->rlcId),sizeof(CmLteRlcId));
-#ifdef CCPU_OPT 
-   if ( rbCb->lch.lChType == CM_LTE_LCH_CCCH ) 
-   {
-      datIndInfo->tCrnti = tCrnti;
-   }
-#endif 
    gCb->genSts.pdusRecv++;
-   SFndLenMsg(pdu, &msgLen);
+   SFndLenMsg(pdu, (MsgLen *)&msgLen);
    gCb->genSts.bytesRecv += msgLen;
    /* If trace flag is enabled send the trace indication */
    if(gCb->init.trc == TRUE)
    {
       /* Populate the trace params */
-      kwLmmSendTrc(gCb,KWU_EVT_DAT_IND, pdu);
+      kwLmmSendTrc(gCb, EVENT_UL_RRC_MSG_TRANS_TO_DU, pdu);
    }
-   KwUiKwuDatInd( &gCb->u.ulCb->kwuUlSap->pst, 
-                  gCb->u.ulCb->kwuUlSap->suId, 
-                  datIndInfo, pdu);
-   
+  
+   /* Filling UL RRC Message Info */
+   RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL,
+      ulRrcMsgInfo, sizeof(RlcUlRrcMsgInfo));
+   if (ulRrcMsgInfo)
+   {
+      ulRrcMsgInfo->cellId = rbCb->rlcId.cellId;
+      ulRrcMsgInfo->ueIdx = rbCb->rlcId.ueId;
+      ulRrcMsgInfo->lcId = rbCb->lch.lChId;
+      RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL,
+         ulRrcMsgInfo->rrcMsg, msgLen);
+      if (ulRrcMsgInfo->rrcMsg)
+      {
+         SCpyMsgFix(pdu, 0, msgLen, ulRrcMsgInfo->rrcMsg, (MsgLen *)&copyLen);
+         ulRrcMsgInfo->msgLen = msgLen;
+
+         /* Sending UL RRC Message transfeer to DU APP */
+         memset(&pst, 0, sizeof(Pst));
+         FILL_PST_RLC_TO_DUAPP(pst, SFndProcId(), RLC_UL_INST, EVENT_UL_RRC_MSG_TRANS_TO_DU);
+         rlcSendUlRrcMsgToDu(&pst, ulRrcMsgInfo);
+      }
+      else
+      {
+         DU_LOG("\nRLC : Memory allocation failed");
+      }
+   }
+   else
+   {
+      DU_LOG("\nRLC : Memory allocation failed");
+   }
    RETVOID;
 }
 
@@ -352,16 +342,16 @@ Buffer     *pdu;
 #ifdef ANSI
 PUBLIC Void kwTmmUlReEstablish
 (
-KwCb        *gCb,
-KwUlRbCb    *rbCb        
+RlcCb        *gCb,
+RlcUlRbCb    *rbCb        
 )
 #else
 PUBLIC Void kwTmmUlReEstablish(rbCb)
-KwCb        *gCb;
+RlcCb        *gCb;
 KwRbCb      *rbCb;          
 #endif
 {
-   TRC2(kwUlTmmReEstablish)
+   TRC2(rlcUlTmmReEstablish)
 
    RLOG_ARG0(L_DEBUG,DBG_RBID,rbCb->rlcId.rbId,"do nothing for TMM for ReEstablish");
    RETVOID;