JIRA ID = ODUHIGH-298 RB configuration at MAC/SCH/RLC for ue modification 51/5751/5
authorsphoorthi <sphoorthi.dayanand@radisys.com>
Thu, 11 Mar 2021 09:10:13 +0000 (14:40 +0530)
committersphoorthi <sphoorthi.dayanand@radisys.com>
Thu, 18 Mar 2021 16:35:51 +0000 (22:05 +0530)
Change-Id: I5059c688847e4c3824aa80c0cd96a35798eb1720
Signed-off-by: sphoorthi <sphoorthi.dayanand@radisys.com>
src/5gnrmac/mac_ue_mgr.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/du_app/du_f1ap_msg_hdl.c
src/du_app/du_f1ap_msg_hdl.h
src/du_app/du_mgr.h
src/du_app/du_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
index d99f671..8cc2921 100644 (file)
@@ -168,6 +168,21 @@ typedef struct schUlCb
    SchUlLcCtxt ulLcCtxt[MAX_NUM_LC];
 }SchUlCb;
 
+typedef struct schUeCfgCb
+{
+   uint16_t        cellId;
+   uint16_t        crnti;
+   bool macCellGrpCfgPres;
+   SchMacCellGrpCfg   macCellGrpCfg;
+   bool phyCellGrpCfgPres;
+   SchPhyCellGrpCfg   phyCellGrpCfg;
+   bool spCellCfgPres;
+   SchSpCellCfg       spCellCfg;
+   SchAmbrCfg         *ambrCfg;
+   SchModulationInfo  dlModInfo;
+   SchModulationInfo  ulModInfo;
+}SchUeCfgCb;
+
 /**
  * @brief
  * UE control block
@@ -176,7 +191,7 @@ typedef struct schUeCb
 {
    uint16_t   ueIdx;
    uint16_t   crnti;
-   SchUeCfg   ueCfg;
+   SchUeCfgCb ueCfg;
    SchUeState state;
    SchCellCb  *cellCb;
    bool       srRcvd;
index 22f16a7..097e080 100644 (file)
@@ -201,41 +201,67 @@ void updateSchDlCb(uint8_t delIdx, SchDlCb *dlInfo)
 uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg)
 {
    uint8_t   lcIdx, ueLcIdx;
+  
+   ueCb->ueCfg.cellId = ueCfg->cellId;
+   ueCb->ueCfg.crnti = ueCfg->crnti;
+   if(ueCfg->macCellGrpCfgPres == true)
+   {
+      memcpy(&ueCb->ueCfg.macCellGrpCfg , &ueCfg->macCellGrpCfg, sizeof(SchMacCellGrpCfg)); 
+      ueCb->ueCfg.macCellGrpCfgPres = true;
+   }
+
+   if(ueCfg->phyCellGrpCfgPres == true)
+   {
+      memcpy(&ueCb->ueCfg.phyCellGrpCfg ,  &ueCfg->phyCellGrpCfg, sizeof(SchPhyCellGrpCfg));
+      ueCb->ueCfg.phyCellGrpCfgPres = true;
+   }
 
-   memset(&ueCb->ueCfg, 0, sizeof(SchUeCfg));
-   memcpy(&ueCb->ueCfg, ueCfg, sizeof(SchUeCfg));
+   if(ueCfg->spCellCfgPres == true)
+   {
+      memcpy(&ueCb->ueCfg.spCellCfg , &ueCfg->spCellCfg, sizeof(SchSpCellCfg));
+      ueCb->ueCfg.spCellCfgPres = true;
+   }
    ueCb->state = SCH_UE_STATE_ACTIVE;
+   if(ueCfg->ambrCfg != NULLP)
+   {
+      SCH_ALLOC(ueCb->ueCfg.ambrCfg , sizeof(SchAmbrCfg));
+      memcpy(&ueCb->ueCfg.ambrCfg->ulBr , &ueCfg->ambrCfg->ulBr, sizeof(SchAmbrCfg));
+   }
+   
+   memcpy(&ueCb->ueCfg.dlModInfo,  &ueCfg->dlModInfo , sizeof(SchModulationInfo));
+   memcpy(&ueCb->ueCfg.ulModInfo,  &ueCfg->ulModInfo , sizeof(SchModulationInfo));
 
+   //Updating SchUlCb and SchDlCb DB in SchUeCb
    for(lcIdx = 0; lcIdx < ueCfg->numLcs; lcIdx++)
    {
       if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_ADD)
       {
-        fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueCb->ulInfo.numUlLc], &ueCfg->schLcCfg[lcIdx]);
-        ueCb->ulInfo.numUlLc++;
-        fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueCb->dlInfo.numDlLc], &ueCfg->schLcCfg[lcIdx]);
-        ueCb->dlInfo.numDlLc++;
+         fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueCb->ulInfo.numUlLc], &ueCfg->schLcCfg[lcIdx]);
+         ueCb->ulInfo.numUlLc++;
+         fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueCb->dlInfo.numDlLc], &ueCfg->schLcCfg[lcIdx]);
+         ueCb->dlInfo.numDlLc++;
       }
       else
       {
-        for(ueLcIdx = 0; ueLcIdx < ueCb->ulInfo.numUlLc; ueLcIdx++) //searching for Lc to be Mod
+         for(ueLcIdx = 0; ueLcIdx < ueCb->ulInfo.numUlLc; ueLcIdx++) //searching for Lc to be Mod
          {
-           if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].lcId == ueCfg->schLcCfg[lcIdx].lcId)
-           {
-              if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_MOD)
-              {
-                 fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]);
-                 fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]);
-                 break;
-              }
+            if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].lcId == ueCfg->schLcCfg[lcIdx].lcId)
+            {
+               if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_MOD)
+               {
+                  fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]);
+                  fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]);
+                  break;
+               }
                if(ueCfg->schLcCfg[ueLcIdx].configType == CONFIG_DEL)
                {
-                 memset(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], 0, sizeof(SchUlLcCtxt));
-                 ueCb->ulInfo.numUlLc--;
-                 updateSchUlCb(ueLcIdx, &ueCb->ulInfo); //moving arr elements one idx ahead 
-                 memset(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], 0, sizeof(SchDlLcCtxt));
-                 ueCb->dlInfo.numDlLc--;
-                 updateSchDlCb(ueLcIdx, &ueCb->dlInfo); //moving arr elements one idx ahead
-                 break;
+                  memset(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], 0, sizeof(SchUlLcCtxt));
+                  ueCb->ulInfo.numUlLc--;
+                  updateSchUlCb(ueLcIdx, &ueCb->ulInfo); //moving arr elements one idx ahead 
+                  memset(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], 0, sizeof(SchDlLcCtxt));
+                  ueCb->dlInfo.numDlLc--;
+                  updateSchDlCb(ueLcIdx, &ueCb->dlInfo); //moving arr elements one idx ahead
+                  break;
                }
             }
          }/*End of inner for loop */
