X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrsch%2Fsch_slot_ind.c;h=29a9480245940a9cc17720640d0b61bd3499358a;hb=8133a1985d2c53074af88c44edfb9231af64b433;hp=07ed7aaeb0c229ca9d8126d5d151751fa1cd444b;hpb=8e6123e23f6d831b1fe972f8229e9594a2e92237;p=o-du%2Fl2.git diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 07ed7aaeb..29a948024 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -112,6 +112,7 @@ void schCalcSlotValues(SlotTimingInfo slotInd, SchSlotValue *schSlotValue) ADD_DELTA_TO_TIME(slotInd, schSlotValue->broadcastTime, PHY_DELTA_DL + SCHED_DELTA); ADD_DELTA_TO_TIME(slotInd, schSlotValue->rarTime, PHY_DELTA_DL + SCHED_DELTA); ADD_DELTA_TO_TIME(slotInd, schSlotValue->dlMsgTime, PHY_DELTA_DL + SCHED_DELTA); + ADD_DELTA_TO_TIME(slotInd, schSlotValue->ulDciTime, PHY_DELTA_DL + SCHED_DELTA); } /******************************************************************* @@ -404,14 +405,9 @@ bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t if ((ueCb->dlLcPrbEst.defLcList.count == 0) && \ - ((ueCb->dlLcPrbEst.dedLcInfo != NULL) && (ueCb->dlLcPrbEst.dedLcInfo->dedLcList.count == 0))) + ((ueCb->dlLcPrbEst.dedLcInfo == NULL) || (ueCb->dlLcPrbEst.dedLcInfo->dedLcList.count == 0))) { DU_LOG("\nDEBUG --> SCH : No pending BO for any LC id\n"); - if(*(uint8_t *)cell->ueToBeScheduled.first->node == ueId) - { - SCH_FREE(cell->ueToBeScheduled.first->node, sizeof(uint8_t)); - deleteNodeFromLList(&cell->ueToBeScheduled, cell->ueToBeScheduled.first); - } UNSET_ONE_BIT(ueId, cell->boIndBitMap); /* Free the dl ded msg info allocated in macSchDlRlcBoInfo */ @@ -422,11 +418,13 @@ bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t } else memset(&dciSlotAlloc->dlMsgSchedInfo[dciSlotAlloc->numSchedInfo], 0, sizeof(DlMsgSchInfo)); - return false; + + /*TRUE because this UE has nothing to be scheduled*/ + return true; } /*[Step3]: Calculate Best FREE BLOCK with MAX PRB count*/ - maxFreePRB = searchLargestFreeBlockDL(cell, pdschTime, &startPrb); + maxFreePRB = searchLargestFreeBlock(cell, pdschTime, &startPrb, DIR_DL); /*[Step4]: Estimation of PRB and BO which can be allocated to each LC in * the list based on RRM policy*/ @@ -440,12 +438,12 @@ bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t || ((maxFreePRB < ueCb->dlLcPrbEst.dedLcInfo->rsvdDedicatedPRB))) { ueCb->dlLcPrbEst.sharedNumPrb = maxFreePRB; - DU_LOG("\nWARNING --> SCH : Only Default Slice is scheduled, sharedPRB Count:%d",\ + DU_LOG("\nDEBUG --> SCH : DL Only Default Slice is scheduled, sharedPRB Count:%d",\ ueCb->dlLcPrbEst.sharedNumPrb); /*PRB Alloc for Default LCs*/ prbAllocUsingRRMPolicy(&(ueCb->dlLcPrbEst.defLcList), FALSE, mcsIdx, pdschNumSymbols,\ - &(ueCb->dlLcPrbEst.sharedNumPrb), NULLP, &isTxPayloadLenAdded); + &(ueCb->dlLcPrbEst.sharedNumPrb), NULLP, &isTxPayloadLenAdded, NULLP); } else { @@ -453,20 +451,20 @@ bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t /*PRB Alloc for Dedicated LCs*/ prbAllocUsingRRMPolicy(&(ueCb->dlLcPrbEst.dedLcInfo->dedLcList), TRUE, mcsIdx, pdschNumSymbols,\ - &(ueCb->dlLcPrbEst.sharedNumPrb), &(ueCb->dlLcPrbEst.dedLcInfo->rsvdDedicatedPRB), &isTxPayloadLenAdded); + &(ueCb->dlLcPrbEst.sharedNumPrb), &(ueCb->dlLcPrbEst.dedLcInfo->rsvdDedicatedPRB), &isTxPayloadLenAdded, NULLP); /*PRB Alloc for Default LCs*/ prbAllocUsingRRMPolicy(&(ueCb->dlLcPrbEst.defLcList), FALSE, mcsIdx, pdschNumSymbols, \ - &(ueCb->dlLcPrbEst.sharedNumPrb), &(ueCb->dlLcPrbEst.dedLcInfo->rsvdDedicatedPRB), &isTxPayloadLenAdded); + &(ueCb->dlLcPrbEst.sharedNumPrb), &(ueCb->dlLcPrbEst.dedLcInfo->rsvdDedicatedPRB), &isTxPayloadLenAdded, NULLP); } } /*[Step5]:Traverse each LCID in LcList to calculate the exact Scheduled Bytes * using allocated BO per LC and Update dlMsgAlloc(BO report for MAC*/ if(ueCb->dlLcPrbEst.dedLcInfo != NULLP) - updateGrantSizeForBoRpt(&(ueCb->dlLcPrbEst.dedLcInfo->dedLcList), dciSlotAlloc, &(accumalatedSize)); + updateGrantSizeForBoRpt(&(ueCb->dlLcPrbEst.dedLcInfo->dedLcList), dciSlotAlloc, NULLP, &(accumalatedSize)); - updateGrantSizeForBoRpt(&(ueCb->dlLcPrbEst.defLcList), dciSlotAlloc, &(accumalatedSize)); + updateGrantSizeForBoRpt(&(ueCb->dlLcPrbEst.defLcList), dciSlotAlloc, NULLP, &(accumalatedSize)); /*Below case will hit if NO LC(s) are allocated due to resource crunch*/ if (!accumalatedSize) @@ -590,10 +588,12 @@ bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t * ****************************************************************/ uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst) { - uint8_t ueId, ueIdx, lcgIdx, ret = ROK; + uint8_t ueId, ueIdx, ret = ROK; uint16_t slot; bool isRarPending = false, isRarScheduled = false; bool isMsg4Pending = false, isMsg4Scheduled = false; + bool isUlGrantPending = false, isUlGrantScheduled = false; + bool isDlMsgPending = false, isDlMsgScheduled = false; CmLList *pendingUeNode; DlSchedInfo dlSchedInfo; DlBrdcstAlloc *dlBrdcstAlloc = NULLP; @@ -655,48 +655,67 @@ uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst) pendingUeNode = cell->ueToBeScheduled.first; if(pendingUeNode) { - ueId = *(uint8_t *)(pendingUeNode->node); - - /* If RAR is pending for this UE, schedule PDCCH,PDSCH to send RAR and - * PUSCH to receive MSG3 as per k0-k2 configuration*/ - if(cell->raReq[ueId-1] != NULLP) + if(pendingUeNode->node) { - isRarPending = true; - isRarScheduled = schProcessRaReq(cell, *slotInd, ueId); - } + ueId = *(uint8_t *)(pendingUeNode->node); - /* If MSG4 is pending for this UE, schedule PDCCH,PDSCH to send MSG4 and - * PUCCH to receive UL msg as per k0-k1 configuration */ - if(cell->raCb[ueId-1].msg4recvd) - { - isMsg4Pending = true; - isMsg4Scheduled = schProcessMsg4Req(cell, *slotInd, ueId); - } + /* If RAR is pending for this UE, schedule PDCCH,PDSCH to send RAR and + * PUSCH to receive MSG3 as per k0-k2 configuration*/ + if(cell->raReq[ueId-1] != NULLP) + { + isRarPending = true; + isRarScheduled = schProcessRaReq(cell, *slotInd, ueId); + } - if(isRarPending || isMsg4Pending) - { - /* If RAR or MSG is successfully scheduled then - * remove UE from linked list since no pending msgs for this UE */ - if(isRarScheduled || isMsg4Scheduled) + /* If MSG4 is pending for this UE, schedule PDCCH,PDSCH to send MSG4 and + * PUCCH to receive UL msg as per k0-k1 configuration */ + if(cell->raCb[ueId-1].msg4recvd) { - SCH_FREE(pendingUeNode->node, sizeof(uint8_t)); - deleteNodeFromLList(&cell->ueToBeScheduled, pendingUeNode); + isMsg4Pending = true; + isMsg4Scheduled = schProcessMsg4Req(cell, *slotInd, ueId); + } + + if(isRarPending || isMsg4Pending) + { + /* If RAR or MSG is successfully scheduled then + * remove UE from linked list since no pending msgs for this UE */ + if(isRarScheduled || isMsg4Scheduled) + { + SCH_FREE(pendingUeNode->node, sizeof(uint8_t)); + deleteNodeFromLList(&cell->ueToBeScheduled, pendingUeNode); + } + /* If RAR/MSG4 is pending but couldnt be scheduled then, + * put this UE at the end of linked list to be scheduled later */ + else + { + cmLListAdd2Tail(&cell->ueToBeScheduled, cmLListDelFrm(&cell->ueToBeScheduled, pendingUeNode)); + } + } + + if(cell->ueCb[ueId-1].srRcvd || cell->ueCb[ueId-1].bsrRcvd) + { + isUlGrantPending = true; + isUlGrantScheduled = schProcessSrOrBsrReq(cell, *slotInd, ueId); + } + + if((cell->boIndBitMap) & (1<ueToBeScheduled, cmLListDelFrm(&cell->ueToBeScheduled, pendingUeNode)); } - } - - if((cell->boIndBitMap) & (1<node, sizeof(uint8_t)); - deleteNodeFromLList(&cell->ueToBeScheduled, pendingUeNode); - } + else + { + SCH_FREE(pendingUeNode->node, sizeof(uint8_t)); + deleteNodeFromLList(&cell->ueToBeScheduled, pendingUeNode); + } } } @@ -711,7 +730,7 @@ uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst) dlSchedInfo.rarAlloc[ueIdx] = cell->schDlSlotInfo[slot]->rarAlloc[ueIdx]; cell->schDlSlotInfo[slot]->rarAlloc[ueIdx] = NULLP; } - + /* If DL-Msg PDCCH/PDSCH is scheduled for a UE at this slot, fill * specific interface structure to send to MAC */ if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dlMsgAlloc[ueIdx] != NULLP) @@ -723,50 +742,11 @@ uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst) } - /* Check if UL grant must be sent in this slot for a SR/BSR that had been received */ - for(ueIdx=0; ueIdxnumActvUe; ueIdx++) + if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.ulDciTime.slot]->ulGrant != NULLP) { - uint32_t totDataReq = 0; /* in bytes */ - DciInfo *dciInfo = NULLP; - SchUeCb *ueCb = NULLP; - - ueCb = &cell->ueCb[ueIdx]; - /* check for SR */ - if(ueCb->srRcvd) - { - totDataReq = UL_GRANT_SIZE; /*fixing so that all control msgs can be handled in SR */ - ueCb->srRcvd = false; - } - /* check for BSR */ - for(lcgIdx=0; lcgIdxbsrInfo[lcgIdx].dataVol; - ueCb->bsrInfo[lcgIdx].dataVol = 0; - } - if(totDataReq > 0) /* UL grant must be provided for this UE in this slot */ - { - SchPuschInfo schPuschInfo; - memset(&schPuschInfo, 0, sizeof(SchPuschInfo)); - - SCH_ALLOC(dciInfo, sizeof(DciInfo)); - if(!dciInfo) - { - DU_LOG("\nERROR --> SCH : Memory Allocation failed for dciInfo alloc"); - return RFAILED; - } - memset(dciInfo,0,sizeof(DciInfo)); - - /* update the SFN and SLOT */ - memcpy(&dlSchedInfo.schSlotValue.ulDciTime, slotInd, sizeof(SlotTimingInfo)); - - /* Update PUSCH allocation */ - schFillPuschAlloc(ueCb, dlSchedInfo.schSlotValue.ulDciTime, totDataReq, &schPuschInfo); - - /* Fill DCI for UL grant */ - schFillUlDci(ueCb, schPuschInfo, dciInfo); - memcpy(&dciInfo->slotIndInfo, &dlSchedInfo.schSlotValue.ulDciTime, sizeof(SlotTimingInfo)); - dlSchedInfo.ulGrant = dciInfo; - } + slot = dlSchedInfo.schSlotValue.ulDciTime.slot; + dlSchedInfo.ulGrant = cell->schDlSlotInfo[slot]->ulGrant; + cell->schDlSlotInfo[slot]->ulGrant = NULLP; } /* Send msg to MAC */