PDSCH and PUSCH MCS Update [Issue-ID: ODUHIGH-261]
[o-du/l2.git] / src / du_app / du_ue_mgr.c
index 4d17af2..a651fd7 100644 (file)
@@ -746,6 +746,32 @@ void fillDefaultMacCellGrpInfo(MacCellGrpCfg *cellGrp)
    }
 }
 
+/*******************************************************************
+ *
+ * @brief Fills default modulation info for a UE
+ *
+ * @details
+ *
+ *    Function : fillDefaultModulation
+ *
+ *    Functionality: Fills default modulation info for a UE
+ *
+ * @params[in] Pointer to MAC UE configuration
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+void fillDefaultModulation(MacUeCfg *ueCfg)
+{
+   ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK;
+   ueCfg->dlModInfo.mcsIndex = SIB1_MCS;
+   ueCfg->dlModInfo.mcsTable = MCS_TABLE_QAM64; /* Spec 38.214-Table 5.1.3.1-1 */
+
+   ueCfg->ulModInfo.modOrder = MOD_ORDER_QPSK;
+   ueCfg->ulModInfo.mcsIndex = SIB1_MCS;
+   ueCfg->ulModInfo.mcsTable = MCS_TABLE_QAM64; /* Spec 38.214-Table 5.1.3.1-1 */
+}
+
 /******************************************************************
  *
  * @brief Function to fill Mac Lc Cfg for SRB1
@@ -1002,6 +1028,7 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t ueIdx, uint16_t crnti, \
       fillDefaultSpCellGrpInfo(&macUeCfg->spCellCfg);
       macUeCfg->ambrCfg = NULLP;
       fillMacSrb1LcCfg(&macUeCfg->lcCfgList[0]);
+      fillDefaultModulation(macUeCfg);
       macUeCfg->numLcs++;
    }
    else
@@ -1027,6 +1054,8 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t ueIdx, uint16_t crnti, \
               NULL, &macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg);
          }
         ret = fillAmbr(&macUeCfg->ambrCfg, ueCfgDb->ambrCfg);
+        
+         duFillModulationDetails(macUeCfg, duMacDb, ueCfgDb->ueNrCapability);
       }
 
       /* Filling LC Context */
@@ -1988,6 +2017,8 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
    return ret;
 }
 
+
+
 /*******************************************************************
  *
  * @brief Builds and Send Ue Reconfig Req to RLC
@@ -2074,6 +2105,82 @@ uint8_t duBuildAndSendUeReCfgReqToMac(uint8_t cellId, uint8_t crnti, DuUeCfg *ue
    return ret;
 }
 
+/*******************************************************************
+ *
+ * @brief Build and Send Ue context setup request
+ *
+ * @details
+ *
+ *    Function : duBuildAndSendUeContextSetupReq
+ *
+ *    Functionality: 
+ *     Build and Send Ue context setup request
+ * 
+ *  @params[in]  cellId, crnti, DuUeCfg pointer
+ *  @return ROK     - success
+ *          RFAILED - failure
+ * 
+ *****************************************************************/
+
+uint8_t duBuildAndSendUeContextSetupReq(uint16_t cellId, uint16_t crnti, DuUeCfg *duUeCfg)
+{
+   uint8_t ret = ROK;
+
+   DU_LOG("\nDU_APP: Processing Ue Context Setup Request for cellId [%d]", cellId);
+   /* Filling RLC Ue Reconfig */ 
+   ret = duBuildAndSendUeReCfgReqToRlc(cellId, crnti, duUeCfg);
+   if(ret == RFAILED)
+      DU_LOG("\nDU_APP: Failed to build ctxt setup req for RLC at duBuildAndSendUeContextSetupReq()");
+   
+   /* Filling MAC Ue Reconfig */
+   ret = duBuildAndSendUeReCfgReqToMac(cellId, crnti, duUeCfg);
+   if(ret == RFAILED)
+      DU_LOG("\nDU_APP: Failed at build ctxt setup req for MAC at duBuildAndSendUeContextSetupReq()");
+
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Processes DL Rsp received from RLC DL
+ *
+ * @details
+ *
+ *    Function : DuProcRlcDlRrcMsgRsp
+ *
+ *    Functionality: 
+ *     Processes UE Rsp received from RLC DL
+ * 
+ *  @params[in]  Post structure
+ *               Pointer to RlcCfgCfm
+ *  @return ROK     - success
+ *          RFAILED - failure
+ * 
+ *****************************************************************/
+uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg)
+{
+   uint8_t ret = ROK, ueIdx = 0;
+   DuUeCb *ueCb = NULLP;
+
+   if(dlRrcMsg->state == TRANSMISSION_COMPLETE)
+   {
+      GET_UE_IDX(dlRrcMsg->crnti, ueIdx);
+      ueCb = &duCb.actvCellLst[dlRrcMsg->cellId -1]->ueCb[ueIdx -1];
+      if(ueCb->f1UeDb)
+      {
+        ret = duBuildAndSendUeContextSetupReq(dlRrcMsg->cellId, dlRrcMsg->crnti, &ueCb->f1UeDb->duUeCfg);
+       if(ret == RFAILED)
+          DU_LOG("\nDUAPP: Failed to process UE Context Setup Request in DuProcRlcDlRrcMsgRsp()");
+      }
+   }
+   else
+      DU_LOG("\nDUAPP: Failed to transmit DL RRC Msg");
+
+   DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlRrcMsg, sizeof(RlcDlRrcMsgRsp));
+   return ret;
+}
 /*******************************************************************
  *
  * @brief Process UE context setup request from CU
@@ -2114,18 +2221,13 @@ uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb)
             }
          }
       }
-      if(ret == ROK)
+      else
       {
-         DU_LOG("\nDU_APP: Processing Ue Context Setup Request for cellId [%d]", cellId);
-         /* Filling RLC Ue Reconfig */ 
-         ret = duBuildAndSendUeReCfgReqToRlc(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
-         if(ret == RFAILED)
-            DU_LOG("\nDU_APP: Failed to build ctxt setup req for RLC at duBuildAndSendUeReCfgReqToRlc()");
-         
-        /* Filling MAC Ue Reconfig */
-         ret = duBuildAndSendUeReCfgReqToMac(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
-         if(ret == RFAILED)
-            DU_LOG("\nDU_APP: Failed at build ctxt setup req for MAC at duBuildAndSendUeReCfgReqToMac()");
+         ret = duBuildAndSendUeContextSetupReq(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
+        if(ret == RFAILED)
+        {
+            DU_LOG("\nDU APP : Failed to build ue context setup Req in duProcUeContextSetupRequest()");
+        }
       }
    }
    else