@@ -390,10 +416,14 @@ uint8_t schFillPuschAlloc(SchUeCb *ueCb, uint16_t pdcchSlot, uint32_t dataVol, S
   uint8_t  idx            = 0;
   SchCellCb *cellCb       = ueCb->cellCb;
   SchUlSlotInfo *schUlSlotInfo = NULLP;
-  uint8_t  k2 = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList[0].k2;
-  uint8_t  startSymb = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList[0].startSymbol;
-  uint8_t  symbLen = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList[0].symbolLength;
-
+  uint8_t k2=0, startSymb=0 , symbLen=0;
+  
+  if(ueCb->ueCfg.spCellCfgPres == true)
+  {
+     k2 = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList[0].k2;
+     startSymb = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList[0].startSymbol;
+     symbLen = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList[0].symbolLength;
+  }
   puschSlot = (pdcchSlot + k2) % cellCb->numSlots;
 
   startRb = cellCb->schUlSlotInfo[puschSlot]->puschCurrentPrb;
@@ -457,8 +487,14 @@ uint8_t schFillPuschAlloc(SchUeCb *ueCb, uint16_t pdcchSlot, uint32_t dataVol, S
 uint8_t schFillUlDci(SchUeCb *ueCb, SchPuschInfo puschInfo, DciInfo *dciInfo)
 {
    SchCellCb         *cellCb  = ueCb->cellCb;
-   SchControlRsrcSet coreset1 = ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdcchCfg.cRSetToAddModList[0];
-
+   SchControlRsrcSet coreset1 ;
+  
+   memset(&coreset1, 0, sizeof(SchControlRsrcSet));
+   if(ueCb->ueCfg.spCellCfgPres == true)
+   {
+     coreset1 = ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdcchCfg.cRSetToAddModList[0];
+   }
+   
    dciInfo->cellId = cellCb->cellId;
    dciInfo->crnti  = ueCb->crnti;
 
index e622de8..92eab3c 100644 (file)
@@ -1183,8 +1183,11 @@ typedef struct macUeCfg
    uint16_t cellId;
    uint8_t  ueIdx;
    uint16_t crnti;
+   bool macCellGrpCfgPres;
    MacCellGrpCfg macCellGrpCfg;
+   bool phyCellGrpCfgPres;
    PhyCellGrpCfg phyCellGrpCfg;
+   bool spCellCfgPres;
    SpCellCfg spCellCfg;
    AmbrCfg   *ambrCfg;
    ModulationInfo dlModInfo;    /* DL modulation info */
index 7fd0d6d..80ef9bf 100644 (file)
@@ -1430,8 +1430,11 @@ typedef struct schUeCfg
 {
    uint16_t        cellId;
    uint16_t        crnti;
+   bool macCellGrpCfgPres;
    SchMacCellGrpCfg   macCellGrpCfg;
+   bool phyCellGrpCfgPres;
    SchPhyCellGrpCfg   phyCellGrpCfg;
+   bool spCellCfgPres;
    SchSpCellCfg       spCellCfg;
    SchAmbrCfg         *ambrCfg;
    SchModulationInfo  dlModInfo;
index b611dcc..0357523 100644 (file)
@@ -8788,79 +8788,82 @@ uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg
       /* Fill MacCell Group Reconfig  */
       if(cellGrp->mac_CellGroupConfig)
       {
+         macUeCfg->macCellGrpCfgPres = true;
          macCellGroup = ((MAC_CellGroupConfig_t *)(cellGrp->mac_CellGroupConfig));
          if(macCellGroup->schedulingRequestConfig)
-        {
+         {
             extractSchReqReConfig(macCellGroup->schedulingRequestConfig, &macUeCfg->macCellGrpCfg.schReqCfg);
-        }
+         }
          if(macCellGroup->tag_Config)
-        {
+         {
             extractTagReconfig(macCellGroup->tag_Config, &macUeCfg->macCellGrpCfg.tagCfg);
-        }
-        if(macCellGroup->bsr_Config)
-        {
+         }
+         if(macCellGroup->bsr_Config)
+         {
             macUeCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer = macCellGroup->bsr_Config->periodicBSR_Timer;
             macUeCfg->macCellGrpCfg.bsrTmrCfg.retxTimer     = macCellGroup->bsr_Config->retxBSR_Timer;
-           if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer)
-           {
+            if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer)
+            {
                macUeCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer  =\
-                 *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer);
-           }
-        }
-        if(macCellGroup->phr_Config)
-        {
-           if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup)
-           {
+               *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer);
+            }
+         }
+         if(macCellGroup->phr_Config)
+         {
+            if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup)
+            {
                macUeCfg->macCellGrpCfg.phrCfgSetupPres = true;
                if(macCellGroup->phr_Config->choice.setup)
-              {
-                macUeCfg->macCellGrpCfg.phrCfg.periodicTimer     = \
-                  macCellGroup->phr_Config->choice.setup->phr_PeriodicTimer;
-                macUeCfg->macCellGrpCfg.phrCfg.prohibitTimer     = \
-                  macCellGroup->phr_Config->choice.setup->phr_ProhibitTimer;
-                macUeCfg->macCellGrpCfg.phrCfg.txPowerFactor     = \
-                  macCellGroup->phr_Config->choice.setup->phr_Tx_PowerFactorChange;
-                macUeCfg->macCellGrpCfg.phrCfg.multiplePHR       = \
-                  macCellGroup->phr_Config->choice.setup->multiplePHR;
-                macUeCfg->macCellGrpCfg.phrCfg.dummy             = \
-                  macCellGroup->phr_Config->choice.setup->dummy;
-                macUeCfg->macCellGrpCfg.phrCfg.phrType2OtherCell = \
-                  macCellGroup->phr_Config->choice.setup->phr_Type2OtherCell;
-                macUeCfg->macCellGrpCfg.phrCfg.phrOtherCG        = \
-                  macCellGroup->phr_Config->choice.setup->phr_ModeOtherCG;
-              }
-           }
-        }
+               {
+                  macUeCfg->macCellGrpCfg.phrCfg.periodicTimer     = \
+                  macCellGroup->phr_Config->choice.setup->phr_PeriodicTimer;
+                  macUeCfg->macCellGrpCfg.phrCfg.prohibitTimer     = \
+                  macCellGroup->phr_Config->choice.setup->phr_ProhibitTimer;
+                  macUeCfg->macCellGrpCfg.phrCfg.txPowerFactor     = \
+                  macCellGroup->phr_Config->choice.setup->phr_Tx_PowerFactorChange;
+                  macUeCfg->macCellGrpCfg.phrCfg.multiplePHR       = \
+                  macCellGroup->phr_Config->choice.setup->multiplePHR;
+                  macUeCfg->macCellGrpCfg.phrCfg.dummy             = \
+                  macCellGroup->phr_Config->choice.setup->dummy;
+                  macUeCfg->macCellGrpCfg.phrCfg.phrType2OtherCell = \
+                  macCellGroup->phr_Config->choice.setup->phr_Type2OtherCell;
+                  macUeCfg->macCellGrpCfg.phrCfg.phrOtherCG        = \
+                  macCellGroup->phr_Config->choice.setup->phr_ModeOtherCG;
+               }
+            }
+         }
       }
       /* Fill Physical Cell Group Reconfig */
       if(cellGrp->physicalCellGroupConfig)
       {
+         macUeCfg->phyCellGrpCfgPres = true;
          phyCellGrpCfg = ((PhysicalCellGroupConfig_t *)(cellGrp->physicalCellGroupConfig));
          if(phyCellGrpCfg->p_NR_FR1)
-        {
-           if(*(phyCellGrpCfg->p_NR_FR1) != macUeCfg->phyCellGrpCfg.pNrFr1)
+         {
+            if(*(phyCellGrpCfg->p_NR_FR1) != macUeCfg->phyCellGrpCfg.pNrFr1)
                macUeCfg->phyCellGrpCfg.pNrFr1 = *(phyCellGrpCfg->p_NR_FR1);
-        }
+         }
          macUeCfg->phyCellGrpCfg.pdschHarqAckCodebook = phyCellGrpCfg->pdsch_HARQ_ACK_Codebook;
       }
       /* Fill SpCell Reconfig */
       if(cellGrp->spCellConfig)
       {
+         macUeCfg->spCellCfgPres = true;
          spcellCfg = ((SpCellConfig_t *)(cellGrp->spCellConfig));  
          if(spcellCfg->servCellIndex)
-        {
+         {
             macUeCfg->spCellCfg.servCellIdx = *(spcellCfg->servCellIndex);
-        }
+         }
          /* Fill Serving cell Reconfig info */
-        if(cellGrp->spCellConfig->spCellConfigDedicated)
-        {
-           servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated));
+         if(cellGrp->spCellConfig->spCellConfigDedicated)
+         {
+            servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated));
             ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg);
