[Epic-ID: ODUHIGH-405][Task-ID: ODUHIGH-427] Changes in Ue Context Release Command... 05/7905/3
authorbarveankit <anbarve@radisys.com>
Sun, 6 Mar 2022 17:17:48 +0000 (22:47 +0530)
committerbarveankit <anbarve@radisys.com>
Wed, 9 Mar 2022 09:47:27 +0000 (15:17 +0530)
Signed-off-by: barveankit <anbarve@radisys.com>
Change-Id: Ic618d627e15477fd739b49aff491f3a6451e89ff
Signed-off-by: barveankit <anbarve@radisys.com>
src/cu_stub/cu_f1ap_msg_hdl.c
src/cu_stub/cu_f1ap_msg_hdl.h
src/cu_stub/cu_stub.h
src/du_app/du_f1ap_msg_hdl.c
src/du_app/du_f1ap_msg_hdl.h
src/du_app/du_ue_mgr.c

index e5bbb6e..fdf6168 100644 (file)
@@ -8438,7 +8438,9 @@ void FreeUeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
 uint8_t BuildAndSendUeContextReleaseCommand(uint32_t duId, uint8_t cuUeF1apId, uint8_t duUeF1apId)
 {
    bool       memAllocFailed = false;
 uint8_t BuildAndSendUeContextReleaseCommand(uint32_t duId, uint8_t cuUeF1apId, uint8_t duUeF1apId)
 {
    bool       memAllocFailed = false;
-   uint8_t    ieIdx = 0,elementCnt = 0, ret = RFAILED, bufLen=0;
+   uint8_t  duIdx = 0, ieIdx = 0,elementCnt = 0, ret = RFAILED, bufLen=0;
+   DuDb *duDb;
+   CuUeCb *ueCb;
    F1AP_PDU_t *f1apMsg = NULLP;
    UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
 
    F1AP_PDU_t *f1apMsg = NULLP;
    UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
 
@@ -8468,7 +8470,13 @@ uint8_t BuildAndSendUeContextReleaseCommand(uint32_t duId, uint8_t cuUeF1apId, u
 
       ueContextReleaseCommand =&f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
 
 
       ueContextReleaseCommand =&f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
 
-      elementCnt = 4;
+      SEARCH_DU_DB(duIdx, duId, duDb); 
+      ueCb = &duDb->ueCb[duUeF1apId-1];
+      if(ueCb->state == UE_HANDOVER_IN_PROGRESS)
+         elementCnt = 3;
+      else
+         elementCnt = 4;
+     
       ueContextReleaseCommand->protocolIEs.list.count = elementCnt;
       ueContextReleaseCommand->protocolIEs.list.size = elementCnt*sizeof(UEContextReleaseCommand_t*);
 
       ueContextReleaseCommand->protocolIEs.list.count = elementCnt;
       ueContextReleaseCommand->protocolIEs.list.size = elementCnt*sizeof(UEContextReleaseCommand_t*);
 
@@ -8495,6 +8503,7 @@ uint8_t BuildAndSendUeContextReleaseCommand(uint32_t duId, uint8_t cuUeF1apId, u
       {
          break;
       }
       {
          break;
       }
+
       ieIdx=0;
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
       ieIdx=0;
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
@@ -8509,34 +8518,36 @@ uint8_t BuildAndSendUeContextReleaseCommand(uint32_t duId, uint8_t cuUeF1apId, u
       UEContextReleaseCommandIEs__value_PR_GNB_DU_UE_F1AP_ID;
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =duUeF1apId;
 
       UEContextReleaseCommandIEs__value_PR_GNB_DU_UE_F1AP_ID;
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =duUeF1apId;
 
+      /* Cause of UE context release */
       ieIdx++;
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_Cause;
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore;
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.present=\
       ieIdx++;
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_Cause;
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore;
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.present=\
-      UEContextReleaseCommandIEs__value_PR_Cause;
+                                                                            UEContextReleaseCommandIEs__value_PR_Cause;
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.Cause.present = Cause_PR_radioNetwork;
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.Cause.choice.radioNetwork=\
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.Cause.present = Cause_PR_radioNetwork;
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.Cause.choice.radioNetwork=\
-      CauseRadioNetwork_normal_release;
-     
-      /* RRC Container for RRC release */
-      ieIdx++;
-      ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_RRCContainer;
-      ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore;
-      ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.present = \
-      UEContextReleaseCommandIEs__value_PR_RRCContainer;
-      char secModeBuf[7]={ 0x00, 0x05, 0x13, 0x00, 0x00, 0x00, 0x00};
-      bufLen =7;
-      ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size = bufLen;
-      CU_ALLOC(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,
-      ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
-      if(!ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
-      {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation for BuildAndSendUeContextReleaseCommand failed");
-      break;
+                                                                                                     CauseRadioNetwork_normal_release;
+      if(ueCb->state != UE_HANDOVER_IN_PROGRESS)
+      {
+         /* RRC Container for RRC release */
+         ieIdx++;
+         ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_RRCContainer;
+         ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore;
+         ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.present = \
+                                                                                 UEContextReleaseCommandIEs__value_PR_RRCContainer;
+         char secModeBuf[7]={ 0x00, 0x05, 0x13, 0x00, 0x00, 0x00, 0x00};
+         bufLen =7;
+         ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size = bufLen;
+         CU_ALLOC(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,
+               ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
+         if(!ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
+         {
+            DU_LOG("\nERROR  -->  F1AP : Memory allocation for BuildAndSendUeContextReleaseCommand failed");
+            break;
+         }
+         memset(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, 0, bufLen);
+         memcpy(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, secModeBuf, bufLen);
       }
       }
-      memset(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, 0, bufLen);
-      memcpy(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, secModeBuf, bufLen);
-      
       xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
 
       /* Encode the UE Context Release Command type as APER */
       xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
 
       /* Encode the UE Context Release Command type as APER */
index 585eb58..b9f9b41 100644 (file)
@@ -64,8 +64,8 @@ typedef enum
 /* Defines action to be performed via UE Context Modification request */
 typedef enum
 {
 /* Defines action to be performed via UE Context Modification request */
 typedef enum
 {
-   MODIFY_UE,        /* Modify UE configuration at DU */
-   QUERY_CONFIG,     /* Query DU for its configurations */
+   MODIFY_UE,         /* Modify UE configuration at DU */
+   QUERY_CONFIG,      /* Query DU for its configurations */
    STOP_DATA_TX      /* Stop data transmission from DU to a particular UE */
 }UeCtxtModAction;
 
    STOP_DATA_TX      /* Stop data transmission from DU to a particular UE */
 }UeCtxtModAction;
 
index d2c3f88..fb26740 100644 (file)
@@ -77,7 +77,7 @@
       if(cuCb.duInfo[_duIdx].duId == _duId)\
       {\
          _duDb =  (&cuCb.duInfo[_duIdx]);\
       if(cuCb.duInfo[_duIdx].duId == _duId)\
       {\
          _duDb =  (&cuCb.duInfo[_duIdx]);\
-              break; \
+         break; \
      }\
    }\
 }
      }\
    }\
 }
index 2a8cbad..b175d4a 100644 (file)
@@ -14948,8 +14948,8 @@ void freeAperDecodeUeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
 uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
 {
    uint8_t  ieIdx=0, ret=ROK, ueIdx=0;
 uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
 {
    uint8_t  ieIdx=0, ret=ROK, ueIdx=0;
-   uint16_t cellIdx =0;
-   bool ueIdxFound;
+   uint16_t cellIdx =0, cellId = 0, crnti = 0;
+   bool ueIdxFound = false;
    uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0;
    DuUeCb   *duUeCb = NULLP;
    UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
    uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0;
    DuUeCb   *duUeCb = NULLP;
    UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
@@ -14979,11 +14979,6 @@ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
                   }
 
                case ProtocolIE_ID_id_Cause:
                   }
 
                case ProtocolIE_ID_id_Cause:
-                  {
-                     break;
-                  }
-
-               case ProtocolIE_ID_id_RRCContainer:
                   {
                      for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
                      {
                   {
                      for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
                      {
@@ -14992,39 +14987,9 @@ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
                            if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
                                  (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
                            {
                            if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
                                  (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
                            {
+                              cellId = duCb.actvCellLst[cellIdx]->cellId;
+                              crnti  = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti;
                               duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
                               duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
-                              DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
-                              if(duUeCb->f1UeDb)
-                              {
-                                 memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
-                                 duUeCb->f1UeDb->actionType = UE_CTXT_RELEASE;
-                                 duUeCb->f1UeDb->cellIdx = cellIdx;
-                                 /* Filling Dl RRC Msg Info */
-                                 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
-                                 if(!duUeCb->f1UeDb->dlRrcMsg)
-                                 {
-                                    DU_LOG("\nERROR  -->  DU APP : procF1UeContextReleaseCommand(): \
-                                    Memory allocation failed ");
-                                    ret = RFAILED;
-                                 }
-                                 else
-                                 {
-                                    duUeCb->f1UeDb->dlRrcMsgPres = true;
-                                    memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
-                                    ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
-                                          &ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
-                                          value.choice.RRCContainer);
-                                 }
-
-                              }
-                              else
-                              {
-                                 DU_LOG("\nERROR  -->  DU APP : procF1UeContextReleaseCommand(): \
-                                 Memory allocation failed ");
-                                 ret = RFAILED;
-
-                              }
-
                               ueIdxFound = true;
                               break;
                            }
                               ueIdxFound = true;
                               break;
                            }
@@ -15034,13 +14999,51 @@ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
                            break;
                         }
                      }
                            break;
                         }
                      }
+                     
                      if(!ueIdxFound)
                      {
                      if(!ueIdxFound)
                      {
-                        DU_LOG("\nERROR  -->  F1AP: DuUeCb is not found at procF1UeContextReleaseCommand()");
+                        DU_LOG("\nERROR  -->  F1AP: procF1UeContextReleaseCommand(): Ue Information is not available");
                         ret = RFAILED;
                      }
                         ret = RFAILED;
                      }
+                     break;
+                  }
 
 
+               case ProtocolIE_ID_id_RRCContainer:
+                  {
+                     if(ueIdxFound == true)  
+                     {
+                        DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
+                        if(duUeCb->f1UeDb)
+                        {
+                           memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
+                           duUeCb->f1UeDb->actionType = UE_CTXT_RELEASE;
+                           duUeCb->f1UeDb->cellIdx = cellIdx;
+                           /* Filling Dl RRC Msg Info */
+                           DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
+                           if(!duUeCb->f1UeDb->dlRrcMsg)
+                           {
+                              DU_LOG("\nERROR  -->  DU APP : procF1UeContextReleaseCommand(): \
+                                    Memory allocation failed ");
+                              ret = RFAILED;
+                           }
+                           else
+                           {
+                              duUeCb->f1UeDb->dlRrcMsgPres = true;
+                              memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
+                              ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
+                                    &ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
+                                    value.choice.RRCContainer);
+                           }
+
+                        }
+                        else
+                        {
+                           DU_LOG("\nERROR  -->  DU APP : procF1UeContextReleaseCommand(): \
+                                 Memory allocation failed ");
+                           ret = RFAILED;
 
 
+                        }
+                     }
                      break;
                   }
                default :
                      break;
                   }
                default :
@@ -15053,7 +15056,7 @@ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
    }
    if(ret != RFAILED)
    {
    }
    if(ret != RFAILED)
    {
-      duProcUeContextReleaseCommand(duUeCb);
+      duProcUeContextReleaseCommand(cellId, duUeCb);
    }
    freeAperDecodeUeContextReleaseCommand(f1apMsg);
    return ret;
    }
    freeAperDecodeUeContextReleaseCommand(f1apMsg);
    return ret;
index cbc05dd..d1ca376 100644 (file)
@@ -52,7 +52,7 @@ uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint16_t crnti, DuUeCfg *
 uint8_t BuildAndSendUeContextReleaseReq(uint16_t cellId, uint8_t ueId);
 uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t  gnbCuUeF1apId, uint32_t  gnbDuUeF1apId);
 uint8_t duSendCellDeletReq(uint16_t cellId); 
 uint8_t BuildAndSendUeContextReleaseReq(uint16_t cellId, uint8_t ueId);
 uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t  gnbCuUeF1apId, uint32_t  gnbDuUeF1apId);
 uint8_t duSendCellDeletReq(uint16_t cellId); 
