- /* 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 duBuildAndSendUeContextSetupReq()");
-
- /* 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 duBuildAndSendUeContextSetupReq()");
+
+ if(!ueCb)
+ {
+ DU_LOG("\nERROR --> DU APP : UE Cb is NULL");
+ return RFAILED;
+ }
+
+ crnti = ueCb->crnti;
+ duUeCfg = &ueCb->f1UeDb->duUeCfg;
+
+ /* If UE is being handed-in to this DU, UE context setup request will create
+ * new UE context at MAC/SCH and RLC.
+ * If UE is in active state, UE contex setup request will lead to
+ * reconfiguration of UE at MAC/SCH and RLC
+ */
+ if(ueCb->ueState == UE_HANDIN_IN_PROGRESS)
+ {
+ /* Filling MAC UE Config */
+ memset(&ueCb->macUeCfg, 0, sizeof(MacUeCfg));
+
+ /* Since UE attach has not yet happened, ueId and crnti is unknow. Hence
+ * passing 0 */
+ ret = duBuildAndSendUeCreateReqToMac(cellId, ueCb->gnbDuUeF1apId, 0, duUeCfg, &ueCb->macUeCfg);
+ if(ret == RFAILED)
+ DU_LOG("\nERROR --> DU APP : Failed to send UE create request to MAC");
+ }
+ else
+ {
+ /* 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 duBuildAndSendUeContextSetupReq()");
+
+ /* Filling MAC UE Reconfig */
+ ret = duBuildAndSendUeReCfgReqToMac(cellId, ueCb->gnbDuUeF1apId, crnti, duUeCfg);
+ if(ret == RFAILED)
+ DU_LOG("\nERROR --> DU APP : Failed at build ctxt setup req for MAC at duBuildAndSendUeContextSetupReq()");
+ }