Fixes of Ul and Dl data flow 67/7067/6
authorbarveankit <anbarve@radisys.com>
Mon, 15 Nov 2021 19:08:19 +0000 (00:38 +0530)
committerbarveankit <anbarve@radisys.com>
Mon, 22 Nov 2021 07:10:17 +0000 (12:40 +0530)
Change-Id: I857014d6d23aa8408fcfd3f4f6fc0e4353b394f4
Signed-off-by: barveankit <anbarve@radisys.com>
18 files changed:
src/5gnrmac/mac_slot_ind.c
src/5gnrrlc/rlc_utl_dl.c
src/5gnrsch/sch.c
src/5gnrsch/sch_rach.c
src/5gnrsch/sch_ue_mgr.c
src/cm/common_def.c
src/cm/l2_tenb_stats.h
src/cu_stub/cu_stub.c
src/cu_stub/cu_stub.h
src/cu_stub/cu_stub_egtp.c
src/du_app/du_cell_mgr.c
src/du_app/du_egtp.c
src/du_app/du_f1ap_msg_hdl.c
src/du_app/du_msg_hdl.c
src/du_app/du_ue_mgr.c
src/phy_stub/phy_stub.h
src/phy_stub/phy_stub_msg_hdl.c
src/phy_stub/phy_stub_thread_hdl.c

index 684dda0..2968fa5 100644 (file)
@@ -199,7 +199,7 @@ void fillMsg4Pdu(uint16_t cellId, DlMsgSchInfo *msg4SchInfo)
    }
    else
    {
-      DU_LOG("\nERROR  -->  MAC: Failed at macMuxPdu()");
+      DU_LOG("\nERROR  -->  MAC: Failed at fillMsg4Pdu()");
    }
 }
 
index 69022fc..356e44a 100755 (executable)
@@ -389,6 +389,11 @@ uint8_t rlcSendDedLcDlData(Pst *post, SpId spId, RguDDatReqInfo *datReqInfo)
             return RFAILED;
          }
       }
+      else
+      {
+         RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlRrcMsgRsp, sizeof(RlcDlRrcMsgRsp));
+      }
+
    } /* For Data per UE */
    RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RguDDatReqInfo));
 
index 2cb4c54..e5330cc 100644 (file)
@@ -1095,6 +1095,12 @@ uint8_t MacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd)
    DU_LOG("\nDEBUG  -->  SCH : Received SR");
 
    ueCb = schGetUeCb(cellCb, uciInd->crnti);
