[Epic-ID: ODUHIGH-405][Task-ID: ODUHIGH-425] Changes in Ue Context Modification 21/7921/9
authorlal.harshita <Harshita.Lal@radisys.com>
Tue, 22 Mar 2022 08:26:08 +0000 (13:56 +0530)
committerlal.harshita <Harshita.Lal@radisys.com>
Sun, 27 Mar 2022 17:32:21 +0000 (23:02 +0530)
request for HO

Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
Change-Id: I3ce15a4c4de39d7f021485874f37057a1679d4a1
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
14 files changed:
src/5gnrmac/mac.h
src/5gnrmac/mac_msg_hdl.c
src/5gnrmac/mac_ue_mgr.c
src/5gnrrlc/rlc_msg_hdl.c
src/5gnrsch/sch.c
src/5gnrsch/sch.h
src/5gnrsch/sch_ue_mgr.c
src/cm/du_app_mac_inf.h
src/cm/mac_sch_interface.h
src/cu_stub/cu_f1ap_msg_hdl.c
src/cu_stub/cu_f1ap_msg_hdl.h
src/du_app/du_f1ap_msg_hdl.c
src/du_app/du_mgr.h
src/du_app/du_ue_mgr.c

index 3067cde..9ee975f 100644 (file)
@@ -214,6 +214,7 @@ typedef struct macUeCb
    MacBsrTmrCfg bsrTmrCfg;  /* BSR Timer Info */
    UeUlCb       ulInfo;   /* UE specific UL info */
    UeDlCb       dlInfo;   /* UE specific DL info */
+   DataTransmissionAction transmissionAction;
 }MacUeCb;
 
 struct macCellCb