-           if(ret == RFAILED)
-           {
-              DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()");
-           }
-        }
+            if(ret == RFAILED)
+            {
+               DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()");
+            }
+         }
       }
    }
    return ret;
@@ -10004,6 +10007,7 @@ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
                }
                else
                {
+                  duUeCb->f1UeDb->dlRrcMsgPres = true;
                   memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
                   ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
                         &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer);
index 3eac79d..65d42e1 100644 (file)
@@ -49,6 +49,7 @@ int8_t getReAsmblTmr(uint8_t reAsmblTmrCfg);
 int16_t getStatProhTmr(uint8_t statProhTmrCfg);
 uint8_t duProcUeContextModReq(DuUeCb *ueCb);
 uint8_t BuildAndSendUeContextModResp(uint8_t ueIdx, uint8_t cellId);
+uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint16_t crnti, DuUeCfg *duUeCfg);
 /**********************************************************************
          End of file
 **********************************************************************/
index 9182bc3..4dfc709 100644 (file)
@@ -132,6 +132,7 @@ typedef struct f1UeContextSetup
    UeCtxtActionType actionType;
    uint8_t cellIdx;
    DuUeCfg  duUeCfg;        
+   bool     dlRrcMsgPres;
    F1DlRrcMsg  *dlRrcMsg;
 }F1UeContextSetupDb;
 
