X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2F5gnrsch%2Fsch_ue_mgr.c;h=3db4b1c0e13cccbd1784e0b14a8128ffe2b09963;hb=45967e320fb5747a257af75f3d2f12c0aa9daee0;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..3db4b1c0e 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)); @@ -273,6 +276,19 @@ uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg) if(ueCfg->spCellCfgPres == true) { + if(ueCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfgPres == true) + { + if(ueCb->ueCfg.spCellCfgPres && ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfgPres == true) + { + for(uint8_t idx = 0; idx < ueCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc; idx++) + { + if(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[idx].k0 && ueCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[idx].k0) + { + SCH_FREE(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[idx].k0, sizeof(uint8_t)); + } + } + } + } memcpy(&ueCb->ueCfg.spCellCfg , &ueCfg->spCellCfg, sizeof(SchSpCellCfg)); covertFreqDomRsrcMapToIAPIFormat(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc,\ @@ -298,7 +314,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 +343,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 +368,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 +411,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 +519,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 +539,38 @@ 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); + + ret = fillSchUeCb(inst, ueCb, ueCfg); if(ret == ROK) { - cellCb->numActvUe++; - SET_ONE_BIT(ueCb->ueId, cellCb->actvUeBitMap); + /* If UE has initiated RACH and then UE context is created, it means UE is + * active now. + * Else if UE context is created before RACH, this means that UE is being + * handed-in from source DU */ + if(cellCb->raCb[ueCb->ueId-1].tcrnti == ueCb->crnti) + { + cellCb->numActvUe++; + SET_ONE_BIT(ueCb->ueId, cellCb->actvUeBitMap); + ueCb->state = SCH_UE_STATE_ACTIVE; + } + else + { + ueCb->state = SCH_UE_HANDIN_IN_PROGRESS; + } + ueCb->cellCb = cellCb; ueCb->srRcvd = false; ueCb->bsrRcvd = false; @@ -741,7 +760,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 +788,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 +1023,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 +1071,7 @@ uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete *ueDelete) else { DU_LOG("\nERROR --> SCH : MacSchUeDeleteReq(): SchUeCb not found"); - result = INVALID_UEIDX; + result = INVALID_UEID; } } @@ -1128,6 +1147,7 @@ void deleteSchCellCb(SchCellCb *cellCb) uint8_t sliceIdx=0, slotIdx=0; CmLListCp *list=NULL; CmLList *node=NULL, *next=NULL; + SchPageInfo *tempNode = NULLP; if(cellCb->schDlSlotInfo) { @@ -1173,6 +1193,24 @@ void deleteSchCellCb(SchCellCb *cellCb) } SCH_FREE(cellCb->cellCfg.plmnInfoList.snssai, cellCb->cellCfg.plmnInfoList.numSliceSupport*sizeof(Snssai*)); } + + for(uint16_t idx =0; idxpageCb.pageIndInfoRecord[idx]; + node = list->first; + while(node) + { + next = node->next; + if(node->node) + { + tempNode = (SchPageInfo*)(node->node); + SCH_FREE(tempNode->pagePdu, tempNode->msgLen); + SCH_FREE(node->node, sizeof(SchPageInfo)); + } + deleteNodeFromLList(list, node); + node = next; + } + } /* Remove all UE from ueToBeScheduled list and deallocate */ node = cellCb->ueToBeScheduled.first; @@ -1208,7 +1246,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