index e59e9bb..e8ba973 100644 (file)
@@ -186,14 +186,26 @@ uint8_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd)
  * ****************************************************************/
 uint8_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd)
 {
-   uint16_t pduIdx;
+   uint8_t ueId = 0;
+   uint16_t pduIdx, cellIdx = 0;
    DU_LOG("\nDEBUG  -->  MAC : Received Rx Data indication");
    /* TODO : compare the handle received in RxDataInd with handle send in PUSCH
     * PDU, which is stored in raCb */
 
    for(pduIdx = 0; pduIdx < rxDataInd->numPdus; pduIdx++)
    {
-      unpackRxData(rxDataInd->cellId, rxDataInd->timingInfo, &rxDataInd->pdus[pduIdx]);
+     
+      GET_CELL_IDX(rxDataInd->cellId, cellIdx);
+      GET_UE_ID(rxDataInd->pdus[pduIdx].rnti, ueId);
+      
+      if(macCb.macCell[cellIdx] && macCb.macCell[cellIdx]->ueCb[ueId -1].transmissionAction == STOP_TRANSMISSION)
+      {
+         DU_LOG("\nINFO   -->  MAC : UL data transmission not allowed for UE %d", macCb.macCell[cellIdx]->ueCb[ueId -1].duUeF1apId);
+      }
+      else
+      {
+         unpackRxData(rxDataInd->cellId, rxDataInd->timingInfo, &rxDataInd->pdus[pduIdx]);
+      }
       MAC_FREE_SHRABL_BUF(pst->region, pst->pool, rxDataInd->pdus[pduIdx].pduData,\
          rxDataInd->pdus[pduIdx].pduLength);
    }
@@ -771,10 +783,8 @@ uint8_t buildAndSendSrInd(UciInd *macUciInd, uint8_t crnti)
  * ****************************************************************/
 uint8_t FapiMacUciInd(Pst *pst, UciInd *macUciInd)
 {
-   uint8_t     pduIdx = 0;
-   uint8_t     ret = ROK;
-   uint16_t    nPdus;
-   uint16_t    crnti;
+   uint8_t     pduIdx = 0, ret = ROK;
+   uint16_t    nPdus = 0, crnti = 0;
 
    if(macUciInd)
    {
@@ -789,8 +799,8 @@ uint8_t FapiMacUciInd(Pst *pst, UciInd *macUciInd)
                if(macUciInd->pdus[pduIdx].uci.uciPucchF0F1.srInfo.srIndPres)
                {
                   DU_LOG("\nDEBUG  -->  MAC : Received SR UCI indication");
-                 crnti = macUciInd->pdus[pduIdx].uci.uciPucchF0F1.crnti; 
-                 ret = buildAndSendSrInd(macUciInd, crnti);
+                  crnti = macUciInd->pdus[pduIdx].uci.uciPucchF0F1.crnti; 
+                  ret = buildAndSendSrInd(macUciInd, crnti);
                }
                break;
             case UCI_IND_PUCCH_F2F3F4:
index 6950bf3..a201e52 100644 (file)
@@ -1618,7 +1618,7 @@ uint8_t fillSchUeCfg(Pst *pst, SchUeCfg *schUeCfg, MacUeCfg *ueCfg)
    schUeCfg->cellId = ueCfg->cellId;
    schUeCfg->duUeF1apId = ueCfg->duUeF1apId;
    schUeCfg->crnti = ueCfg->crnti;
-
+   schUeCfg->dataTransmissionInfo = ueCfg->transmissionAction;
    /* Copy MAC cell group config */
    if(ueCfg->macCellGrpCfgPres == true)
    {
@@ -2012,6 +2012,7 @@ uint8_t fillMacUeCb(MacUeCb *ueCb, MacUeCfg *ueCfg, uint8_t cellIdx)
    {
       DU_LOG("\nERROR  -->  MAC: Failed while filing MAC LC List at fillMacUeCb()");
    }
+   ueCb->transmissionAction = ueCfg->transmissionAction;
    return ret;
 }
 
index 9fbb0d7..d73f833 100644 (file)
@@ -65,6 +65,7 @@ uint8_t fillRlcUeCfgRsp(RlcUeCfgRsp *rlcCfgRsp, RlcCfgCfmInfo *rlcCRsp)
  
    rlcCfgRsp->cellId = rlcCRsp->cellId;
    rlcCfgRsp->ueId   = rlcCRsp->ueId;
+   rlcCfgRsp->result = RLC_DU_APP_RSP_OK;
    for(idx = 0; idx < rlcCRsp->numEnt; idx++)
    {
       if(rlcCRsp->entCfgCfm[idx].status.status == CKW_CFG_CFM_OK)
@@ -230,7 +231,7 @@ uint8_t fillRlcCfg(RlcCb *gCb, RlcCfgInfo *rlcUeCfg, RlcUeCfg *ueCfg)
    rlcUeCfg->cellId  = ueCfg->cellId;
    rlcUeCfg->numEnt  = ueCfg->numLcs;
    rlcUeCfg->transId = getTransId();
-
+   
    for(lcIdx = 0; lcIdx < rlcUeCfg->numEnt; lcIdx++)
    {
       if(fillLcCfg(gCb, &rlcUeCfg->entCfg[lcIdx], &ueCfg->rlcLcCfg[lcIdx]) != ROK)
index 69e7c19..ac474c7 100644 (file)
@@ -962,6 +962,12 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo)
 
    GET_UE_ID(dlBoInfo->crnti, ueId);
    ueCb = &cell->ueCb[ueId-1];
+   if(ueCb->ueCfg.dataTransmissionAction == STOP_DATA_TRANSMISSION)
+   {
+      DU_LOG("INFO  --> SCH : DL Data transmission not allowed for UE %d", ueCb->ueCfg.duUeF1apId);
+      return ROK;
+   }
+   
    lcId  = dlBoInfo->lcId;
    CHECK_LCID(lcId, isLcIdValid);
    if(isLcIdValid == FALSE)
@@ -997,8 +1003,6 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo)
    }
    else
    {
-      /* TODO : These part of changes will be corrected during DL scheduling as
-       * per K0 - K1 -K2 */
       SET_ONE_BIT(ueId, cell->boIndBitMap);
       if(ueCb->dlInfo.dlLcCtxt[lcId].lcId == lcId)
       {
@@ -1064,6 +1068,12 @@ uint8_t MacSchBsr(Pst *pst, UlBufferStatusRptInd *bsrInd)
       return RFAILED;
    }
 
+   if(ueCb->ueCfg.dataTransmissionAction == STOP_DATA_TRANSMISSION)
+   {
+      DU_LOG("\nINFO --> SCH: UL Data transmission not allowed for UE %d", ueCb->ueCfg.duUeF1apId);
+      return ROK;
+   }
+   
    ueCb->bsrRcvd = true;
    /* store dataVolume per lcg in uecb */
    for(lcgIdx = 0; lcgIdx < bsrInd->numLcg; lcgIdx++)
@@ -1114,7 +1124,11 @@ uint8_t MacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd)
       DU_LOG("\nERROR  -->  SCH : Crnti %d is inactive", uciInd->crnti);
       return ROK;  
    }
-
+   if(ueCb->ueCfg.dataTransmissionAction == STOP_DATA_TRANSMISSION)
+   {
+      DU_LOG("\nINFO --> SCH: UL Data transmission not allowed for UE %d", ueCb->ueCfg.duUeF1apId);
+      return ROK;
+   }
    if(uciInd->numSrBits)
    {
       ueCb->srRcvd = true;
index 865bc0e..e1d8ad8 100644 (file)
@@ -231,6 +231,7 @@ typedef struct schUeCfgCb
    SchAmbrCfg         *ambrCfg;
    SchModulationInfo  dlModInfo;
    SchModulationInfo  ulModInfo;
+   SchDataTransmission dataTransmissionAction;
 }SchUeCfgCb;
 
 /*Following structures to keep record and estimations of PRB allocated for each
index 83856f7..fa4ce2e 100644 (file)
@@ -261,6 +261,7 @@ uint8_t fillSchUeCb(Inst inst, SchUeCb *ueCb, SchUeCfg *ueCfg)
    ueCb->ueCfg.cellId = ueCfg->cellId;
    ueCb->ueCfg.duUeF1apId = ueCfg->duUeF1apId;
    ueCb->ueCfg.crnti = ueCfg->crnti;
+   ueCb->ueCfg.dataTransmissionAction = ueCfg->dataTransmissionInfo;
    if(ueCfg->macCellGrpCfgPres == true)
    {
       memcpy(&ueCb->ueCfg.macCellGrpCfg , &ueCfg->macCellGrpCfg, sizeof(SchMacCellGrpCfg)); 
index f4d185d..abaaab1 100644 (file)
@@ -521,6 +521,13 @@ typedef enum
    RSRC_RRC_CONNECTED_USERS
 }ResourceType;
 
+typedef enum
+{
+   TRANSMISSION_ALLOWED,
+   STOP_TRANSMISSION,
+   RESTART_TRANSMISSION
+}DataTransmissionAction;
+
 typedef struct failureCause
 {
    CauseGrp   type;
@@ -1260,6 +1267,7 @@ typedef struct macUeCfg
    uint8_t numLcs;
    LcCfg lcCfgList[MAX_NUM_LC];
    UeCfgState macUeCfgState;    /* InActive / Completed */
+   DataTransmissionAction transmissionAction;
 }MacUeCfg;
 
 typedef struct nrcgi