index 748f71a..53037ee 100644 (file)
@@ -1130,59 +1130,62 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t ueIdx, uint16_t crnti, \
       ret = procUeReCfgCellInfo(macUeCfg, ueCfgDb->cellGrpCfg);
       if(ret == ROK)
       {
-         if(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent)
-        {
-           fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\
-              &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL);
-        }
-        if(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschPresent)
+         if(macUeCfg->spCellCfgPres == true)
          {
-            fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\
-              NULL, &macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg);
+            if(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent)
+            {
+               fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\
+                     &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL);
+            }
+            if(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschPresent)
+            {
+               fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\
+                     NULL, &macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg);
+            }
          }
-        ret = fillAmbr(&macUeCfg->ambrCfg, ueCfgDb->ambrCfg);
-        
+         ret = fillAmbr(&macUeCfg->ambrCfg, ueCfgDb->ambrCfg);
+
          duFillModulationDetails(macUeCfg, duMacDb, ueCfgDb->ueNrCapability);
       }
 
       /* Filling LC Context */
       for(dbIdx = 0; (dbIdx < ueCfgDb->numMacLcs && ret == ROK); dbIdx++)
       {
-        if(!ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres)
-        {
-           /* Filling default UL LC config in MAC if not present */
-           ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres = true;
-           fillDefaultUlLcCfg(&ueCfgDb->macLcCfg[dbIdx].ulLcCfg);
-        }
-        for(lcIdx = 0; lcIdx < duMacDb->numLcs; lcIdx++)
-        {
-           if(ueCfgDb->macLcCfg[dbIdx].lcId == duMacDb->lcCfgList[lcIdx].lcId)
-           {
-              lcIdFound = true;
-              if((ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_UNKNOWN) ||
-                    (ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_MOD))
-              {
-                 ueCfgDb->macLcCfg[dbIdx].configType = CONFIG_MOD;
-                 ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx]);
-              }
-           }
-           else
-              lcIdFound = false;
-        }
-        if(!lcIdFound)
-        {
-           /* ADD/DEL CONFIG */
-           ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx]);
-        }
-        if(ret == ROK)
-        {
-           macUeCfg->numLcs++;
-        }
-        else
-        {
-           DU_LOG("\nERROR  -->  DU APP : Failed to add Lc at Idx %d in fillMacUeCfg()", dbIdx); 
-           break;
-        }
+         if(!ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres)
+         {
+            /* Filling default UL LC config in MAC if not present */
+            ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres = true;
+            fillDefaultUlLcCfg(&ueCfgDb->macLcCfg[dbIdx].ulLcCfg);
+         }
+         for(lcIdx = 0; lcIdx < duMacDb->numLcs; lcIdx++)
+         {
+            if(ueCfgDb->macLcCfg[dbIdx].lcId == duMacDb->lcCfgList[lcIdx].lcId)
+            {
+               lcIdFound = true;
+               if((ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_UNKNOWN) ||
+                     (ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_MOD))
+               {
+                  ueCfgDb->macLcCfg[dbIdx].configType = CONFIG_MOD;
+                  ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx]);
+               }
+            }
+            else
+               lcIdFound = false;
+         }
+         if(!lcIdFound)
+         {
+            /* ADD/DEL CONFIG */
+            ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx]);
+         }
+         if(ret == ROK)
+         {
+            macUeCfg->numLcs++;
+         }
+         else
+         {
+            DU_LOG("\nERROR  -->  DU APP : Failed to add Lc at Idx %d in fillMacUeCfg()", dbIdx); 
+            break;
+         }
       }/*End of Outer FOR loop */
    }
    return ret;