+   
+   if(ueCb->state == SCH_UE_STATE_INACTIVE)
+   {
+      DU_LOG("\nERROR  -->  SCH : Crnti %d is inactive", uciInd->crnti);
+      return ROK;  
+   }
 
    if(uciInd->numSrBits)
    {
@@ -1275,8 +1281,15 @@ uint8_t allocatePrbUl(SchCellCb *cell, SlotTimingInfo slotTime, \
    bool           isPrachOccasion;
    FreePrbBlock   *freePrbBlock = NULLP;
    CmLList        *freePrbNode = NULLP;
-   SchPrbAlloc    *prbAlloc = &cell->schUlSlotInfo[slotTime.slot]->prbAlloc;
+   SchPrbAlloc    *prbAlloc = NULLP;
 
+   if(cell == NULLP)
+   {
+      DU_LOG("\nERROR  --> SCH : allocatePrbUl(): Received cellCb is null");
+      return RFAILED;
+   }
+   
+   prbAlloc =   &cell->schUlSlotInfo[slotTime.slot]->prbAlloc;
    /* If startPrb is set to MAX_NUM_RB, it means startPrb is not known currently.
     * Search for an appropriate location in PRB grid and allocate requested resources */
    if(*startPrb == MAX_NUM_RB)
index 199f6af..becb131 100644 (file)
@@ -148,6 +148,12 @@ void schPrachResAlloc(SchCellCb *cell, UlSchedInfo *ulSchedInfo, SlotTimingInfo
    uint8_t  dataType = 0;
    uint16_t freqStart = 0;
 
+   if(cell == NULLP)
+   {
+      DU_LOG("\nERROR  --> SCH : schPrachResAlloc(): Received cellCb is null");
+      return RFAILED;
+   }
+
    /* If this slot is not a PRACH occassion, return */
    if(!schCheckPrachOcc(cell, prachOccasionTimingInfo))
       return;
index 0c42675..3ceab12 100644 (file)
@@ -1024,7 +1024,7 @@ uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete  *ueDelete)
        if(( cellCb->ueCb[ueId-1].crnti == ueDelete->crnti) && ( cellCb->ueCb[ueId-1].state == SCH_UE_STATE_ACTIVE))
        {
           deleteSchUeCb(&cellCb->ueCb[ueId-1]);
-
+          ueIdToDel  = ueId;
           /* Remove UE from ueToBeScheduled list */
           node = cellCb->ueToBeScheduled.first;
           while(node)
@@ -1034,7 +1034,7 @@ uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete  *ueDelete)
              if(ueId == ueIdToDel)
              {
                 SCH_FREE(node->node, sizeof(uint8_t));
-                cmLListDelFrm(&cellCb->ueToBeScheduled, node);
+                deleteNodeFromLList(&cellCb->ueToBeScheduled, node);
                 break;
              }
              node = next;
@@ -1175,6 +1175,7 @@ void deleteSchCellCb(SchCellCb *cellCb)
       next = node->next;
       SCH_FREE(node->node, sizeof(uint8_t));
       cmLListDelFrm(&cellCb->ueToBeScheduled, node);
+      SCH_FREE(node, sizeof(CmLList));
       node = next;
    }
 
index 2321783..b29351e 100644 (file)
@@ -200,8 +200,11 @@ uint8_t SGetSBufNewForDebug(char *file, char *func, char *line, Region region, P
    if(SGetSBuf(region, pool, ptr, size) == ROK)
    {
 #ifdef ODU_MEMORY_DEBUG_LOG
-      printf("\nCM_ALLOC=== SGetSBufNewForDebug %s +%d, %s, %d, %p\n",\
+      if (strncmp(func,"cmInetRecvMsg",sizeof("cmInetRecvMsg")))
+      {
+         printf("\nCM_ALLOC=== SGetSBufNewForDebug %s +%d, %s, %d, %p\n",\
          file, line, func, size, *ptr);
+      }
 #endif
       return ROK;
    }
@@ -230,8 +233,11 @@ uint8_t SPutSBufNewForDebug(char *file, char *func, char *line, Region region, P
    if(SPutSBuf(region, pool, ptr, size) == ROK)
    {
 #ifdef ODU_MEMORY_DEBUG_LOG
-      printf("\nCM_FREE=== SPutSBufNewForDebug %s +%d, %s, %d, %p\n",\
+      if (strncmp(func,"cmInetRecvMsg",sizeof("cmInetRecvMsg")))
+      {
+         printf("\nCM_FREE=== SPutSBufNewForDebug %s +%d, %s, %d, %p\n",\
          file, line, func, size, ptr);
+      }
 #endif
       return ROK;
    }
index 3d2be6b..e60d5a7 100755 (executable)
@@ -40,12 +40,12 @@ extern "C" {
 #endif /* __cplusplus */
 /*MCELL changes*/
 #ifdef LTE_PAL_ENB
-#define L2_STATS_MAX_CELLS 5
+#define L2_STATS_MAX_CELLS 1
 #else
-#define L2_STATS_MAX_CELLS 5
+#define L2_STATS_MAX_CELLS 1
 #endif
 #ifndef XEON_SPECIFIC_CHANGES   
-#define L2_STATS_MAX_UES   300
+#define L2_STATS_MAX_UES   10
 #define L2_STATS_MAX_RNTIS 500
 #else
 #define L2_STATS_MAX_UES   TENB_MAX_UE_SUPPORTED /* ANOOP changed */
index e9ae4ef..0b9edb3 100644 (file)
@@ -243,6 +243,14 @@ void *cuConsoleHandler(void *args)
    uint8_t ret = ROK;
    uint8_t cnt = 0;
 
+   /* This variable is taken for sending specific number of downlink data packet. 
+    * Presently the code is supporting total 4500 data packets trasfer for 3 UEs only with sleep(1).
+    * If you wants to pump data for 3 UE change the following macro values
+    * NUM_TUNNEL_TO_PUMP_DATA = 9, NUM_DL_PACKETS = 1.
+    * totalDataPacket = totalNumOfTestFlow * NUM_TUNNEL_TO_PUMP_DATA * NUM_DL_PACKETS 
+    * totalDataPacket = [500*9*1] */
+   int32_t totalNumOfTestFlow = 500; 
+
    while(true) 
    {
       /* Send DL user data to CU when user enters 'd' on console */
@@ -275,20 +283,27 @@ void *cuConsoleHandler(void *args)
             cnt++;
          }
 #else
-         for(teId = 1; teId <= NUM_TUNNEL_TO_PUMP_DATA; teId++)
+         while(totalNumOfTestFlow)
          {
-            DU_LOG("\nDEBUG  -->  EGTP: Sending DL User Data(teId:%d)\n",teId);
-            cnt =0;
-            while(cnt < NUM_DL_PACKETS)
+            for(teId = 1; teId <= NUM_TUNNEL_TO_PUMP_DATA; teId++)
             {
-               ret =  cuEgtpDatReq(teId);      
-               if(ret != ROK)
+               DU_LOG("\nDEBUG  -->  EGTP: Sending DL User Data(teId:%d)\n",teId);
+               cnt =0;
+               while(cnt < NUM_DL_PACKETS)
                {
-                  DU_LOG("\nERROR --> EGTP: Issue with teid=%d\n",teId);
-                  break;
+                  ret =  cuEgtpDatReq(teId);      
+                  if(ret != ROK)
+                  {
+                     DU_LOG("\nERROR --> EGTP: Issue with teid=%d\n",teId);
+                     break;
+                  }
+                  /* TODO : sleep(1) will be removed later once we will be able to
+                   * support the continuous data pack transfer */
+                  sleep(1);
+                  cnt++;
                }
-               cnt++;
             }
+            totalNumOfTestFlow--;
          }
 #endif
          continue;
index 3e8ce11..baff2d6 100644 (file)
@@ -50,7 +50,6 @@
    SPutSBuf(CU_APP_MEM_REG, CU_POOL,                         \
          (Data *)_datPtr, _size);
 
-
 typedef struct ipAddr
 {
  Bool      ipV4Pres;
index 69f6dba..65f19a2 100644 (file)
@@ -497,8 +497,9 @@ S16 cuEgtpEncodeHdr(uint8_t *preEncodedHdr, EgtpMsgHdr *preDefHdr, uint8_t *hdrI
 S16 cuEgtpHdlRecvMsg(Buffer *mBuf)
 {
    /*Decoding of EGTP message header */
+   
    cuEgtpDecodeHdr(mBuf);
-
+   
    /* Start Pumping data from CU to DU */
    //return (cuEgtpDatReq());
 
index 0eb2022..34c1380 100644 (file)
@@ -356,13 +356,6 @@ uint8_t duSendCellDeletReq(uint16_t cellId)
       return RFAILED;  
    }
 
-   if(duCb.actvCellLst[cellIdx]->numActvUes)
-   {
-      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): Active UEs still present in cellId[%d].\
-      Failed to delete cell", cellId);
-      return RFAILED;
-   }
-
    if(duBuildAndSendMacCellStop(cellId) == RFAILED)
    {
       DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): Failed to build and send cell stop request to MAC for\
index fc9df1b..075cd7c 100644 (file)
@@ -889,8 +889,6 @@ uint8_t egtpSendMsg(Buffer *mBuf)
       return RFAILED;
    }
 
-   DU_LOG("\nDEBUG   -->  EGTP : Message Sent");
-
    return ROK;
 }
 
@@ -936,6 +934,7 @@ uint8_t egtpRecvMsg()
          //ODU_PRINT_MSG(recvBuf, 0 ,0);
          egtpHdlRecvData(recvBuf);
          gDlDataRcvdCnt++;
+         
       }
    }
    
index d1202d9..edc1afe 100644 (file)
@@ -12194,7 +12194,7 @@ void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck)
 uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId)
 {
    uint8_t  ieIdx=0, arrIdx=0,ret=ROK;
-   uint8_t  ueId =0 , ueIdx =0;
+   uint8_t  ueId =0 , ueIdx =0, totalActiveUe = 0;
    uint16_t cellId =0, cellIdx =0, crnti=0;
    CmLList *f1apPduNode = NULLP;
    ReservedF1apPduInfo *f1apPduInfo =NULLP;
@@ -12246,28 +12246,38 @@ uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId)
                            ret = duSendCellDeletReq(cellId);
                            if(ret == RFAILED)
                            {
-                              DU_LOG("ERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to send cell delete\
+                              DU_LOG("\nERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to send cell delete\
                               request for cellId[%d]", cellId);
                            }
                         }
                         else
                         {
-                           for(ueIdx = 0; ueIdx < duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++)
+                           totalActiveUe = duCb.actvCellLst[cellIdx]->numActvUes;
+                           while(totalActiveUe)
                            {
+                              if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState != UE_ACTIVE)
+                              {
+                                 ueIdx++;
+                                 continue;
+                              }
+
                               crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti;
                               GET_UE_IDX(crnti,ueId);
+                              /* Sending Ue Context release request only for maximum supporting UEs */
                               ret = BuildAndSendUeContextReleaseReq(cellId, ueId);
                               if(ret == RFAILED)
                               {
-                                 DU_LOG("ERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to build and send UE delete\
+                                 DU_LOG("\nERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to build and send UE delete\
                                  request for cellId[%d]", cellId);
                               }
+                              ueIdx++;
+                              totalActiveUe--;
                            }
                         }
                      }
                      else
                      {
-                        DU_LOG("ERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): CellId [%d] not found", cellId);
+                        DU_LOG("\nERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): CellId [%d] not found", cellId);
                         ret = RFAILED;
                      }
                      break;