index 9bea28b..0bb6dac 100644 (file)
@@ -428,6 +428,13 @@ typedef enum
    BOTH
 }DlPduType;
 
+typedef enum
+{
+   DATA_TRANSMISSION_ALLOWED,
+   STOP_DATA_TRANSMISSION,
+   RESTART_DATA_TRANSMISSION
+}SchDataTransmission;
+
 /*structures*/
 typedef struct timeDomainAlloc
 {
@@ -1578,6 +1585,7 @@ typedef struct schUeCfg
    SchModulationInfo  ulModInfo;
    uint8_t            numLcs;
    SchLcCfg           schLcCfg[MAX_NUM_LC];
+   SchDataTransmission dataTransmissionInfo;
 }SchUeCfg;
 
 typedef struct schUeCfgRsp
index 30c4927..2bf96de 100644 (file)
@@ -1179,6 +1179,22 @@ uint8_t fillDlCcchRrcMsg(CuUeCb *ueCb, RRCContainer_t *rrcContainer)
    }
 }
 
+/*******************************************************************
+ *
+ * @brief Fills QOS flow configuration  
+ *
+ * @details
+ *
+ *    Function : fillQosFlowsToAdd
+ *
+ *    Functionality: Fills QOS flow configuration
+ *
+ * @params[in] struct SDAP_Config__mappedQoS_FlowsToAdd *qosFlow 
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
 uint8_t fillQosFlowsToAdd(struct SDAP_Config__mappedQoS_FlowsToAdd *qosFlow)
 {
    uint8_t idx, ied, elementCnt;
@@ -6063,6 +6079,17 @@ uint8_t BuildRlcBearerToAddModList(CuUeCb *ueCb, struct CellGroupConfigRrc__rlc_
       }
    }
 
+   if(!elementCnt)
+   {
+      DU_LOG("INFO  --> F1AP : No  RLC Bearer available to add or modify");
+      return ROK;
+   }
+   CU_ALLOC(rlcBearerList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
+   if(!rlcBearerList)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in CellGrpConfig");
+      return RFAILED;
+   }
    rlcBearerList->list.count = elementCnt;
    rlcBearerList->list.size  = elementCnt * sizeof(struct RLC_BearerConfig *);
 
@@ -6137,7 +6164,7 @@ uint8_t BuildRlcBearerToAddModList(CuUeCb *ueCb, struct CellGroupConfigRrc__rlc_
 
    for(drbIdx=0; drbIdx < ueCb->numDrb; drbIdx++)
    {
-      if(!updateAllRbCfg && ueCb->srbList[srbIdx].cfgSentToUe)
+      if(!updateAllRbCfg && ueCb->drbList[drbIdx].cfgSentToUe)
          continue;
 
       rlcBearerList->list.array[idx]->logicalChannelIdentity = ueCb->drbList[drbIdx].lcId;
@@ -6412,12 +6439,7 @@ uint8_t fillCellGrpCfg(CuUeCb *ueCb, OCTET_STRING_t *cellGrp, bool updateAllRbCf
       cellGrpCfg.cellGroupId = CELL_GRP_ID;
 
       cellGrpCfg.rlc_BearerToAddModList = NULLP;
-      CU_ALLOC(cellGrpCfg.rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
-      if(!cellGrpCfg.rlc_BearerToAddModList)
-      {
-         DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in CellGrpConfig");
-         break;
-      }
+      
       if(BuildRlcBearerToAddModList(ueCb, cellGrpCfg.rlc_BearerToAddModList, updateAllRbCfg) != ROK)
       {
          DU_LOG("\nERROR  -->  F1AP : fillCellGrpCfg failed");
@@ -7610,19 +7632,32 @@ void freeRrcReconfig(RRCReconfiguration_t *rrcReconfig)
  * ****************************************************************/
 uint8_t fillSrbToAddModList(CuUeCb *ueCb, SRB_ToAddModList_t *srbToAddList, bool updateAllRbCfg)
 {
-   uint8_t srbIdx, srbDbIdx;
+   uint8_t srbIdx, srbDbIdx, elementCnt = 0;
 
    if(updateAllRbCfg)
-      srbToAddList->list.count = ueCb->numSrb;
+      elementCnt = ueCb->numSrb;
    else
    {
-      srbToAddList->list.count = 0;
       for(srbDbIdx=0; srbDbIdx < ueCb->numSrb; srbDbIdx++)
       {
          if(ueCb->srbList[srbDbIdx].cfgSentToUe == false)
-            srbToAddList->list.count++;
+            elementCnt++;
       }
    }
+
+   if(!elementCnt)
+   {
+      DU_LOG("INFO  --> F1AP : No SRB available to add or modify");
+      return ROK;
+   }
+
+   CU_ALLOC(srbToAddList, sizeof(SRB_ToAddModList_t));
+   if(!srbToAddList)
+   {
+      DU_LOG("\nERROR  -->  F1AP: Memory allocation failed for SRB to AddMod List in fillRadioBearerConfig");
+      return RFAILED;
+   }
+   srbToAddList->list.count = elementCnt;
    srbToAddList->list.size = srbToAddList->list.count * sizeof(SRB_ToAddMod_t *);
 
    CU_ALLOC(srbToAddList->list.array, srbToAddList->list.size);
@@ -7696,19 +7731,34 @@ uint8_t fillSrbToAddModList(CuUeCb *ueCb, SRB_ToAddModList_t *srbToAddList, bool
  * ****************************************************************/
 uint8_t fillDrbToAddModList(CuUeCb *ueCb, DRB_ToAddModList_t *drbToAddList, bool updateAllRbCfg)
 {
-   uint8_t drbIdx, drbDbIdx;
+   uint8_t drbIdx, drbDbIdx, elementCnt = 0;
 
    if(updateAllRbCfg)
-      drbToAddList->list.count = ueCb->numDrb;
+      elementCnt = ueCb->numDrb;
    else
    {
-      drbToAddList->list.count = 0;
       for(drbDbIdx=0; drbDbIdx < ueCb->numDrb; drbDbIdx++)
       {     
          if(ueCb->drbList[drbDbIdx].cfgSentToUe == false)
-            drbToAddList->list.count++;
+            elementCnt++;
       }     
    }
+
+   if(!elementCnt)
+   {
+      DU_LOG("INFO  --> F1AP : No DRB available to add or modify");
+      return ROK;
+   }
+   
+   /* DRB To Add/Mod List */
+   CU_ALLOC(drbToAddList, sizeof(DRB_ToAddModList_t));
+   if(!drbToAddList)
+   {
+      DU_LOG("\nERROR  -->  F1AP: Memory allocation failed for DRB to AddMod List in fillRadioBearerConfig");
+      return RFAILED;
+   }
+
+   drbToAddList->list.count = elementCnt;
    drbToAddList->list.size = drbToAddList->list.count * sizeof(DRB_ToAddMod_t *);
 
    CU_ALLOC(drbToAddList->list.array, drbToAddList->list.size);
@@ -7815,24 +7865,11 @@ uint8_t fillDrbToAddModList(CuUeCb *ueCb, DRB_ToAddModList_t *drbToAddList, bool
 uint8_t fillRadioBearerConfig(CuUeCb *ueCb, RadioBearerConfig_t *radioBearerConfig, bool updateAllRbCfg)
 {
    /* SRB To Add/Mod List */
-   CU_ALLOC(radioBearerConfig->srb_ToAddModList, sizeof(SRB_ToAddModList_t));
-   if(!radioBearerConfig->srb_ToAddModList)
-   {
-      DU_LOG("\nERROR  -->  F1AP: Memory allocation failed for SRB to AddMod List in fillRadioBearerConfig");
-      return RFAILED;
-   }
    if(fillSrbToAddModList(ueCb, radioBearerConfig->srb_ToAddModList, updateAllRbCfg) != ROK)
    {
       return RFAILED;
    }
 
-   /* DRB To Add/Mod List */
-   CU_ALLOC(radioBearerConfig->drb_ToAddModList, sizeof(DRB_ToAddModList_t));
-   if(!radioBearerConfig->drb_ToAddModList)
-   {
-      DU_LOG("\nERROR  -->  F1AP: Memory allocation failed for DRB to AddMod List in fillRadioBearerConfig");
-      return RFAILED;
-   }
    if(fillDrbToAddModList(ueCb, radioBearerConfig->drb_ToAddModList, updateAllRbCfg) != ROK)
    {
       return RFAILED;
@@ -8618,6 +8655,12 @@ uint8_t fillHOPreparationInfoBuf(CuUeCb *ueCb, HandoverPreparationInformation_t
          return RFAILED;
       }
       ret = fillRrcReconfigBuf(ueCb, &hoPrepInfoIe->sourceConfig->rrcReconfiguration, true); 
+      
+      if(ret != ROK)
+      {
+         DU_LOG( "\nERROR  -->  F1AP : Failed to fill Rrc reconfiguration buffer");
+         return RFAILED;
+      }
 
       hoPrepInfoIe->rrm_Config = NULLP;
       hoPrepInfoIe->as_Context = NULLP;
@@ -10384,20 +10427,20 @@ void FreeDrbToBeModifiedList(DRBs_ToBeModified_List_t *drbSet)
 void FreeUeContextModicationRequest(F1AP_PDU_t *f1apMsg)
 {
    uint8_t arrIdx =0 , ieId=0; 
-   UEContextModificationRequest_t *UeContextModifyReq = NULLP;
+   UEContextModificationRequest_t *ueContextModifyReq = NULLP;
 
    if(f1apMsg)
    {
       if(f1apMsg->choice.initiatingMessage)
       {
-         UeContextModifyReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest;
-         if(UeContextModifyReq->protocolIEs.list.array)
+         ueContextModifyReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest;
+         if(ueContextModifyReq->protocolIEs.list.array)
          {
-            for( arrIdx = 0 ; arrIdx<UeContextModifyReq->protocolIEs.list.count ; arrIdx++)
+            for( arrIdx = 0 ; arrIdx<ueContextModifyReq->protocolIEs.list.count ; arrIdx++)
             {
-               if(UeContextModifyReq->protocolIEs.list.array[arrIdx])
+               if(ueContextModifyReq->protocolIEs.list.array[arrIdx])
                {
-                  ieId = UeContextModifyReq->protocolIEs.list.array[arrIdx]->id;
+                  ieId = ueContextModifyReq->protocolIEs.list.array[arrIdx]->id;
                   switch(ieId)
                   {
                      case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
@@ -10406,22 +10449,29 @@ void FreeUeContextModicationRequest(F1AP_PDU_t *f1apMsg)
                         break;
                      case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
                         {
-                           FreeDrbToBeSetupModList(&UeContextModifyReq->protocolIEs.list.array[arrIdx]->value.\
+                           FreeDrbToBeSetupModList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.\
                                  choice.DRBs_ToBeSetupMod_List);
                            break;
                         }
                      case ProtocolIE_ID_id_DRBs_ToBeModified_List:
                         {
-                           FreeDrbToBeModifiedList(&UeContextModifyReq->protocolIEs.list.array[arrIdx]->value.\
-                                 choice.DRBs_ToBeSetupMod_List);
+                           FreeDrbToBeModifiedList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.\
+                                 choice.DRBs_ToBeModified_List);
                            break;
                         }
+                    case ProtocolIE_ID_id_TransmissionActionIndicator:
+                        break;
+                    case ProtocolIE_ID_id_RRCContainer:
+                    {
+                        CU_FREE(ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.choice.RRCContainer.buf,\
+                        ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.choice.RRCContainer.size);
+                    }
 
                   }
-                  CU_FREE(UeContextModifyReq->protocolIEs.list.array[arrIdx], sizeof(UEContextModificationRequest_t));
+                  CU_FREE(ueContextModifyReq->protocolIEs.list.array[arrIdx], sizeof(UEContextModificationRequest_t));
                }         
             }
-            CU_FREE(UeContextModifyReq->protocolIEs.list.array, UeContextModifyReq->protocolIEs.list.size);
+            CU_FREE(ueContextModifyReq->protocolIEs.list.array, ueContextModifyReq->protocolIEs.list.size);
          }
          CU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
       }
@@ -10453,10 +10503,9 @@ uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *cuUeCb, UeCtxt
    CuUeCb     *ueCb = (CuUeCb *)cuUeCb;
    F1AP_PDU_t *f1apMsg = NULLP;
    UEContextModificationRequest_t *ueContextModifyReq = NULLP;
-
+   action =RESTART_DATA_TX;
    asn_enc_rval_t         encRetVal;
    DU_LOG("\nINFO  -->  F1AP : Building Ue context modification request\n");
-
    while(1)
    {
       CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
@@ -10486,6 +10535,9 @@ uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *cuUeCb, UeCtxt
          elementCnt = 3;
       else if(action == RRC_RECONFIG_COMPLETE_IND)
          elementCnt = 3;
+      else if((action == STOP_DATA_TX) || (action == RESTART_DATA_TX)) 
+         elementCnt = 5;
+
       ueContextModifyReq->protocolIEs.list.count = elementCnt;
       ueContextModifyReq->protocolIEs.list.size = elementCnt*sizeof(UEContextModificationRequest_t *);
 
@@ -10545,8 +10597,11 @@ uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *cuUeCb, UeCtxt
 
          if(ret != ROK)
          {
+            DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextModificationReq(): Failed to build drb to be modified list");
             break;
          }
+
+         /* TODO: fill the RRC reconfiguration information in RRC Contaiiner ie in case of MODIFY_UE  */
       }
       else if(action == QUERY_CONFIG)
       {
@@ -10567,6 +10622,45 @@ uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *cuUeCb, UeCtxt
          ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.RRCReconfigurationCompleteIndicator = \
             RRCReconfigurationCompleteIndicator_true;
       }
+      else if((action == STOP_DATA_TX) || (action == RESTART_DATA_TX))
+      {
+         ieIdx++;
+         if(action == STOP_DATA_TX)
+         {
+            ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_TransmissionActionIndicator;
+            ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+            ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present = \
+            UEContextModificationRequestIEs__value_PR_TransmissionActionIndicator;
+            ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.TransmissionActionIndicator = \
+            TransmissionActionIndicator_stop;
+         }
+         else if (action == RESTART_DATA_TX)
+         {
+            ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_TransmissionActionIndicator;
+            ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+            ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present = \
+            UEContextModificationRequestIEs__value_PR_TransmissionActionIndicator;
+            ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.TransmissionActionIndicator = \
+            TransmissionActionIndicator_restart;
+         }
+         ieIdx++;
+         ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_RRCContainer;
+         ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+         ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present = \
+         UEContextModificationRequestIEs__value_PR_RRCContainer;
+         if(fillRrcReconfigBuf(ueCb, &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer, true) != ROK)
+         {
+            DU_LOG( "\nERROR  -->  F1AP : Failed to fill Rrc reconfiguration buffer");
+            return RFAILED;
+         }
+
+         /* RRC delivery status request */
+         ieIdx++;
+         ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_RRCDeliveryStatusRequest;
+         ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore;
+         ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present = UEContextModificationRequestIEs__value_PR_RRCDeliveryStatusRequest;
+         ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.RRCDeliveryStatusRequest = RRCDeliveryStatusRequest_true;
+      }
 
       xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
 
index fd923c2..0ebc88d 100644 (file)
@@ -165,7 +165,8 @@ typedef enum
    MODIFY_UE,        /* Modify UE configuration at DU */
    RRC_RECONFIG_COMPLETE_IND, /* Indicate to DU that RRC Reconfiguration is complete */
    QUERY_CONFIG,     /* Query DU for its configurations */
-   STOP_DATA_TX      /* Stop data transmission from DU to a particular UE */
+   STOP_DATA_TX,      /* Stop data transmission from DU to a particular UE */
+   RESTART_DATA_TX   /* Restart data transmission from DU to a particular UE */
 }UeCtxtModAction;
 
 typedef struct f1apDb
index 1279b69..7239243 100644 (file)
@@ -13966,6 +13966,13 @@ uint8_t BuildDrbSetupModList(DRBs_SetupMod_List_t *drbSet , DuUeCfg *ueCfg)
    struct DRBs_SetupMod_ItemIEs *drbItemIe;
 
    drbCnt = ueCfg->numDrbSetupMod;
+
+   if(!drbCnt)
+   {
+      DU_LOG("\nINFO  -->  F1AP : BuildDrbToBeSetupModList(): No DRB information to avaialble to add");
+      return ROK;
+   }
+
    drbSet->list.count = drbCnt;
    drbSet->list.size = drbCnt * sizeof(DRBs_SetupMod_ItemIEs_t *);
    DU_ALLOC(drbSet->list.array, drbSet->list.size);
@@ -14162,7 +14169,12 @@ uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb)
       ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
   
       if(ueCb->f1UeDb->actionType == UE_CTXT_MOD)
-         elementCnt = 3;
+      {
+         if(ueCb->f1UeDb->duUeCfg.numDrbSetupMod)
+            elementCnt =3;
+         else
+            elementCnt =2;
+      }
       if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
          elementCnt = 5;
       if(ueCb->f1UeDb->actionType == UE_CTXT_RRC_RECFG_COMPLETE)
@@ -14213,28 +14225,31 @@ uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb)
       }
 
       if((ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY) || (ueCb->f1UeDb->actionType == UE_CTXT_MOD))
-      {
-         ieIdx++;
-         ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_SetupMod_List;
-         ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
-         ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
-                                                                           UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List;
-         if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
-         {
-            for(tnlIdx = 0; tnlIdx < duCb.numTeId; tnlIdx++)
+      { 
+         if(ueCb->f1UeDb->duUeCfg.numDrbSetupMod)
+         {
+            ieIdx++;
+            ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_SetupMod_List;
+            ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+            ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
+                                                                              UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List;
+            if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
             {
-               if(duCb.upTnlCfg[tnlIdx]->ueId == ueCb->gnbDuUeF1apId)
+               for(tnlIdx = 0; tnlIdx < duCb.numTeId; tnlIdx++)
                {
-                  memcpy(&ueCb->f1UeDb->duUeCfg.upTnlInfo[ueCb->f1UeDb->duUeCfg.numDrbSetupMod++], duCb.upTnlCfg[tnlIdx], sizeof(UpTnlCfg));
+                  if(duCb.upTnlCfg[tnlIdx]->ueId == ueCb->gnbDuUeF1apId)
+                  {
+                     memcpy(&ueCb->f1UeDb->duUeCfg.upTnlInfo[ueCb->f1UeDb->duUeCfg.numDrbSetupMod++], duCb.upTnlCfg[tnlIdx], sizeof(UpTnlCfg));
+                  }
                }
             }
-         }
-         ret = BuildDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
-                  value.choice.DRBs_SetupMod_List) , &ueCb->f1UeDb->duUeCfg);
-         if(ret != ROK)
-         {
-            DU_LOG( "\nERROR  -->  F1AP : Failed to build DRB setupmod List ");
-            break;
+            ret = BuildDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
+                     value.choice.DRBs_SetupMod_List) , &ueCb->f1UeDb->duUeCfg);
+            if(ret != ROK)
+            {
+               DU_LOG( "\nERROR  -->  F1AP : Failed to build DRB setupmod List ");
+               break;
+            }
          }
       }
 
@@ -14520,17 +14535,17 @@ void freeAperDecodeDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet)
  * @return void
  *
  * ****************************************************************/