@@ -2143,27 +2146,31 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
       if(cfgRsp->result == MAC_DU_APP_RSP_OK)
       {
          if(pst->event == EVENT_MAC_UE_CREATE_RSP)
-        {
+         {
             DU_LOG("\nINFO   -->  DU APP : MAC UE Create Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx);
             duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
-              macUeCfg.macUeCfgState = UE_CREATE_COMPLETE;
-        }
+               macUeCfg.macUeCfgState = UE_CREATE_COMPLETE;
+         }
          else if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
          {
             DU_LOG("\nINFO   -->  DU APP : MAC UE Reconfig Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx);
             duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
-              macUeCfg.macUeCfgState = UE_RECFG_COMPLETE;
+               macUeCfg.macUeCfgState = UE_RECFG_COMPLETE;
             if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK)
+            {
                BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId);
+               duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
+                  macUeCfg.macUeCfgState = 0;
+            }
          }
       }
       else
       {
          DU_LOG("\nERROR  -->  DU APP : MAC UE CFG Response for EVENT[%d]: FAILURE [UE IDX : %d]", pst->event, cfgRsp->ueIdx);
-        if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
-        {
-           //TODO: Send the failure case in Ue Context Setup Response
-        }
+         if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
+         {
+            //TODO: Send the failure case in Ue Context Setup Response
+         }
          ret = RFAILED;
       }
       DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp));