@@ -13478,7 +13488,7 @@ uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t gnbCuUeF1
       break;
    }while(true);
    
-   if(ret == ROK)
+   if(ret == ROK && (duCb.actvCellLst[cellId-1]->numActvUes == 0))
    {
       duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS;
       ret = duSendCellDeletReq(cellId);
@@ -13603,7 +13613,7 @@ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
                   {
                      for(cellIdx = 0; cellIdx < duCb.numActvCells; cellIdx++)
                      {
-                        for(ueIdx = 0; ueIdx < duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++)
+                        for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
                         {
                            if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
                                  (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
@@ -13652,7 +13662,7 @@ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
                      }
                      if(!ueIdxFound)
                      {
-                        DU_LOG("\nERROR  -->  F1AP: DuUeCb is not found at procF1UeContextSetupReq()");
+                        DU_LOG("\nERROR  -->  F1AP: DuUeCb is not found at procF1UeContextReleaseCommand()");
                         ret = RFAILED;
                      }
 
index 9116286..198653a 100644 (file)
@@ -1248,7 +1248,7 @@ uint8_t duSendEgtpDatInd(Buffer *mBuf)
    egtpMsg.msgHdr.extHdr.pdcpNmb.pres = FALSE;
    egtpMsg.msgHdr.teId = 1;
    egtpMsg.msg = mBuf;
-
+   
    egtpHdlDatInd(egtpMsg);
 
    return ROK;
index 6e0cce1..aa67128 100644 (file)
@@ -3261,12 +3261,14 @@ uint8_t duProcUeContextReleaseCommand(DuUeCb *duUeCb)
    
    cellId = duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->cellId;
    crnti = duUeCb->crnti;
+   GET_UE_IDX(crnti, ueIdx);
+   
    /* Send DL RRC msg for RRC release */
    if(duUeCb->f1UeDb->dlRrcMsg)
    {
       if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu != NULLP)
       {
-         ret = duBuildAndSendDlRrcMsgToRlc(cellId, duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->ueCb[ueIdx].rlcUeCfg,\
+         ret = duBuildAndSendDlRrcMsgToRlc(cellId, duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->ueCb[ueIdx-1].rlcUeCfg,\
                duUeCb->f1UeDb->dlRrcMsg);
          if(ret == RFAILED)
          {
index 68c30df..6ee1a8f 100644 (file)
@@ -89,7 +89,7 @@ void procPhyMessages(uint16_t msgType, uint32_t msgSize, void *msg);
 void l1StartConsoleHandler();
 void l1HdlSlotIndicaion(bool);
 void GenerateTicks();
-uint8_t l1SendUlUserData(uint8_t drbId);
+uint8_t l1SendUlUserData(uint8_t drbId, uint8_t ueIdx);
 uint8_t l1SendStatusPdu();
 uint16_t l1BuildAndSendSlotIndication();
 uint16_t l1BuildAndSendStopInd();
index 1d03573..79d973f 100644 (file)
@@ -1326,7 +1326,7 @@ S16 l1HdlUlDciReq(uint16_t msgLen, void *msg)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t l1SendUlUserData(uint8_t drbId)
+uint8_t l1SendUlUserData(uint8_t drbId, uint8_t ueIdx)
 {
    uint8_t cnt = 0;
    fapi_rx_data_indication_t *rxDataInd;
@@ -1352,8 +1352,8 @@ uint8_t l1SendUlUserData(uint8_t drbId)
 
    /* TODO : Fill pduInfo using PUSCH PDU. Currently hardcoding */
    pduInfo = &rxDataInd->pdus[idx];
-   pduInfo->handle = 100;
-   pduInfo->rnti = 100;
+   pduInfo->handle = ueIdx + ODU_START_CRNTI;
+   pduInfo->rnti = ueIdx + ODU_START_CRNTI;
    pduInfo->harqId = 1;
    /* Since user data size = 50bytes and 2 bytes of MAC header and 3 byte of RLC header, 
     * setting tbsize = 56 from Table 5.1.3.2-1 spec 38.214 */
index a3c37cd..752c2f1 100644 (file)
@@ -144,6 +144,10 @@ void *l1ConsoleHandler(void *args)
    char ch, ch1;
    uint8_t drbIdx = 0, lcgIdx = 0, ueIdx = 0;
    LcgBufferSize lcgBS[MAX_NUM_LOGICAL_CHANNEL_GROUPS];
+   /* The below variable is taken for sending specific number of UL Packets  
+    * For sendind 4500 Ul packets for three UEs the calculation of
+    * [counter * NUM_DRB_TO_PUMP_DATA * MAX_NUM_UE * NUM_UL_PACKETS] must be equal to 4500 */
+   uint32_t counter=500; 
 
    while(true)
    {
@@ -151,11 +155,21 @@ void *l1ConsoleHandler(void *args)
       ch = getchar();
       if(ch == 'd')
       {
-         /* Start Pumping data from PHY stub to DU */
-         for(drbIdx = 0; drbIdx < NUM_DRB_TO_PUMP_DATA; drbIdx++) //Number of DRB times the loop will run
+         while(counter)
          {
-            DU_LOG("\nDEBUG  --> PHY STUB: Sending UL User Data[DrbId:%d]",drbIdx);
-            l1SendUlUserData(drbIdx);
+            /* Start Pumping data from PHY stub to DU */
+            for(drbIdx = 0; drbIdx < NUM_DRB_TO_PUMP_DATA; drbIdx++) //Number of DRB times the loop will run
+            {
+               for(ueIdx=0; ueIdx<MAX_NUM_UE; ueIdx++)
+               {
+                  DU_LOG("\nDEBUG  --> PHY STUB: Sending UL User Data[DrbId:%d] for UEId %d\n",drbIdx,ueIdx);
+                  l1SendUlUserData(drbIdx,ueIdx);
+                  /* TODO :- sleep(1) will be removed once we will be able to
+                   * send continuous data packet */
+                  sleep(1);
+               }
+            }
+            counter--;
          }
       }
       else if(ch =='c')