-void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *UeContextModifyReq )
+void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *ueContextModifyReq )
 {
    uint8_t arrIdx, ieId;
 
-   if(UeContextModifyReq->protocolIEs.list.array)
+   if(ueContextModifyReq->protocolIEs.list.array)
    {
-      for( arrIdx = 0 ; arrIdx<UeContextModifyReq->protocolIEs.list.count ; arrIdx++)
+      for( arrIdx = 0 ; arrIdx<ueContextModifyReq->protocolIEs.list.count ; arrIdx++)
       {
-         if(UeContextModifyReq->protocolIEs.list.array[arrIdx])
+         if(ueContextModifyReq->protocolIEs.list.array[arrIdx])
          {
-            ieId = UeContextModifyReq->protocolIEs.list.array[arrIdx]->id;
+            ieId = ueContextModifyReq->protocolIEs.list.array[arrIdx]->id;
             switch(ieId)
             {
                case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
@@ -14539,15 +14554,21 @@ void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *U
                   break;
                case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
                   {
-                     freeAperDecodeDrbToBeSetupModList(&UeContextModifyReq->protocolIEs.list.array[arrIdx]->\
+                     freeAperDecodeDrbToBeSetupModList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->\
                            value.choice.DRBs_ToBeSetupMod_List);
                      break;
                   }
+               case ProtocolIE_ID_id_TransmissionActionIndicator:
+                  break;
+               case ProtocolIE_ID_id_RRCContainer:
+                  {
+                     free(ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.choice.RRCContainer.buf);
+                  }
             }
-            free(UeContextModifyReq->protocolIEs.list.array[arrIdx]);
+            free(ueContextModifyReq->protocolIEs.list.array[arrIdx]);
          }
       }
-      free(UeContextModifyReq->protocolIEs.list.array);
+      free(ueContextModifyReq->protocolIEs.list.array);
    }
 }
 /*******************************************************************
@@ -14600,6 +14621,7 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
                            {
                               DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
                               duUeCb->f1UeDb->cellIdx = cellIdx;
+                              duUeCb->f1UeDb->actionType = UE_CTXT_MOD;
                            }
                            break;
                         }
@@ -14613,12 +14635,34 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
                }
                break;
             }
+
+         case ProtocolIE_ID_id_RRCContainer:
+            {
+               /* 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,\
+                        &ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
+                        value.choice.RRCContainer);
+               }
+
+               break;
+            }
+
          case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
          case ProtocolIE_ID_id_DRBs_ToBeModified_List:
             {
                if(duUeCb->f1UeDb)
                {
-                  duUeCb->f1UeDb->actionType = UE_CTXT_MOD;
                   if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present ==\
                         UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List)
                   {
@@ -14669,6 +14713,31 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
                }
                break;
             }
+         case ProtocolIE_ID_id_TransmissionActionIndicator:
+            {
+               if(duUeCb->f1UeDb)
+               {
+                  if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.TransmissionActionIndicator  == TransmissionActionIndicator_stop)
+                  {
+                     duUeCb->f1UeDb->duUeCfg.dataTransmissionAction = STOP_TRANSMISSION; 
+                  }
+                  else 
+                  {
+                     duUeCb->f1UeDb->duUeCfg.dataTransmissionAction = RESTART_TRANSMISSION; 
+                  }
+               }
+               break;
+            }
+
+         case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
+            {
+               if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
+               {
+                  duUeCb->f1UeDb->dlRrcMsg->deliveryStatRpt = true;
+               }
+               break;
+            }
+              
       }
    }
 
index c294cb8..5f02a2c 100644 (file)
@@ -139,6 +139,7 @@ typedef struct duUeCfg
    UpTnlCfg upTnlInfo[MAX_NUM_DRB];  /* User plane TNL Info*/
    uint8_t numDrbSetupMod;        /*No. of DRB Added during Modification*/
    MacUeCfg copyOfmacUeCfg;