@@ -2262,29 +2269,33 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
       if(cfgRsp->result == RLC_DU_APP_RSP_OK)
       {
          if(pst->event == EVENT_RLC_UE_CREATE_RSP)
-        {
-           DU_LOG("\nINFO   -->  DU_APP: RLC UE Create Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx);
-           duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
-              rlcUeCfg.rlcUeCfgState = UE_CREATE_COMPLETE;
-        }
-        else if(pst->event == EVENT_RLC_UE_RECONFIG_RSP)
-        {
+         {
+            DU_LOG("\nINFO   -->  DU_APP: RLC UE Create Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx);
+            duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
+               rlcUeCfg.rlcUeCfgState = UE_CREATE_COMPLETE;
+         }
+         else if(pst->event == EVENT_RLC_UE_RECONFIG_RSP)
+         {
             DU_LOG("\nINFO   -->  DU_APP: RLC UE Reconfig Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx);
-           duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
-              rlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE;
-           if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK)
+            duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
+               rlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE;
+            if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK)
+            {
                BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId);
-        }
+               duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
+                  rlcUeCfg.rlcUeCfgState = 0;
+            }   
+         }
       }
       else
       {
          DU_LOG("\nERROR  -->  DU_APP: RLC UE CFG Response for EVENT[%d] : FAILED [UE IDX : %d, REASON :%d]",\
-           pst->event, cfgRsp->ueIdx, cfgRsp->reason);
-        if((pst->event == EVENT_RLC_UE_RECONFIG_RSP))
-        {
+               pst->event, cfgRsp->ueIdx, cfgRsp->reason);
+         if((pst->event == EVENT_RLC_UE_RECONFIG_RSP))
+         {
             //TODO: update failure case in ue Context setup Response
-        }
-        ret = RFAILED;
+         }
+         ret = RFAILED;
       }
       DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp));
    }
