X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2F5gnrsch%2Fsch_ue_mgr.c;h=9f010d4d9e19d3b2191222ecbdf69198218ab3d5;hb=38ebc92a011353b8b2d9401efa4173c79114fa1c;hp=2e411cbe78536edf41eda69902231a376a2d586b;hpb=f27b7e83366beb014dd32e1eb6d22d8901501eeb;p=o-du%2Fl2.git diff --git a/src/5gnrsch/sch_ue_mgr.c b/src/5gnrsch/sch_ue_mgr.c index 2e411cbe7..9f010d4d9 100644 --- a/src/5gnrsch/sch_ue_mgr.c +++ b/src/5gnrsch/sch_ue_mgr.c @@ -72,8 +72,8 @@ void SchSendUeCfgRspToMac(uint16_t event, SchUeCfg *ueCfg, Inst inst,\ Pst rspPst; cfgRsp->cellId = ueCfg->cellId; + cfgRsp->ueId = ueCfg->ueId; cfgRsp->crnti = ueCfg->crnti; - GET_UE_ID(ueCfg->crnti, cfgRsp->ueId); cfgRsp->rsp = result; /* Filling response post */ @@ -180,7 +180,8 @@ void fillSchUlLcCtxt(SchUlLcCtxt *ueCbLcCfg, SchLcCfg *lcCfg) * * Functionality: Function to fill DLDedLcInfo * - * @params[arg] snssai pointer, + * @params[arg] scheduler instance, + * snssai pointer, * SchRrmPolicy pointer, * SchLcPrbEstimate pointer , It will be filled * isDedicated pointer,(Address of isDedicated flag in LC Context) @@ -191,11 +192,10 @@ void fillSchUlLcCtxt(SchUlLcCtxt *ueCbLcCfg, SchLcCfg *lcCfg) * * ****************************************************************/ -uint8_t updateDedLcInfo(Snssai *snssai, SchLcPrbEstimate *lcPrbEst,\ - bool *isDedicated) +uint8_t updateDedLcInfo(Inst inst, Snssai *snssai, SchLcPrbEstimate *lcPrbEst, bool *isDedicated) { uint8_t sliceCfgIdx =0; - SchSliceCfg sliceCfg = schCb[0].sliceCfg; + SchSliceCfg sliceCfg = schCb[inst].sliceCfg; if(sliceCfg.numOfSliceConfigured) { @@ -241,13 +241,14 @@ uint8_t updateDedLcInfo(Snssai *snssai, SchLcPrbEstimate *lcPrbEst,\ * * Functionality: Function to fill SchUeCb * - * @params[in] SchUeCb pointer, + * @params[in] Scheduler instance, + * SchUeCb pointer, * SchUeCfg pointer * @return ROK/RFAILED * * ****************************************************************/ -uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg) +uint8_t fillSchUeCb(Inst inst, SchUeCb *ueCb, SchUeCfg *ueCfg) { uint8_t lcIdx, ueLcIdx; uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0}; @@ -258,7 +259,9 @@ uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg) bool isLcIdValid = FALSE; ueCb->ueCfg.cellId = ueCfg->cellId; + ueCb->ueCfg.ueId = ueCfg->ueId; ueCb->ueCfg.crnti = ueCfg->crnti; + ueCb->ueCfg.dataTransmissionAction = ueCfg->dataTransmissionInfo; if(ueCfg->macCellGrpCfgPres == true) { memcpy(&ueCb->ueCfg.macCellGrpCfg , &ueCfg->macCellGrpCfg, sizeof(SchMacCellGrpCfg)); @@ -298,7 +301,6 @@ uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg) } } - ueCb->state = SCH_UE_STATE_ACTIVE; if(ueCfg->ambrCfg) { SCH_FREE(ueCb->ueCfg.ambrCfg, sizeof(SchAmbrCfg)); @@ -328,12 +330,12 @@ uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg) * and Create the Dedicated LC List & Update the Reserve PRB number*/ if(ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai != NULLP) { - retDL = updateDedLcInfo(ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai, &(ueCb->dlLcPrbEst),\ + retDL = updateDedLcInfo(inst, ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai, &(ueCb->dlLcPrbEst),\ &(ueCb->dlInfo.dlLcCtxt[ueLcIdx].isDedicated)); } if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai != NULLP) { - retUL = updateDedLcInfo(ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai, &(ueCb->ulLcPrbEst),\ + retUL = updateDedLcInfo(inst, ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai, &(ueCb->ulLcPrbEst),\ &(ueCb->ulInfo.ulLcCtxt[ueLcIdx].isDedicated)); } @@ -353,7 +355,7 @@ uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg) /*Updating the RRM reserved pool PRB count*/ if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai != NULLP) { - retUL = updateDedLcInfo(ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai, &(ueCb->ulLcPrbEst),\ + retUL = updateDedLcInfo(inst, ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai, &(ueCb->ulLcPrbEst),\ &(ueCb->ulInfo.ulLcCtxt[ueLcIdx].isDedicated)); } if(retUL == RFAILED) @@ -396,7 +398,7 @@ uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg) /*Updating the RRM policy*/ if(ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai != NULLP) { - retDL = updateDedLcInfo(ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai, &(ueCb->dlLcPrbEst), \ + retDL = updateDedLcInfo(inst, ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai, &(ueCb->dlLcPrbEst), \ &(ueCb->dlInfo.dlLcCtxt[ueLcIdx].isDedicated)); } if(retDL == RFAILED) @@ -504,11 +506,11 @@ SchCellCb *getSchCellCb(uint16_t srcEvent, Inst inst, SchUeCfg *ueCfg) * ****************************************************************/ uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfg *ueCfg) { - uint8_t ueId, lcIdx, ret = ROK; + uint8_t lcIdx = 0, ret = ROK; SchCellCb *cellCb = NULLP; SchUeCb *ueCb = NULLP; SchUeCfgRsp cfgRsp; - Inst inst = pst->dstInst - 1; + Inst inst = pst->dstInst - SCH_INST_START; memset(&cfgRsp, 0, sizeof(SchUeCfgRsp)); #ifdef CALL_FLOW_DEBUG_LOG @@ -524,34 +526,32 @@ uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfg *ueCfg) 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((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; - } - } - else + ueCb = &cellCb->ueCb[ueCfg->ueId - 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->ueId = ueCfg->ueId; ueCb->crnti = ueCfg->crnti; - ueCb->state = SCH_UE_STATE_ACTIVE; - ret = fillSchUeCb(ueCb, ueCfg); + 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; @@ -741,7 +741,7 @@ uint8_t MacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfg) SchCellCb *cellCb = NULLP; SchUeCb *ueCb = NULLP; SchUeCfgRsp cfgRsp; - Inst inst = pst->dstInst - 1; + Inst inst = pst->dstInst - SCH_INST_START; memset(&cfgRsp, 0, sizeof(SchUeCfgRsp)); #ifdef CALL_FLOW_DEBUG_LOG @@ -769,7 +769,7 @@ uint8_t MacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfg) if((ueCb->crnti == ueCfg->crnti) && (ueCb->state == SCH_UE_STATE_ACTIVE)) { /* Found the UeCb to Reconfig */ - ret = fillSchUeCb(ueCb, ueCfg); + ret = fillSchUeCb(inst, ueCb, ueCfg); if(ret == ROK) { ueCb->cellCb = cellCb; @@ -1004,7 +1004,7 @@ uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete *ueDelete) uint8_t idx=0, ueId=0, ueIdToDel=0, ret=ROK; ErrorCause result; SchCellCb *cellCb = NULLP; - Inst inst = pst->dstInst - 1; + Inst inst = pst->dstInst - SCH_INST_START; CmLList *node = NULL, *next = NULL; #ifdef CALL_FLOW_DEBUG_LOG @@ -1052,7 +1052,7 @@ uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete *ueDelete) else { DU_LOG("\nERROR --> SCH : MacSchUeDeleteReq(): SchUeCb not found"); - result = INVALID_UEIDX; + result = INVALID_UEID; } } @@ -1208,7 +1208,7 @@ void deleteSchCellCb(SchCellCb *cellCb) uint8_t MacSchCellDeleteReq(Pst *pst, SchCellDelete *cellDelete) { uint8_t cellIdx=0, ret = RFAILED; - Inst inst = pst->dstInst - 1; + Inst inst = pst->dstInst - SCH_INST_START; SchMacRsp result= RSP_OK; #ifdef CALL_FLOW_DEBUG_LOG