+   DataTransmissionAction dataTransmissionAction; 
 }DuUeCfg;
 
 typedef struct f1UeContextSetup
index 7a55d58..96a496f 100644 (file)
@@ -1223,12 +1223,19 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t gnbDuUef1apId, uint16_t crnti, DuU
    }
    else
    {
+      if(ueCfgDb->dataTransmissionAction == STOP_TRANSMISSION)
+      {
+         macUeCfg->transmissionAction = ueCfgDb->dataTransmissionAction; 
+         return ROK;
+      }
+      
       /* Fetching MacDb from DuUeCb.
        * In case of UE hand-in, UE context is created before RRC setup. Hence
        * crnti is not known yet. Thus, passing crnti=0 to this function.
        * In such a case actvCellLst doesnt yet have any entry for this UE. So
        * duMacDb will be NULL.
        */
+      
       if(crnti != 0)
       {
          GET_CELL_IDX(cellId, cellIdx);
@@ -1241,7 +1248,7 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t gnbDuUef1apId, uint16_t crnti, DuU
          }
          duMacDb->macUeCfgState = UE_CFG_INPROGRESS;
       }
-
+      
       if(ueCfgDb->cellGrpCfg)
       {
          ret = procUeReCfgCellInfo(macUeCfg, duMacDb, ueCfgDb->cellGrpCfg);
@@ -1671,6 +1678,7 @@ uint8_t fillRlcUeCfg(uint16_t cellId, uint8_t ueId, DuUeCfg *ueCfgDb, RlcUeCfg *
       /*Filling RlcUeCfg */
       rlcUeCfg->cellId       = cellId;
       rlcUeCfg->ueId         = ueId;
+
       for(dbIdx = 0; (dbIdx < ueCfgDb->numRlcLcs && ret == ROK); dbIdx++)
       {
          ret = fillDefaultRlcModeCfg(ueCfgDb->rlcLcCfg[dbIdx].rlcMode, &ueCfgDb->rlcLcCfg[dbIdx]);