JIRA ID = ODUHIGH-298 RB configuration at MAC/SCH/RLC for ue modification
[o-du/l2.git] / src / 5gnrmac / mac_ue_mgr.c
index 1bee3b5..7ede4a5 100644 (file)
@@ -1606,36 +1606,46 @@ uint8_t fillSchUeCfg(Pst *pst, SchUeCfg *schUeCfg, MacUeCfg *ueCfg)
    schUeCfg->crnti = ueCfg->crnti;
 
    /* Copy MAC cell group config */
-   memset(&schUeCfg->macCellGrpCfg, 0, sizeof(SchMacCellGrpCfg));
-   if(fillMacCellGroupCfg(ueCfg->macCellGrpCfg, &schUeCfg->macCellGrpCfg) != ROK)
+   if(ueCfg->macCellGrpCfgPres == true)
    {
-      DU_LOG("\nERROR  -->  MAC : fillMacCellGroupCfg() failed");
-      return RFAILED;
+      schUeCfg->macCellGrpCfgPres = true;
+      memset(&schUeCfg->macCellGrpCfg, 0, sizeof(SchMacCellGrpCfg));
+      if(fillMacCellGroupCfg(ueCfg->macCellGrpCfg, &schUeCfg->macCellGrpCfg) != ROK)
+      {
+         DU_LOG("\nERROR  -->  MAC : fillMacCellGroupCfg() failed");
+         return RFAILED;
+      }
    }
-
-   /* Copy Physical cell group config */
-   memset(&schUeCfg->phyCellGrpCfg, 0,sizeof(SchPhyCellGrpCfg));
-   if(fillPhyCellGroupCfg(ueCfg->phyCellGrpCfg, &schUeCfg->phyCellGrpCfg) != ROK)
+   if(ueCfg->phyCellGrpCfgPres == true)
    {
-      DU_LOG("\nERROR  -->  MAC : fillPhyCellGroupCfg() failed");
-      return RFAILED;
+     schUeCfg->phyCellGrpCfgPres = true;
+     /* Copy Physical cell group config */
+      memset(&schUeCfg->phyCellGrpCfg, 0,sizeof(SchPhyCellGrpCfg));
+      if(fillPhyCellGroupCfg(ueCfg->phyCellGrpCfg, &schUeCfg->phyCellGrpCfg) != ROK)
+      {
+         DU_LOG("\nERROR  -->  MAC : fillPhyCellGroupCfg() failed");
+         return RFAILED;
+      }
    }
 
-   /* Copy sp cell config */
-   memset(&schUeCfg->spCellCfg, 0, sizeof(SchSpCellCfg));
-   if(fillSpCellCfg(ueCfg->spCellCfg, &schUeCfg->spCellCfg) != ROK)
+   if(ueCfg->spCellCfgPres == true)
    {
-      DU_LOG("\nERROR  -->  MAC : fillSpCellCfg() failed");
-      return RFAILED;
+      schUeCfg->spCellCfgPres = true;
+      /* Copy sp cell config */
+      memset(&schUeCfg->spCellCfg, 0, sizeof(SchSpCellCfg));
+      if(fillSpCellCfg(ueCfg->spCellCfg, &schUeCfg->spCellCfg) != ROK)
+      {
+         DU_LOG("\nERROR  -->  MAC : fillSpCellCfg() failed");
+         return RFAILED;
+      }
    }
-
    if(ueCfg->ambrCfg != NULLP)
    {
       MAC_ALLOC(schUeCfg->ambrCfg, sizeof(SchAmbrCfg));
       if(!schUeCfg->ambrCfg)
       {
-        DU_LOG("\nERROR  -->  MAC : Memory allocation failed in sendReconfigReqToSch");
-        return RFAILED;
+         DU_LOG("\nERROR  -->  MAC : Memory allocation failed in sendReconfigReqToSch");
+         return RFAILED;
       }
       schUeCfg->ambrCfg->ulBr = ueCfg->ambrCfg->ulBr;
    }
@@ -1811,13 +1821,19 @@ uint8_t fillMacUeCb(MacUeCb *ueCb, MacUeCfg *ueCfg, uint8_t cellIdx)
    ueCb->ueIdx = ueCfg->ueIdx;
    ueCb->crnti = ueCfg->crnti;
    ueCb->cellCb = macCb.macCell[cellIdx];
-   ueCb->dlInfo.dlHarqEnt.numHarqProcs = \
+   if(ueCfg->spCellCfgPres)
+   {
+      ueCb->dlInfo.dlHarqEnt.numHarqProcs = \
       ueCfg->spCellCfg.servCellCfg.pdschServCellCfg.numHarqProcForPdsch; 
+   }
    ueCb->state = UE_STATE_ACTIVE;
    /*TODO: To check the bsr value during implementation */
-   ueCb->bsrTmrCfg.periodicTimer = ueCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer;
-   ueCb->bsrTmrCfg.retxTimer     = ueCfg->macCellGrpCfg.bsrTmrCfg.retxTimer;
-   ueCb->bsrTmrCfg.srDelayTimer  = ueCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer;
+   if(ueCfg->macCellGrpCfgPres)
+   {
+      ueCb->bsrTmrCfg.periodicTimer = ueCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer;
+      ueCb->bsrTmrCfg.retxTimer     = ueCfg->macCellGrpCfg.bsrTmrCfg.retxTimer;
+      ueCb->bsrTmrCfg.srDelayTimer  = ueCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer;
+   }
    ret = fillMacLcCfgList(ueCb, ueCfg);
    if(ret == RFAILED)
    {
@@ -2361,20 +2377,20 @@ uint8_t MacProcUeReconfigReq(Pst *pst, MacUeCfg *ueCfg)
       if(ret == ROK)
       {
          /*Sending Cfg Req to SCH */
-        ret = fillSchUeCfg(pst, &schUeCfg, ueCfg);
-        if(ret != ROK)
-           DU_LOG("\nERROR  -->  MAC : Failed to fill sch Ue Cfg at MacProcUeReconfigReq()");
+         ret = fillSchUeCfg(pst, &schUeCfg, ueCfg);
+         if(ret != ROK)
+            DU_LOG("\nERROR  -->  MAC : Failed to fill sch Ue Cfg at MacProcUeReconfigReq()");
          else
-        {
+         {
             /* Fill event and send UE create request to SCH */
             ret = sendUeReqToSch(pst, &schUeCfg);
-           if(ret != ROK)
-              DU_LOG("\nERROR  -->  MAC : Failed to send UE Reconfig Request to SCH");
-        }
+            if(ret != ROK)
+               DU_LOG("\nERROR  -->  MAC : Failed to send UE Reconfig Request to SCH");
+         }
       }
       else 
       {
-        DU_LOG("\nERROR  -->  MAC : Failed to store MAC UE Cb ");
+         DU_LOG("\nERROR  -->  MAC : Failed to store MAC UE Cb ");
       }
    }
    else