-uint8_t duProcUeContextReleaseCommand(DuUeCb *duUeCb);
+uint8_t duProcUeContextReleaseCommand(uint16_t cellId, DuUeCb *duUeCb);
 /**********************************************************************
          End of file
 **********************************************************************/
 /**********************************************************************
          End of file
 **********************************************************************/
index f021200..b18ee5e 100644 (file)
@@ -3268,50 +3268,44 @@ void deleteRlcUeCfg(RlcUeCfg *ueCfg)
 *         RFAILED - failure
 *
 * ****************************************************************/
 *         RFAILED - failure
 *
 * ****************************************************************/
-uint8_t duProcUeContextReleaseCommand(DuUeCb *duUeCb)
+uint8_t duProcUeContextReleaseCommand(uint16_t cellId, DuUeCb *duUeCb)
 {
    uint8_t ret =ROK, ueId=0;
 {
    uint8_t ret =ROK, ueId=0;
-   uint16_t cellId=0,crnti =0;
-   if(duUeCb == NULLP)
-   {
-      DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand() : duUeCb is null");
-      return RFAILED;
-   }
-   if(duUeCb->f1UeDb == NULLP)
-   {
-      DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand() : f1UeDb is null");
-      return RFAILED;
-   }
-   
-   cellId = duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->cellId;
-   crnti = duUeCb->crnti;
-   GET_UE_ID(crnti, ueId);
-   
-   /* Send DL RRC msg for RRC release */
-   if(duUeCb->f1UeDb->dlRrcMsg)
+   uint16_t crnti = 0;
+
+   if(duUeCb != NULLP)
    {
    {
-      if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu != NULLP)
+      crnti = duUeCb->crnti;
+      GET_UE_ID(crnti, ueId);
+      
+      if(duUeCb->f1UeDb)
       {
       {
-         ret = duBuildAndSendDlRrcMsgToRlc(cellId, duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->ueCb[ueId-1].rlcUeCfg,\
-               duUeCb->f1UeDb->dlRrcMsg);
-         if(ret == RFAILED)
+         /* Send DL RRC msg for RRC release */
+         if(duUeCb->f1UeDb->dlRrcMsg)
          {
          {
-            DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand() : Failed to send DL RRC msg");
-            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
-                  duUeCb->f1UeDb->dlRrcMsg->rrcMsgSize);
-            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
+            if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu != NULLP)
+            {
+               ret = duBuildAndSendDlRrcMsgToRlc(cellId, duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->ueCb[ueId-1].rlcUeCfg,\
+                     duUeCb->f1UeDb->dlRrcMsg);
+               if(ret == RFAILED)
+               {
+                  DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand() : Failed to send DL RRC msg");
+                  DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
+                        duUeCb->f1UeDb->dlRrcMsg->rrcMsgSize);
+                  DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
+               }
+            }
          }
       }
          }
       }
-   }
-   else
-   {
-      ret = duBuildAndSendUeDeleteReq(cellId,crnti);
-      if(ret == RFAILED)
+      else
       {
       {
-         DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand(): Failed to build and send Ue Delete request");
+         ret = duBuildAndSendUeDeleteReq(cellId,crnti);
+         if(ret == RFAILED)
+         {
+            DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand(): Failed to build and send Ue Delete request");
+         }
       }
    }
       }
    }
-
    return ret;
 }
 
    return ret;
 }