typedef enum
{
UE_STATE_INACTIVE,
- UE_STATE_ACTIVE
+ UE_STATE_ACTIVE,
+ UE_HANDIN_IN_PROGRESS
}UeState;
typedef enum
/* UE Cb */
typedef struct macUeCb
{
- uint16_t ueId; /* UE Id assigned by DU APP */
+ uint16_t ueId; /* UE Id calculated from CRNTI */
+ uint8_t duUeF1apId; /* UE ID assigned by DU APP */
uint16_t crnti; /* UE CRNTI */
MacCellCb *cellCb; /* Pointer to cellCb to whihc this UE belongs */
UeState state; /* Is UE active ? */
MacUlSlot ulSlot[MAX_SLOTS];
uint16_t numActvUe;
MacUeCfg *ueCfgTmpData[MAX_NUM_UE];
+ MacUeCb hoUeCb[MAX_NUM_UE];
MacUeCb ueCb[MAX_NUM_UE];
MacCellCfg macCellCfg;
SlotTimingInfo currTime;
uint8_t ret = ROK;
schUeCfg->cellId = ueCfg->cellId;
+ schUeCfg->duUeF1apId = ueCfg->duUeF1apId;
schUeCfg->crnti = ueCfg->crnti;
/* Copy MAC cell group config */
ueCb->dlInfo.dlHarqEnt.numHarqProcs = \
ueCfg->spCellCfg.servCellCfg.pdschServCellCfg.numHarqProcForPdsch;
}
- ueCb->state = UE_STATE_ACTIVE;
+
+ if(ueCfg->crnti)
+ ueCb->state = UE_STATE_ACTIVE;
+ else
+ ueCb->state = UE_HANDIN_IN_PROGRESS;
+
/*TODO: To check the bsr value during implementation */
if(ueCfg->macCellGrpCfgPres)
{
}
else
{
- macCb.macCell[cellIdx]->numActvUe++;
- updateMacRaCb(cellIdx, ueCb);
- return ROK;
+ if(ueCb->state == UE_STATE_ACTIVE)
+ {
+ macCb.macCell[cellIdx]->numActvUe++;
+ updateMacRaCb(cellIdx, ueCb);
+ }
+ return ROK;
}
}
uint8_t ret = ROK;
if((ueCb->ueId == ueCfg->ueId) && (ueCb->crnti == ueCfg->crnti)\
- &&(ueCb->state == UE_STATE_ACTIVE))
+ &&(ueCb->state == UE_STATE_ACTIVE))
{
DU_LOG("\nINFO --> MAC : Modifying Ue config Req for CRNTI %d ", ueCfg->crnti);
ret = fillMacUeCb(ueCb, ueCfg, cellIdx);
else
{
deleteMacRaCb(cellIdx, ueCb);
- return ROK;
+ return ROK;
}
}
return RFAILED;
}
/* Check if UE already configured */
- ueCb = &macCb.macCell[cellIdx]->ueCb[ueCfg->ueId -1];
+ if(ueCfg->crnti)
+ ueCb = &macCb.macCell[cellIdx]->ueCb[ueCfg->ueId -1];
+ else
+ ueCb = &macCb.macCell[cellIdx]->hoUeCb[ueCfg->duUeF1apId -1];
+
switch(pst->event)
{
case EVENT_UE_CONFIG_RSP_TO_MAC:
- ret = createUeCb(cellIdx, ueCb, ueCfg);
- if(ret != ROK)
- DU_LOG("\nERROR --> MAC: AddUeConfigReq for cellIdx :%d failed in procMacUeCfgData()", cellIdx);
- break;
+ {
+ ret = createUeCb(cellIdx, ueCb, ueCfg);
+ if(ret != ROK)
+ DU_LOG("\nERROR --> MAC: AddUeConfigReq for cellIdx :%d failed in procMacUeCfgData()", cellIdx);
+ break;
+ }
+
case EVENT_UE_RECONFIG_RSP_TO_MAC:
- ret = modifyUeCb(cellIdx, ueCb, ueCfg);
- if(ret != ROK)
- DU_LOG("\nERROR --> MAC: ModifyUeConfigReq for cellIdx :%d failed at procMacUeCfgData()", cellIdx);
- break;
+ {
+ ret = modifyUeCb(cellIdx, ueCb, ueCfg);
+ if(ret != ROK)
+ DU_LOG("\nERROR --> MAC: ModifyUeConfigReq for cellIdx :%d failed at procMacUeCfgData()", cellIdx);
+ break;
+ }
+
default:
- break;
+ break;
}
return ret;
}
memcpy(tmpData, ueCfg, sizeof(MacUeCfg));
GET_CELL_IDX(ueCfg->cellId, cellIdx);
- macCb.macCell[cellIdx]->ueCfgTmpData[ueCfg->ueId-1] = tmpData;
+ macCb.macCell[cellIdx]->ueCfgTmpData[ueCfg->duUeF1apId-1] = tmpData;
return ROK;
}
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 MacProcUeCreateReq()");
- else
- {
+ ret = fillSchUeCfg(pst, &schUeCfg, ueCfg);
+ if(ret != ROK)
+ DU_LOG("\nERROR --> MAC : Failed to fill Sch Ue Cfg at MacProcUeCreateReq()");
+ 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 Create request to SCH");
- }
+ if(ret != ROK)
+ DU_LOG("\nERROR --> MAC : Failed to send UE Create request to SCH");
+ }
}
else
{
- DU_LOG("\nERROR --> MAC : Failed to store MAC UE CFG ");
+ DU_LOG("\nERROR --> MAC : Failed to store MAC UE CFG ");
}
}
else
/* Filling UE Config response */
memset(cfgRsp, 0, sizeof(MacUeCfgRsp));
cfgRsp->cellId = schCfgRsp->cellId;
- cfgRsp->ueId = schCfgRsp->ueId;
+ cfgRsp->duUeF1apId = schCfgRsp->duUeF1apId;
cfgRsp->result = result;
/* Fill Post structure and send UE Create response*/
/* Filling UE Config response */
memset(cfgRsp, 0, sizeof(MacUeCfgRsp));
cfgRsp->cellId = schCfgRsp->cellId;
- cfgRsp->ueId = schCfgRsp->ueId;
+ cfgRsp->duUeF1apId = schCfgRsp->duUeF1apId;
cfgRsp->result = result;
/* Fill Post structure and send UE Create response*/
*
* ****************************************************************/
-MacUeCfg *getMacUeCfg(uint16_t cellIdx, uint8_t ueId)
+MacUeCfg *getMacUeCfg(uint16_t cellIdx, uint8_t duUeF1apId)
{
MacUeCfg *ueCfg = NULLP;
if(macCb.macCell[cellIdx])
{
- ueCfg = macCb.macCell[cellIdx]->ueCfgTmpData[ueId-1];
+ ueCfg = macCb.macCell[cellIdx]->ueCfgTmpData[duUeF1apId-1];
}
else
{
#endif
GET_CELL_IDX(schCfgRsp->cellId, cellIdx);
- ueCfg = getMacUeCfg(cellIdx, schCfgRsp->ueId);
+ ueCfg = getMacUeCfg(cellIdx, schCfgRsp->duUeF1apId);
if(ueCfg == NULLP)
{
DU_LOG("\nERROR --> MAC : Failed to find the Mac Ue Cfg for event [%d] in MacProcSchUeCfgRsp()", pst->event);
typedef enum
{
SCH_UE_STATE_INACTIVE,
- SCH_UE_STATE_ACTIVE
+ SCH_UE_STATE_ACTIVE,
+ SCH_UE_HANDIN_IN_PROGRESS
}SchUeState;
typedef enum
typedef struct schUeCfgCb
{
uint16_t cellId;
+ uint8_t duUeF1apId;
uint16_t crnti;
bool macCellGrpCfgPres;
SchMacCellGrpCfg macCellGrpCfg;
uint8_t ssbStartSymbArr[SCH_MAX_SSB_BEAM]; /*!<start symbol per SSB beam */
SchRaReq *raReq[MAX_NUM_UE]; /*!< Pending RA request */
SchRaCb raCb[MAX_NUM_UE]; /*!< RA Cb */
+ SchUeCb hoUeCb[MAX_NUM_UE]; /*!<List of UE being handed-in to this DU */
uint16_t numActvUe; /*!<Number of active UEs */
uint32_t actvUeBitMap; /*!<Bit map to find active UEs */
uint32_t boIndBitMap; /*!<Bit map to indicate UEs that have recevied BO */
Pst rspPst;
cfgRsp->cellId = ueCfg->cellId;
+ cfgRsp->duUeF1apId = ueCfg->duUeF1apId;
cfgRsp->crnti = ueCfg->crnti;
- GET_UE_ID(ueCfg->crnti, cfgRsp->ueId);
cfgRsp->rsp = result;
/* Filling response post */
bool isLcIdValid = FALSE;
ueCb->ueCfg.cellId = ueCfg->cellId;
+ ueCb->ueCfg.duUeF1apId = ueCfg->duUeF1apId;
ueCb->ueCfg.crnti = ueCfg->crnti;
if(ueCfg->macCellGrpCfgPres == true)
{
}
}
- ueCb->state = SCH_UE_STATE_ACTIVE;
if(ueCfg->ambrCfg)
{
SCH_FREE(ueCb->ueCfg.ambrCfg, sizeof(SchAmbrCfg));
cellCb = getSchCellCb(pst->event, inst, ueCfg);
/* Search if UE already configured */
- GET_UE_ID(ueCfg->crnti, ueId);
- ueCb = &cellCb->ueCb[ueId -1];
- if(ueCb)
+ if(ueCfg->crnti)
{
- if((ueCb->crnti == ueCfg->crnti) && (ueCb->state == SCH_UE_STATE_ACTIVE))
- {
- DU_LOG("\nDEBUG --> SCH : CRNTI %d already configured ", ueCfg->crnti);
- SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_OK, &cfgRsp);
- return ROK;
- }
+ GET_UE_ID(ueCfg->crnti, ueId);
+ ueCb = &cellCb->ueCb[ueId -1];
}
else
+ ueCb = &cellCb->hoUeCb[ueCfg->duUeF1apId - 1];
+
+ if((ueCb->crnti == ueCfg->crnti) && (ueCb->state == SCH_UE_STATE_ACTIVE))
{
- DU_LOG("\nERROR --> SCH : SchUeCb not found at MacSchAddUeConfigReq() ");
- SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_NOK, &cfgRsp);
- return RFAILED;
+ DU_LOG("\nDEBUG --> SCH : CRNTI %d already configured ", ueCfg->crnti);
+ SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_OK, &cfgRsp);
+ return ROK;
}
/* Fill received Ue Configuration in UeCb */
memset(ueCb, 0, sizeof(SchUeCb));
ueCb->ueId = ueId;
ueCb->crnti = ueCfg->crnti;
- ueCb->state = SCH_UE_STATE_ACTIVE;
+ if(ueCb->crnti)
+ ueCb->state = SCH_UE_STATE_ACTIVE;
+ else
+ ueCb->state = SCH_UE_HANDIN_IN_PROGRESS;
+
ret = fillSchUeCb(inst, ueCb, ueCfg);
if(ret == ROK)
{
- cellCb->numActvUe++;
- SET_ONE_BIT(ueCb->ueId, cellCb->actvUeBitMap);
+ if(ueCb->state == SCH_UE_STATE_ACTIVE)
+ {
+ cellCb->numActvUe++;
+ SET_ONE_BIT(ueCb->ueId, cellCb->actvUeBitMap);
+ }
ueCb->cellCb = cellCb;
ueCb->srRcvd = false;
ueCb->bsrRcvd = false;
{
uint16_t cellId;
uint8_t ueId;
+ uint8_t duUeF1apId;
uint16_t crnti;
bool macCellGrpCfgPres;
MacCellGrpCfg macCellGrpCfg;
typedef struct ueCfgRsp
{
uint16_t cellId;
- uint16_t ueId;
+ uint16_t duUeF1apId;
MacRsp result;
uint8_t numSRBFailed; /* valid values : 0 to MAX_NUM_SRB */
SRBFailInfo *failedSRBlisti;
typedef struct schUeCfg
{
uint16_t cellId;
+ uint8_t duUeF1apId;
uint16_t crnti;
bool macCellGrpCfgPres;
SchMacCellGrpCfg macCellGrpCfg;
typedef struct schUeCfgRsp
{
- uint16_t ueId;
uint16_t cellId;
+ uint16_t duUeF1apId;
uint16_t crnti;
SchMacRsp rsp;
SchFailureCause cause;
CU_ALLOC(rrcMsg->iE_Extensions, sizeof(ProtocolExtensionContainer_4624P16_t));
if(rrcMsg->iE_Extensions)
{
- elementCnt = 2;
+ elementCnt = 1;
rrcMsg->iE_Extensions->list.count = elementCnt;
rrcMsg->iE_Extensions->list.size = elementCnt * sizeof(CUtoDURRCInformation_ExtIEs_t *);
}
idx = 0;
-
+#if 0
/* Cell Group Configuration */
rrcMsg->iE_Extensions->list.array[idx]->id = ProtocolIE_ID_id_CellGroupConfig;
rrcMsg->iE_Extensions->list.array[idx]->criticality = Criticality_ignore;
rrcMsg->iE_Extensions->list.array[idx]->extensionValue.present =\
CUtoDURRCInformation_ExtIEs__extensionValue_PR_CellGroupConfig;
ret = fillCellGrpCfg(ueCb, &rrcMsg->iE_Extensions->list.array[idx]->extensionValue.choice.CellGroupConfig, true);
-
- /* Handover Preparation Information */
idx++;
+#endif
+ /* Handover Preparation Information */
rrcMsg->iE_Extensions->list.array[idx]->id = ProtocolIE_ID_id_HandoverPreparationInformation;
rrcMsg->iE_Extensions->list.array[idx]->criticality = Criticality_ignore;
rrcMsg->iE_Extensions->list.array[idx]->extensionValue.present = \
/* This file contains F1AP message handler functions */
#include "common_def.h"
+#include "ckw.h"
+#include "ckw.x"
+#include "kwu.h"
+#include "kwu.x"
+#include "lkw.h"
#include "lrg.h"
#include "legtp.h"
#include "lkw.x"
#include "du_cfg.h"
#include "du_app_rlc_inf.h"
#include "du_mgr_main.h"
+#include "du_mgr.h"
#include "du_utils.h"
+#include "du_ue_mgr.h"
#include "RAT-Type.h"
#include "FeatureSetUplinkPerCC.h"
#include "FeatureSetDownlinkPerCC.h"
qosToAdd->u.nonDyn5Qi.avgWindow = \
*(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
}
- qosToAdd->u.nonDyn5Qi.maxDataBurstVol = \
- *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
+
+ if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume)
+ {
+ qosToAdd->u.nonDyn5Qi.maxDataBurstVol = \
+ *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
+ }
+
if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel)
{
qosToAdd->u.nonDyn5Qi.priorLevel = \
}
(ueCfgDb->numRlcLcs)++;
(ueCfgDb->numMacLcs)++;
- DU_LOG("\nDEBUG -> DUAPP: extractRlcCfgToAddMod:RBType:%d, DrbID: %d,lcId:%d, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
- rbType, rbId, lcId, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
+ DU_LOG("\nDEBUG -> DUAPP: extractRlcCfgToAddMod:RBType:%d, DrbID: %d,lcId:%d, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
+ rbType, rbId, lcId, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
}
//TODO: To send the failure cause in UeContextSetupRsp
return ROK;
* @return void
*
* ****************************************************************/
-uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfgToSend,MacUeCfg *storedMacUeCfg, void *cellInfo)
+uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfgToSend, MacUeCfg *storedMacUeCfg, void *cellInfo)
{
uint8_t ret = ROK;
CellGroupConfigRrc_t *cellGrp = NULLP;
{
UE_NR_Capability_t *ueNrCap=NULLP;
- if(!ueCap)
+ if(!ueCap && oldUeCfg)
{
memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
default:
{
DU_LOG("\nERROR --> DU APP: Incorrect downlink modulation order received. Reatining old modulation configuration");
- memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
+ if(oldUeCfg)
+ memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
break;
}
}
}
else
{
- memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
+ if(oldUeCfg)
+ memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
}
/* Filling UL modulation info */
default:
{
DU_LOG("\nERROR --> DU APP: Incorrect uplink modulation order received. Reatining old modulation configuration");
- memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
+ if(oldUeCfg)
+ memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
break;
}
}
}
else
{
- memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
+ if(oldUeCfg)
+ memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
}
}
}
* ****************************************************************/
uint8_t extractCuToDuRrcInfoExt(ProtocolExtensionContainer_4624P16_t *protocolIeExtn, DuUeCfg *ueCfgDb)
{
- uint8_t idx2 =0;
- uint16_t id =0;
+ uint8_t ieIdx =0;
uint16_t recvBufLen =0;
CellGroupConfigRrc_t *cellGrpCfg = NULLP;
CUtoDURRCInformation_ExtIEs_t *extIeInfo = NULLP;
if(protocolIeExtn)
{
- for(idx2 = 0; idx2 < protocolIeExtn->list.count; idx2++)
+ for(ieIdx = 0; ieIdx < protocolIeExtn->list.count; ieIdx++)
{
- extIeInfo = ((CUtoDURRCInformation_ExtIEs_t *)(protocolIeExtn->list.array[idx2]));
- id = extIeInfo->id;
- switch(id)
+ extIeInfo = ((CUtoDURRCInformation_ExtIEs_t *)(protocolIeExtn->list.array[ieIdx]));
+ switch(extIeInfo->id)
{
case ProtocolIE_ID_id_CellGroupConfig:
{
- recvBufLen = extIeInfo->extensionValue.choice.CellGroupConfig.size;
/* decoding the CellGroup Buf received */
+ recvBufLen = extIeInfo->extensionValue.choice.CellGroupConfig.size;
DU_ALLOC(cellGrpCfg, sizeof(CellGroupConfigRrc_t));
if(cellGrpCfg)
{
return RFAILED;
}
xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, cellGrpCfg);
+
if(extractRlcCfgToAddMod(cellGrpCfg->rlc_BearerToAddModList, ueCfgDb))
return NULLP;
ueCfgDb->cellGrpCfg = cellGrpCfg;
case ProtocolIE_ID_id_HandoverPreparationInformation:
{
- DU_LOG("\nHLAL Received HANDOVER PREPARATION INFO in UE CONTEXT SETUP REQUEST");
- return RFAILED;
+ DU_LOG("\nINFO --> F1AP : Received HANDOVER PREPARATION INFO in UE CONTEXT SETUP REQUEST");
+ break;
}
default:
- DU_LOG("\nERROR --> F1AP : Invalid IE received CUtoDURRCInformation:%d at decodeCellGrpCfg()", id);
+ DU_LOG("\nERROR --> F1AP : Invalid IE received CUtoDURRCInformation: %ld at decodeCellGrpCfg()", extIeInfo->id);
break;
}
}
uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb)
{
- uint8_t ret, srbIdx;
+ uint8_t ret = ROK, srbIdx = 0, rlcLcIdx = 0;
SRBs_ToBeSetup_Item_t *srbItem = NULLP;
+ LcCfg *macLcCtxt = NULLP;
+ RlcBearerCfg *rlcLcCtxt = NULLP;
if(srbCfg)
{
for(srbIdx = 0; srbIdx < srbCfg->list.count; srbIdx++)
{
+ macLcCtxt = NULL;
+ rlcLcCtxt = NULL;
+
srbItem = &srbCfg->list.array[srbIdx]->value.choice.SRBs_ToBeSetup_Item;
if(ueCfgDb->numMacLcs > MAX_NUM_LC)
{
ret = RFAILED;
break;
}
- memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
- memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
- ret = procSrbListToSetup(srbItem, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\
- &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs]);
- ueCfgDb->numRlcLcs++;
- ueCfgDb->numMacLcs++;
+
+ for(rlcLcIdx = 0; rlcLcIdx < ueCfgDb->numMacLcs; rlcLcIdx++)
+ {
+ if(ueCfgDb->rlcLcCfg[rlcLcIdx].rbId == srbItem->sRBID && ueCfgDb->rlcLcCfg[rlcLcIdx].rbType == RB_TYPE_SRB)
+ {
+ macLcCtxt = &ueCfgDb->macLcCfg[rlcLcIdx];
+ rlcLcCtxt = &ueCfgDb->rlcLcCfg[rlcLcIdx];
+ break;
+ }
+ }
+ if(!macLcCtxt)
+ {
+ memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
+ macLcCtxt = &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs];
+ ueCfgDb->numMacLcs++;
+ }
+ if(!rlcLcCtxt)
+ {
+ memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
+ rlcLcCtxt = &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs];
+ ueCfgDb->numRlcLcs++;
+ }
+
+ ret = procSrbListToSetup(srbItem, macLcCtxt, rlcLcCtxt);
+
DU_LOG("\nDEBUG --> DUAPP: extractSrbListToSetup: SRBID: %ld [RLC,MAC,NumDrb]:[%x,%x,%x]",\
srbItem->sRBID, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
if(ret == RFAILED)
uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMod_List_t *drbSetupModCfg,\
DRBs_ToBeModified_List_t *drbModCfg, uint8_t drbCount, DuUeCfg *ueCfgDb, uint32_t *drbBitMap, RlcUeCfg *rlcUeCfg)
{
- uint8_t ret, drbIdx = 0, lcId = 0;
+ uint8_t ret = ROK;
+ uint8_t drbIdx = 0, rlcLcIdx = 0;
+ uint8_t drbId = 0, lcId = 0;
DRBs_ToBeSetup_Item_t *drbItem = NULLP;
DRBs_ToBeSetupMod_ItemIEs_t *drbSetupModItem = NULLP;
DRBs_ToBeModified_ItemIEs_t *drbModItem = NULLP;
+ LcCfg *macLcCtxt = NULLP;
+ RlcBearerCfg *rlcLcCtxt = NULLP;
ret = ROK;
if(drbCount > 0)
{
for(drbIdx = 0; drbIdx < drbCount; drbIdx++)
{
+ macLcCtxt = NULL;
+ rlcLcCtxt = NULL;
+
if(ueCfgDb->numMacLcs > MAX_NUM_LC)
{
DU_LOG("\nERROR --> F1AP : MAX LC Reached in MAC at extractDrbListToSetupMod()");
ret = RFAILED;
break;
}
- memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
- memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
if(drbModCfg != NULLP)
{
drbModItem = (DRBs_ToBeModified_ItemIEs_t *) drbModCfg->list.array[drbIdx];
- lcId = fetchLcId(drbModItem->value.choice.DRBs_ToBeModified_Item.dRBID);
+ drbId = drbModItem->value.choice.DRBs_ToBeModified_Item.dRBID;
+ }
+ else if(drbCfg != NULLP)
+ drbId = drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item.dRBID;
+ else if(drbSetupModCfg != NULL)
+ {
+ drbSetupModItem = (DRBs_ToBeSetupMod_ItemIEs_t *) drbSetupModCfg->list.array[drbIdx];
+ drbId = drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item.dRBID;
+ }
+
+ for(rlcLcIdx = 0; rlcLcIdx < ueCfgDb->numRlcLcs; rlcLcIdx++)
+ {
+ if(ueCfgDb->rlcLcCfg[rlcLcIdx].rbId == drbId && ueCfgDb->rlcLcCfg[rlcLcIdx].rbType == RB_TYPE_DRB)
+ {
+ macLcCtxt = &ueCfgDb->macLcCfg[rlcLcIdx];
+ rlcLcCtxt = &ueCfgDb->rlcLcCfg[rlcLcIdx];
+ break;
+ }
+ }
+ if(!macLcCtxt)
+ {
+ memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
+ macLcCtxt = &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs];
+ ueCfgDb->numMacLcs++;
+ }
+ if(!rlcLcCtxt)
+ {
+ memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
+ rlcLcCtxt = &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs];
+ ueCfgDb->numRlcLcs++;
+ }
+
+ if(drbModCfg != NULLP)
+ {
+ lcId = fetchLcId(drbId);
if(lcId < MIN_DRB_LCID)
{
DU_LOG("\nERROR --> F1AP : Failed fetching LCID %d in extractDrbListToSetupMod() for Modified List", lcId);
break;
}
ret = procDrbListToSetupMod(lcId, NULL, NULL, &(drbModItem->value.choice.DRBs_ToBeModified_Item),\
- &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs],\
- &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
+ macLcCtxt, rlcLcCtxt, &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
if(ret == RFAILED)
{
DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for Modified List");
break;
}
-
}
else
{
if(drbCfg != NULL)
{
drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
- ret = procDrbListToSetupMod(lcId, drbItem, NULL, NULL, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\
- &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
+ ret = procDrbListToSetupMod(lcId, drbItem, NULL, NULL, macLcCtxt, rlcLcCtxt, &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
if(ret == RFAILED)
{
DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetup List");
}
else if(drbSetupModCfg != NULL)
{
- drbSetupModItem = (DRBs_ToBeSetupMod_ItemIEs_t *) drbSetupModCfg->list.array[drbIdx];
ret = procDrbListToSetupMod(lcId, NULL, &(drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item), NULL,\
- &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs],\
- &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
+ macLcCtxt, rlcLcCtxt, &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
if(ret == RFAILED)
{
DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetupMod List");
ueCfgDb->numDrbSetupMod++;
}
}
- ueCfgDb->numRlcLcs++;
- ueCfgDb->numMacLcs++;
ueCfgDb->numDrb++;
DU_LOG("\nDEBUG --> DUAPP: extractDrbListToSetupMod:lcId:%x ,BitMap:%x, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
* ****************************************************************/
uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
{
- uint8_t ret=0, ieIdx=0, ueIdx=0, cellIdx=0, servCellIdx = 0;
- bool ueCbFound = false;
+ uint8_t ret=0, ieIdx=0, ieExtIdx = 0, ueIdx=0, cellIdx=0, servCellIdx = 0;
+ bool ueCbFound = false, hoInProgress = false;
+ uint16_t nrCellId = 0;
uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0, bitRateSize=0;
DuUeCb *duUeCb = NULL;
UEContextSetupRequest_t *ueSetReq = NULL;
DRBs_ToBeSetup_List_t *drbCfg = NULL;
+ CUtoDURRCInformation_t *rrcInfo = NULL;
ret = ROK;
gnbCuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID;
break;
}
+
case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
{
gnbDuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID;
break;
}
+
+ case ProtocolIE_ID_id_SpCell_ID:
+ {
+ bitStringToInt(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity, &nrCellId);
+
+ GET_CELL_IDX(nrCellId, cellIdx);
+ if(!duCb.actvCellLst[cellIdx])
+ {
+ DU_LOG("\nERROR --> F1AP : Cell Id [%d] not found", nrCellId);
+ ret = RFAILED;
+ }
+ break;
+ }
+
case ProtocolIE_ID_id_ServCellIndex:
{
servCellIdx = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.ServCellIndex;
- for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
+ break;
+ }
+
+ case ProtocolIE_ID_id_SpCellULConfigured:
+ {
+ /* Indicates whether the gNB-CU requests the gNB-DU to configure the uplink as no UL,
+ UL, SUL or UL+SUL for the indicated cell for the UE */
+ break;
+ }
+
+ case ProtocolIE_ID_id_CUtoDURRCInformation:
+ {
+ rrcInfo = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation;
+
+ /* Search if UE context is present */
+ for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+ {
+ if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId)
+ {
+ ueCbFound = true;
+ duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
+ break;
+ }
+ }
+
+ /* Check if UE Handover scenario */
+ if(rrcInfo->iE_Extensions)
{
- for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+ for(ieExtIdx = 0; ieExtIdx < rrcInfo->iE_Extensions->list.count; ieExtIdx++)
{
- if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
- (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
+ if(rrcInfo->iE_Extensions->list.array[ieExtIdx]->id == ProtocolIE_ID_id_HandoverPreparationInformation)
{
- ueCbFound = true;
- duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
- DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
- if(duUeCb->f1UeDb)
- {
- memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
- duUeCb->f1UeDb->actionType = UE_CTXT_SETUP;
- duUeCb->f1UeDb->cellIdx = cellIdx;
- }
- else
- {
- DU_LOG("\nERROR --> F1AP: Memory Alloc Failed at procF1UeContextSetupReq()");
- ret = RFAILED;
- }
+ hoInProgress = true;
break;
}
- else
- ueCbFound = false;
+ }
+ }
+
+ /* If UE context is not present, but UE is in handover */
+ if(!ueCbFound && hoInProgress)
+ {
+ gnbDuUeF1apId = genGnbDuUeF1apId(nrCellId);
+ duUeCb = &duCb.actvCellLst[cellIdx]->hoUeCb[gnbDuUeF1apId -1];
+ duUeCb->f1UeDb = NULL;
+ duUeCb->gnbCuUeF1apId = gnbCuUeF1apId;
+ duUeCb->gnbDuUeF1apId = gnbDuUeF1apId;
+ duUeCb->ueState = UE_HANDIN_IN_PROGRESS;
+ }
+ if(duUeCb)
+ {
+ DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
+ if(duUeCb->f1UeDb)
+ {
+ memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
+ duUeCb->f1UeDb->actionType = UE_CTXT_SETUP;
+ duUeCb->f1UeDb->cellIdx = cellIdx;
}
- if(ueCbFound)
+ else
+ {
+ DU_LOG("\nERROR --> F1AP: Memory Alloc Failed at procF1UeContextSetupReq()");
+ ret = RFAILED;
break;
+ }
}
- if(!ueCbFound)
+ else
{
DU_LOG("\nERROR --> F1AP: DuUeCb is not found at procF1UeContextSetupReq()");
ret = RFAILED;
+ break;
}
- break;
- }
- case ProtocolIE_ID_id_SpCellULConfigured:
- /* Indicates whether the gNB-CU requests the gNB-DU to configure the uplink as no UL,
- UL, SUL or UL+SUL for the indicated cell for the UE */
- break;
- case ProtocolIE_ID_id_CUtoDURRCInformation:
- {
- if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList)
+
+ /* Extract UE capability info */
+ if(rrcInfo->uE_CapabilityRAT_ContainerList)
{
- duUeCb->f1UeDb->duUeCfg.ueNrCapability = \
- extractUeCapability(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.\
- uE_CapabilityRAT_ContainerList, duUeCb);
+ duUeCb->f1UeDb->duUeCfg.ueNrCapability = extractUeCapability(rrcInfo->uE_CapabilityRAT_ContainerList, duUeCb);
}
- if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.iE_Extensions)
+ /* Extract IE extension */
+ if(rrcInfo->iE_Extensions)
{
- if(extractCuToDuRrcInfoExt(ueSetReq->protocolIEs.list.array[ieIdx]->\
- value.choice.CUtoDURRCInformation.iE_Extensions, &duUeCb->f1UeDb->duUeCfg) != ROK)
+ if(extractCuToDuRrcInfoExt(rrcInfo->iE_Extensions, &duUeCb->f1UeDb->duUeCfg) != ROK)
{
DU_LOG("\nERROR --> F1AP: Failed to extract CU to DU RRC information extension IE");
//TODO: Update the failure cause in ue context Setup Response
}
break;
}
+
case ProtocolIE_ID_id_SCell_ToBeSetup_List:
{
DU_LOG("\nINFO --> DU_APP: Received SCell_ToBeSetup_List but Not processing the list");
break;
}
+
case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
{
if(extractSrbListToSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List,\
- &duUeCb->f1UeDb->duUeCfg))
+ &duUeCb->f1UeDb->duUeCfg))
{
DU_LOG("\nERROR --> DU APP : Failed at extractSrbListToSetup()");
//TODO: Update the failure cause in ue context Setup Response
}
break;
}
+
case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
{
- drbCfg = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List;
+ drbCfg = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List;
- if(extractDrbListToSetupMod(drbCfg, NULL, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULLP))
- {
- DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod()");
- //TODO: Update the failure cause in ue context Setup Response
- ret = RFAILED;
- }
+ if(extractDrbListToSetupMod(drbCfg, NULL, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULLP))
+ {
+ DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod()");
+ //TODO: Update the failure cause in ue context Setup Response
+ ret = RFAILED;
+ }
break;
}
+
case ProtocolIE_ID_id_RRCContainer:
{
/* Filling Dl RRC Msg Info */
}
break;
}
+
case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
{
if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
}
break;
}
+
case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:
{
/* MaximumBitRate Uplink */
ret = RFAILED;
break;
}
+
default:
{
break;
}
+ } /* End of switch */
+
+ /* In case of any failure in any IE */
+ if(ret == RFAILED)
+ {
+ // BuildAndSendUeContextSetupRsp(cellId,ueId);
+ DU_LOG("\nERROR --> F1AP: Failed to process UE CNTXT SETUP REQ at procF1UeContextSetupReq()");
+ break;
}
- }
- if(ret == RFAILED)
- {
- /*TODO : Negative case*/
- // BuildAndSendUeContextSetupRsp(cellId,ueId);
- DU_LOG("\nERROR --> F1AP: Failed to process UE CNTXT SETUP REQ at procF1UeContextSetupReq()");
- }
- else
+ } /* End of for loop of IEs */
+
+ if(ret == ROK)
ret = duProcUeContextSetupRequest(duUeCb);
freeAperDecodeF1UeContextSetupReq(ueSetReq);
asn_enc_rval_t encRetVal; /* Encoder return value */
F1AP_PDU_t *f1apMsg = NULLP;
UEContextSetupResponse_t *ueSetRsp = NULLP;
- CellGroupConfigRrc_t *cellGrpCfg = NULLP;
DuUeCb *ueCb = NULLP;
DU_LOG("\n INFO --> F1AP : Building UE Context Setup Response for cellId %d, ueId %d\n", cellId, ueId);
elementCnt = 3;
if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
elementCnt = 5;
- if(ueCb->f1UeDb->actionType = UE_CTXT_RRC_RECFG_COMPLETE)
+ if(ueCb->f1UeDb->actionType == UE_CTXT_RRC_RECFG_COMPLETE)
elementCnt = 2;
ueContextModifyRes->protocolIEs.list.count = elementCnt;
ueContextModifyRes->protocolIEs.list.size = elementCnt*sizeof(UEContextModificationResponse_t*);
int16_t getStatProhTmr(uint8_t statProhTmrCfg);
uint8_t duProcUeContextModReq(DuUeCb *ueCb);
uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb);
-uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint16_t crnti, DuUeCfg *duUeCfg);
uint8_t BuildAndSendUeContextReleaseReq(uint16_t cellId, uint8_t ueId);
uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId);
uint8_t duSendCellDeletReq(uint16_t cellId);
{
UE_INACTIVE,
UE_ACTIVE,
+ UE_HANDIN_IN_PROGRESS,
UE_DELETION_IN_PROGRESS
}UeState;
MacCellCfg *duMacCellCfg;
CellStatus cellStatus; /* Cell status */
uint32_t numActvUes; /* Total Active UEs */
- DuUeCb ueCb[MAX_NUM_UE]; /* UE CONTEXT */
+ DuUeCb ueCb[MAX_NUM_UE]; /* UE context created after RRC setup */
+ uint32_t numHoUes; /* Number of UE handover in progress */
+ DuUeCb hoUeCb[MAX_NUM_UE]; /* UE context created before RACH for UE being handover to this DU */
SlotInfo currSlotInfo;
}DuCellCb;
{
if(dlRrcMsg->gnbDuUeF1apId == duCb.ueCcchCtxt[ueIdx].gnbDuUeF1apId)
{
- ueCcchCtxtFound = true;
+ ueCcchCtxtFound = true;
crnti = duCb.ueCcchCtxt[ueIdx].crnti;
cellId = duCb.ueCcchCtxt[ueIdx].cellId;
break;
{
*macAmbrCfgToSend = ueDbAmbr;
}
- else
+ else if(oldMacAmbrCfg)
*macAmbrCfgToSend = *oldMacAmbrCfg;
}
else
{
if(ueDbAmbr)
{
- if(*oldMacAmbrCfg)
- {
- DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, *oldMacAmbrCfg, sizeof(AmbrCfg));
- }
- DU_ALLOC_SHRABL_BUF(*oldMacAmbrCfg, sizeof(AmbrCfg));
- if(*oldMacAmbrCfg == NULLP)
+ if(oldMacAmbrCfg)
{
- DU_LOG("\nERROR --> DU APP : Memory Alloc Failed at fillAmbr()");
- return RFAILED;
+ if(*oldMacAmbrCfg)
+ {
+ DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, *oldMacAmbrCfg, sizeof(AmbrCfg));
+ }
+ DU_ALLOC_SHRABL_BUF(*oldMacAmbrCfg, sizeof(AmbrCfg));
+ if(*oldMacAmbrCfg == NULLP)
+ {
+ DU_LOG("\nERROR --> DU APP : Memory Alloc Failed at fillAmbr()");
+ return RFAILED;
+ }
+ memset(*oldMacAmbrCfg, 0, sizeof(AmbrCfg));
+ (*oldMacAmbrCfg)->ulBr = ueDbAmbr->ulBr;
}
- memset(*oldMacAmbrCfg, 0, sizeof(AmbrCfg));
- (*oldMacAmbrCfg)->ulBr = ueDbAmbr->ulBr;
}
}
* @return ROK/RFAILED
*
*****************************************************************/
-uint8_t fillMacUeCfg(uint16_t cellId, uint8_t ueId, uint16_t crnti, DuUeCfg *ueCfgDb, MacUeCfg *macUeCfg)
+uint8_t fillMacUeCfg(uint16_t cellId, uint8_t gnbDuUef1apId, uint16_t crnti, DuUeCfg *ueCfgDb, MacUeCfg *macUeCfg)
{
- uint8_t ret, dbIdx, lcIdx, cellIdx;
+ uint8_t ret = ROK, dbIdx = 0, lcIdx = 0, cellIdx = 0;
bool lcIdFound = false;
MacUeCfg *duMacDb = NULLP;
- ret =ROK;
+ macUeCfg->cellId = cellId;
+ if(crnti)
+ {
+ GET_UE_ID(crnti, macUeCfg->ueId);
+ macUeCfg->crnti = crnti;
+ }
+ macUeCfg->duUeF1apId = gnbDuUef1apId;
if(!ueCfgDb)
{
- macUeCfg->cellId = cellId;
- macUeCfg->ueId = ueId;
- macUeCfg->crnti = crnti;
-
fillDefaultMacCellGrpInfo(macUeCfg);
fillDefaultPhyCellGrpInfo(macUeCfg);
}
else
{
- /* Fetching MacDb from DuUeCb */
- GET_CELL_IDX(cellId, cellIdx);
- if(duCb.actvCellLst[cellIdx])
- duMacDb = &duCb.actvCellLst[cellIdx]->ueCb[ueId-1].macUeCfg;
- else
+ /* 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)
{
- DU_LOG("\nERROR --> DU APP : Cell Id [%d] does not exist", cellId);
- return RFAILED;
+ GET_CELL_IDX(cellId, cellIdx);
+ if(duCb.actvCellLst[cellIdx])
+ duMacDb = &duCb.actvCellLst[cellIdx]->ueCb[macUeCfg->ueId-1].macUeCfg;
+ else
+ {
+ DU_LOG("\nERROR --> DU APP : Cell Id [%d] does not exist", cellId);
+ return RFAILED;
+ }
+ duMacDb->macUeCfgState = UE_CFG_INPROGRESS;
}
- duMacDb->macUeCfgState = UE_CFG_INPROGRESS;
- /* Fetching MaUeCfg List for ADD/MOD/DEL */
- macUeCfg->cellId = cellId;
- macUeCfg->ueId = ueId;
- macUeCfg->crnti = crnti;
- ret = procUeReCfgCellInfo(macUeCfg, duMacDb, ueCfgDb->cellGrpCfg);
- if(ret == ROK)
+
+ if(ueCfgDb->cellGrpCfg)
{
- if(macUeCfg->spCellCfgPres == true)
+ ret = procUeReCfgCellInfo(macUeCfg, duMacDb, ueCfgDb->cellGrpCfg);
+ if(ret == ROK)
{
- if(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent)
+ if(macUeCfg->spCellCfgPres == true)
{
- 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);
+ 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);
+ }
}
+
+ if(duMacDb)
+ ret = fillAmbr(&macUeCfg->ambrCfg, ueCfgDb->ambrCfg , &duMacDb->ambrCfg, FALSE);
+ else
+ ret = fillAmbr(&macUeCfg->ambrCfg, ueCfgDb->ambrCfg , NULL, FALSE);
+
+ duFillModulationDetails(macUeCfg, duMacDb, ueCfgDb->ueNrCapability);
}
- ret = fillAmbr(&macUeCfg->ambrCfg, ueCfgDb->ambrCfg , &duMacDb->ambrCfg, FALSE);
- duFillModulationDetails(macUeCfg, duMacDb, ueCfgDb->ueNrCapability);
+ }
+ else
+ {
+ fillDefaultMacCellGrpInfo(macUeCfg);
+ fillDefaultPhyCellGrpInfo(macUeCfg);
+ fillDefaultSpCellGrpInfo(macUeCfg);
+ fillDefaultModulation(macUeCfg);
}
/* Filling LC Context */
ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres = true;
fillDefaultUlLcCfg(&ueCfgDb->macLcCfg[dbIdx].ulLcCfg);
}
- for(lcIdx = 0; lcIdx < duMacDb->numLcs; lcIdx++)
+
+ if(duMacDb)
{
- if(ueCfgDb->macLcCfg[dbIdx].lcId == duMacDb->lcCfgList[lcIdx].lcId)
+ for(lcIdx = 0; lcIdx < duMacDb->numLcs; lcIdx++)
{
- lcIdFound = true;
- if((ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_UNKNOWN) ||
- (ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_MOD))
+ if(ueCfgDb->macLcCfg[dbIdx].lcId == duMacDb->lcCfgList[lcIdx].lcId)
{
- ueCfgDb->macLcCfg[dbIdx].configType = CONFIG_MOD;
- ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx],\
- &duMacDb->lcCfgList[lcIdx], FALSE);
+ 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],\
+ &duMacDb->lcCfgList[lcIdx], FALSE);
+ }
}
+ else
+ lcIdFound = false;
}
- else
- lcIdFound = false;
}
+
if(!lcIdFound)
{
/* ADD/DEL CONFIG */
/* Filling Mac Ue Config */
memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg, 0, sizeof(MacUeCfg));
- ret = duBuildAndSendUeCreateReqToMac(ueCcchCtxt->cellId, ueId, ueCcchCtxt->crnti,\
+ ret = duBuildAndSendUeCreateReqToMac(ueCcchCtxt->cellId, ueCcchCtxt->gnbDuUeF1apId, ueCcchCtxt->crnti, NULL,
&duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg);
if(ret == RFAILED)
DU_LOG("\nERROR --> DU APP : Failed to send UE create request to MAC");
* @Params[in] cellId,
* ueId,
* crnti,
- * UE config
+ * UE config extracted from F1AP msg
+ * MAC UE config struct to be filled
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
-uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueId, uint16_t crnti, MacUeCfg *duMacUeCfg)
+uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb, MacUeCfg *duMacUeCfg)
{
uint8_t ret = ROK;
MacUeCfg *macUeCfg = NULLP;
memset(&pst, 0, sizeof(Pst));
- ret = fillMacUeCfg(cellId, ueId, crnti, NULL, duMacUeCfg);
+ ret = fillMacUeCfg(cellId, gnbDuUeF1apId, crnti, ueCfgDb, duMacUeCfg);
if(ret == RFAILED)
{
DU_LOG("\nERROR --> DU APP : Failed to fill MacUeCfg at duBuildAndSendUeCreateReqToMac()");
return RFAILED;
}
+
/* Fill Pst */
FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CREATE_REQ);
ret = (*packMacUeCreateReqOpts[pst.selector])(&pst, macUeCfg);
if(ret == RFAILED)
{
- DU_LOG("\nERROR --> DU_APP : Failure in sending Ue Create Req to MAC at duBuildAndSendUeCreateReqToMac()");
- DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg));
+ DU_LOG("\nERROR --> DU_APP : Failure in sending Ue Create Req to MAC at duBuildAndSendUeCreateReqToMac()");
+ DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg));
}
}
else
* ****************************************************************/
uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
{
- uint8_t ret = ROK;
+ uint8_t ret = ROK, ueIdx = 0, ueId = 0;
+ DuUeCb *ueCb = NULLP;
if(cfgRsp)
{
{
if(pst->event == EVENT_MAC_UE_CREATE_RSP)
{
- DU_LOG("\nINFO --> DU APP : MAC UE Create Response : SUCCESS [UE IDX : %d]", cfgRsp->ueId);
- duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].\
- macUeCfg.macUeCfgState = UE_CREATE_COMPLETE;
+ DU_LOG("\nINFO --> DU APP : MAC UE Create Response : SUCCESS [DU UE F1AP ID : %d]", cfgRsp->duUeF1apId);
+
+ for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+ {
+ if(duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[ueIdx].gnbDuUeF1apId == cfgRsp->duUeF1apId)
+ {
+ ueCb = &duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[ueIdx];
+ ueCb->macUeCfg.macUeCfgState = UE_CREATE_COMPLETE;
+ break;
+ }
+ }
+ if(!ueCb)
+ {
+ if(duCb.actvCellLst[cfgRsp->cellId -1]->hoUeCb[cfgRsp->duUeF1apId-1].gnbDuUeF1apId == cfgRsp->duUeF1apId)
+ {
+ ueCb = &duCb.actvCellLst[cfgRsp->cellId -1]->hoUeCb[cfgRsp->duUeF1apId-1];
+ ueCb->macUeCfg.macUeCfgState = UE_CREATE_COMPLETE;
+ //TODO : in next gerrit
+ //BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueId);
+ }
+ }
+
}
else if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
{
- DU_LOG("\nINFO --> DU APP : MAC UE Reconfig Response : SUCCESS [UE IDX : %d]", cfgRsp->ueId);
- duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].macUeCfg.macUeCfgState = UE_RECFG_COMPLETE;
- if((ret = duUpdateDuUeCbCfg(cfgRsp->ueId, cfgRsp->cellId)) == ROK)
+ DU_LOG("\nINFO --> DU APP : MAC UE Reconfig Response : SUCCESS [DU UE F1AP ID : %d]", cfgRsp->duUeF1apId);
+ for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
{
- BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueId);
+ if(duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[ueIdx].gnbDuUeF1apId == cfgRsp->duUeF1apId)
+ {
+ ueCb = &duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[ueIdx];
+ ueCb->macUeCfg.macUeCfgState = UE_RECFG_COMPLETE;
+ break;
+ }
+ }
+
+ if(ueCb)
+ {
+ GET_UE_ID(ueCb->crnti, ueId);
+ if((ret = duUpdateDuUeCbCfg(ueId, cfgRsp->cellId)) == ROK)
+ {
+ BuildAndSendUeCtxtRsp(cfgRsp->cellId, ueId);
+ }
}
}
}
else
{
- DU_LOG("\nERROR --> DU APP : MAC UE CFG Response for EVENT[%d]: FAILURE [UE IDX : %d]", pst->event, cfgRsp->ueId);
+ DU_LOG("\nERROR --> DU APP : MAC UE CFG Response for EVENT[%d]: FAILURE [DU UE F1AP ID : %d]", pst->event, cfgRsp->duUeF1apId);
if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
{
//TODO: Send the failure case in Ue Context Setup Response
*
* ****************************************************************/
-uint8_t duBuildAndSendUeReCfgReqToMac(uint8_t cellId, uint8_t crnti, DuUeCfg *ueCfgDb)
+uint8_t duBuildAndSendUeReCfgReqToMac(uint8_t cellId, uint8_t duUeF1apId, uint8_t crnti, DuUeCfg *ueCfgDb)
{
- uint8_t ret, ueId = 0;
+ uint8_t ret = ROK;
MacUeCfg *macUeCfg = NULLP;
- ret = ROK;
- GET_UE_ID(crnti, ueId);
-
DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg));
if(macUeCfg)
{
memset(macUeCfg, 0, sizeof(MacUeCfg));
- ret = fillMacUeCfg(cellId, ueId, crnti, ueCfgDb, macUeCfg);
+ ret = fillMacUeCfg(cellId, duUeF1apId, crnti, ueCfgDb, macUeCfg);
if(ret == RFAILED)
DU_LOG("\nERROR --> DU APP : Failed to fill Mac Ue Cfg at duBuildAndSendUeReCfgReqToMac()");
else
*
*****************************************************************/
-uint8_t duBuildAndSendUeContextSetupReq(uint16_t cellId, uint16_t crnti, DuUeCfg *duUeCfg)
+uint8_t duBuildAndSendUeContextSetupReq(uint16_t cellId, DuUeCb *ueCb)
{
uint8_t ret = ROK;
+ uint16_t crnti;
+ DuUeCfg *duUeCfg = NULLP;
DU_LOG("\nDEBUG --> DU_APP: Processing Ue Context Setup 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 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()");
+ }
return ret;
}
{
if(ueCb->f1UeDb->actionType == UE_CTXT_SETUP)
{
- ret = duBuildAndSendUeContextSetupReq(cellId, crnti, &ueCb->f1UeDb->duUeCfg);
+ ret = duBuildAndSendUeContextSetupReq(cellId, ueCb);
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(cellId, crnti, &ueCb->f1UeDb->duUeCfg);
+ ret = duBuildAndSendUeContextModReq(cellId, ueCb->gnbDuUeF1apId, crnti, &ueCb->f1UeDb->duUeCfg);
if(ret == RFAILED)
DU_LOG("\nERROR --> DU APP : Failed to process UE Context Mod Request in DuProcRlcDlRrcMsgRsp()");
}
if(ueCb)
{
cellId = duCb.actvCellLst[ueCb->f1UeDb->cellIdx]->cellId;
+
/* Send DL RRC msg for security Mode */
if(ueCb->f1UeDb->dlRrcMsg)
{
}
else if(ueCb->f1UeDb->actionType == UE_CTXT_SETUP)
{
- ret = duBuildAndSendUeContextSetupReq(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
+ ret = duBuildAndSendUeContextSetupReq(cellId, ueCb);
if(ret == RFAILED)
{
DU_LOG("\nERROR --> DU APP : Failed to build ue context setup Req in duProcUeContextSetupRequest()");
*
*****************************************************************/
-uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint16_t crnti, DuUeCfg *duUeCfg)
+uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint8_t gnbDuUeF1apId, uint16_t crnti, DuUeCfg *duUeCfg)
{
uint8_t ret = ROK;
DU_LOG("\nERROR --> DU APP : Failed to build ctxt setup req for RLC at duBuildAndSendUeContextModReq()");
/* Filling MAC Ue Reconfig */
- ret = duBuildAndSendUeReCfgReqToMac(cellId, crnti, duUeCfg);
+ ret = duBuildAndSendUeReCfgReqToMac(cellId, gnbDuUeF1apId, crnti, duUeCfg);
if(ret == RFAILED)
DU_LOG("\nERROR --> DU APP : Failed at build ctxt setup req for MAC at duBuildAndSendUeContextModReq()");
}
else if(ueCb->f1UeDb->actionType == UE_CTXT_MOD)
{
- ret = duBuildAndSendUeContextModReq(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
+ ret = duBuildAndSendUeContextModReq(cellId, ueCb->gnbDuUeF1apId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
if(ret == RFAILED)
{
DU_LOG("\nERROR --> DU APP : Failed to build ue context setup Req in duProcUeContextModReq()");
uint8_t duHdlRlcUlData(Pst *pst, KwuDatIndInfo* datInd, Buffer *mBuf);
uint8_t cmPkRlcDatReq(Pst * pst,RlcDatReqInfo* datReq,Buffer * mBuf);
-uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueId, uint16_t crnti, MacUeCfg *duMacUeCfg);
+uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueId, uint16_t crnti, DuUeCfg *ueCfgDb, MacUeCfg *duMacUeCfg);
uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t ueId, RlcUeCfg *duRlcUeCfg);
uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId);
uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo);
void freeF1UeDb(F1UeContextSetupDb *f1UeDb);
uint8_t sendUeDeleteReqToMac(uint16_t cellId, uint8_t ueId, uint16_t crnti);
uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueId);
+int32_t genGnbDuUeF1apId(uint8_t cellId);
+uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint8_t duUeF1apId, uint16_t crnti, DuUeCfg *duUeCfg);
+
#endif
/**********************************************************************