@@ -2296,8 +2307,6 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
    return ret;
 }
 
-
-
 /*******************************************************************
  *
  * @brief Builds and Send Ue Reconfig Req to RLC
@@ -2447,11 +2456,20 @@ uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg)
    {
       GET_UE_IDX(dlRrcMsg->crnti, ueIdx);
       ueCb = &duCb.actvCellLst[dlRrcMsg->cellId -1]->ueCb[ueIdx -1];
-      if(ueCb->f1UeDb && ueCb->f1UeDb->actionType == UE_CTXT_SETUP)
+      if(ueCb->f1UeDb && ueCb->f1UeDb->dlRrcMsgPres)
       {
-        ret = duBuildAndSendUeContextSetupReq(dlRrcMsg->cellId, dlRrcMsg->crnti, &ueCb->f1UeDb->duUeCfg);
-       if(ret == RFAILED)
-          DU_LOG("\nERROR  -->  DU APP : Failed to process UE Context Setup Request in DuProcRlcDlRrcMsgRsp()");
+         if(ueCb->f1UeDb->actionType == UE_CTXT_SETUP)
+         {
+            ret = duBuildAndSendUeContextSetupReq(dlRrcMsg->cellId, dlRrcMsg->crnti, &ueCb->f1UeDb->duUeCfg);
+            if(ret == RFAILED)
+               DU_LOG("\nERROR  -->  DU APP : Failed to process UE Context Setup Request in DuProcRlcDlRrcMsgRsp()");
+         }
+         if(ueCb->f1UeDb->actionType == UE_CTXT_MOD)
+         {
+            ret = duBuildAndSendUeContextModReq(dlRrcMsg->cellId, dlRrcMsg->crnti, &ueCb->f1UeDb->duUeCfg);
+            if(ret == RFAILED)
+               DU_LOG("\nERROR  -->  DU APP : Failed to process UE Context Mod Request in DuProcRlcDlRrcMsgRsp()");
+         }
       }
    }
    else
@@ -2479,7 +2497,7 @@ uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg)
 uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb)
 {
    uint8_t ret, cellId;
-   
+
    ret = ROK;
    if(ueCb)
    {
@@ -2495,7 +2513,7 @@ uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb)
             {
                DU_LOG("\nERROR  -->  DU APP : Failed to send DL RRC msg in duProcUeContextSetupRequest()");
                DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
-                  ueCb->f1UeDb->dlRrcMsg->rrcMsgSize);
+                     ueCb->f1UeDb->dlRrcMsg->rrcMsgSize);
                DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
             }
          }
@@ -2503,10 +2521,10 @@ uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb)
       else if(ueCb->f1UeDb->actionType == UE_CTXT_SETUP)
       {
          ret = duBuildAndSendUeContextSetupReq(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
-        if(ret == RFAILED)
-        {
+         if(ret == RFAILED)
+         {
             DU_LOG("\nERROR  -->  DU APP : Failed to build ue context setup Req in duProcUeContextSetupRequest()");
-        }
+         }
       }
    }
    else
@@ -2516,26 +2534,99 @@ uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb)
    }
    return ret;
 }
+
 /*******************************************************************
-*
-* @brief Process UE context modification request from CU
-*
-* @details
-*
-*    Function : duProcUeContextModReq
-*
-*    Functionality: Process UE context modification request from CU
-*
-* @params[in] DuUeCb *ueCb
-* @return ROK     - success
-*         RFAILED - failure
-*
-* ****************************************************************/
+ *
+ * @brief Build and Send Ue context mod request
+ *
+ * @details
+ *
+ *
+ *    Function : duBuildAndSendUeContextModReq
+ *
+ *    Functionality: 
+ *     Build and Send Ue context mod request
+ * 
+ *  @params[in]  cellId, crnti, DuUeCfg pointer
+ *  @return ROK     - success
+ *          RFAILED - failure
+ * 
+ *****************************************************************/
+
+uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint16_t crnti, DuUeCfg *duUeCfg)
+{
+   uint8_t ret = ROK;
+
+   DU_LOG("\nDEBUG   -->  DU_APP: Processing Ue Context Mod Request for cellId [%d]", cellId);
+   /* Filling RLC Ue Reconfig */ 
+   ret = duBuildAndSendUeReCfgReqToRlc(cellId, crnti, duUeCfg);
+   if(ret == RFAILED)
+      DU_LOG("\nERROR  -->  DU APP : Failed to build ctxt setup req for RLC at duBuildAndSendUeContextModReq()");
+   
+   /* Filling MAC Ue Reconfig */
+   ret = duBuildAndSendUeReCfgReqToMac(cellId, crnti, duUeCfg);
+   if(ret == RFAILED)
+      DU_LOG("\nERROR  -->  DU APP : Failed at build ctxt setup req for MAC at duBuildAndSendUeContextModReq()");
+
+   return ret;
+}
+/*******************************************************************
+ *
+ * @brief Processing Ue context mod request
+ *
+ * @details
+ *
+ *
+ *    Function : duProcUeContextModReq 
+ *
+ *    Functionality:
+ *        Processing  Ue context mod request
+ *
+ *  @params[in] DuUeCb *ueCb 
+ *  @return ROK     - success
+ *          RFAILED - failure
+ *
+ *****************************************************************/
+
 uint8_t duProcUeContextModReq(DuUeCb *ueCb)
 {
-    
-    //TODO:After RB configuration are done Mod Response is triggered 
-    return ROK;
+   uint8_t ret, cellId;
+
+   ret = ROK;
+   if(ueCb)
+   {
+      cellId = duCb.actvCellLst[ueCb->f1UeDb->cellIdx]->cellId;
+      /* Send DL RRC msg for security Mode */
+      if(ueCb->f1UeDb->dlRrcMsg)
+      {
+         if(ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
+         {
+            /* Sending DL RRC Message to RLC */
+            ret = duBuildAndSendDlRrcMsgToRlc(cellId, ueCb->rlcUeCfg, ueCb->f1UeDb->dlRrcMsg);
+            if(ret == RFAILED)
+            {
+               DU_LOG("\nERROR  -->  DU APP : Failed to send DL RRC msg in duProcUeContextModReq()");
+               DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
+                     ueCb->f1UeDb->dlRrcMsg->rrcMsgSize);
+               DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
+            }
+         }
+      }
+      else
+      {
+         ret = duBuildAndSendUeContextModReq(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
+         if(ret == RFAILED)
+         {
+            DU_LOG("\nERROR  -->  DU APP : Failed to build ue context setup Req in duProcUeContextModReq()");
+         }
+      }
+   }
+   else
+   {
+      //TODO: To send the failure cause in UeContextModRsp
+      DU_LOG("ERROR  -->  DU APP : Failed to process UE CNTXT MOD REQ at duProcUeContextModReq()");
+   }
+   return ROK;
 }
 /**********************************************************************
   End of file