X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrsch%2Fsch_common.c;h=4869129ab04ae6616cfe8d95a171a40f80f42733;hb=2413e14540477c9cf427915adf9342b45f9958b2;hp=75422c362524b5497518f16398355fee9d3ded2c;hpb=12da8be0c4941e107b9ff0d18ce5b6eb7f5f7d20;p=o-du%2Fl2.git diff --git a/src/5gnrsch/sch_common.c b/src/5gnrsch/sch_common.c index 75422c362..4869129ab 100644 --- a/src/5gnrsch/sch_common.c +++ b/src/5gnrsch/sch_common.c @@ -41,6 +41,7 @@ File: sch_common.c #include "du_app_mac_inf.h" #include "mac_sch_interface.h" #include "sch.h" +#include "sch_tmr.h" #include "sch_utils.h" /** @@ -225,7 +226,7 @@ void fillPucchFormat0(SchPucchInfo *ulSchedPucch, SchPucchResrcInfo *resrcInfo) { if(resrcInfo->SchPucchFormat.format0) { - ulSchedPucch->fdAlloc.resAlloc.type1.numPrb = PUCCH_NUM_PRB_FORMAT_0_1_4; + ulSchedPucch->fdAlloc.numPrb = PUCCH_NUM_PRB_FORMAT_0_1_4; ulSchedPucch->pucchFormat = PUCCH_FORMAT_0; ulSchedPucch->initialCyclicShift = resrcInfo->SchPucchFormat.format0->initialCyclicShift; ulSchedPucch->tdAlloc.numSymb = resrcInfo->SchPucchFormat.format0->numSymbols; @@ -250,7 +251,7 @@ void fillPucchFormat1(SchPucchInfo *ulSchedPucch, SchPucchResrcInfo *resrcInfo) { if(resrcInfo->SchPucchFormat.format1) { - ulSchedPucch->fdAlloc.resAlloc.type1.numPrb = PUCCH_NUM_PRB_FORMAT_0_1_4; + ulSchedPucch->fdAlloc.numPrb = PUCCH_NUM_PRB_FORMAT_0_1_4; ulSchedPucch->pucchFormat = PUCCH_FORMAT_1; ulSchedPucch->initialCyclicShift = resrcInfo->SchPucchFormat.format1->initialCyclicShift; ulSchedPucch->tdAlloc.numSymb = resrcInfo->SchPucchFormat.format1->numSymbols; @@ -343,7 +344,7 @@ uint8_t fillUlSchedPucchDedicatedCfg(SchCellCb *cell, SchPucchCfg *pucchDedCfg,\ { ulSchedPucch->intraFreqHop = pucchDedCfg->resrc->resrcToAddModList[resrcIdx].intraFreqHop; ulSchedPucch->secondPrbHop = pucchDedCfg->resrc->resrcToAddModList[resrcIdx].secondPrbHop; - ulSchedPucch->fdAlloc.resAlloc.type1.startPrb = pucchDedCfg->resrc->resrcToAddModList[resrcIdx].startPrb; + ulSchedPucch->fdAlloc.startPrb = pucchDedCfg->resrc->resrcToAddModList[resrcIdx].startPrb; ulSchedPucch->pucchFormat = pucchDedCfg->resrc->resrcToAddModList[resrcIdx].pucchFormat; ret = fillUlSchedPucchFormat(ulSchedPucch->pucchFormat, ulSchedPucch,\ &pucchDedCfg->resrc->resrcToAddModList[resrcIdx], NULLP); @@ -450,8 +451,8 @@ uint16_t fillPucchResourceInfo(uint8_t ueId, SchPucchInfo *schPucchInfo, Inst in &startPrb, PUCCH_NUM_PRB_FORMAT_0_1_4); if (ret == ROK) { - schPucchInfo->fdAlloc.resAlloc.type1.startPrb = ulBwp->freqAlloc.startPrb + pucchResourceSet[pucchIdx][3]; - schPucchInfo->fdAlloc.resAlloc.type1.numPrb = PUCCH_NUM_PRB_FORMAT_0_1_4; + schPucchInfo->fdAlloc.startPrb = ulBwp->freqAlloc.startPrb + pucchResourceSet[pucchIdx][3]; + schPucchInfo->fdAlloc.numPrb = PUCCH_NUM_PRB_FORMAT_0_1_4; schPucchInfo->tdAlloc.startSymb = pucchResourceSet[pucchIdx][1]; schPucchInfo->tdAlloc.numSymb = pucchResourceSet[pucchIdx][2]; schPucchInfo->pucchFormat = pucchResourceSet[pucchIdx][0]; @@ -484,6 +485,9 @@ uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst) UlSchedInfo ulSchedInfo; SchUlSlotInfo *schUlSlotInfo = NULLP; SlotTimingInfo ulTimingInfo; + CmLList *node = NULLP; + TotalPrbUsage *ulTotalPrbUsage = NULLP; + memset(&ulSchedInfo, 0, sizeof(UlSchedInfo)); /* add PHY delta */ @@ -535,13 +539,24 @@ uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst) memset(&schUlSlotInfo->schPucchInfo, 0, sizeof(SchPucchInfo)); } - //send msg to MAC + /* Send msg to MAC */ ret = sendUlSchInfoToMac(&ulSchedInfo, schInst); if(ret != ROK) { DU_LOG("\nERROR --> SCH : Sending UL Sch info from SCH to MAC failed"); } + /* Update DL PRB Usage for all stats group which requested for DL Total PRB Usage */ + node = cmLListFirst(&schCb[schInst].statistics.activeKpiList.ulTotPrbUseList); + while(node) + { + ulTotalPrbUsage = (TotalPrbUsage *)node->node; + ulTotalPrbUsage->numPrbUsedForTx += schUlSlotInfo->prbAlloc.numPrbAlloc; + ulTotalPrbUsage->totalPrbAvailForTx += MAX_NUM_RB; + node = node->next; + } + + /* Re-initialize UL Slot */ schInitUlSlot(schUlSlotInfo); return ret; } @@ -804,12 +819,13 @@ uint8_t schDlRsrcAllocDlMsg(SchCellCb *cell, SlotTimingInfo slotTime, uint16_t c uint8_t pdschNumSymbols, bool isRetx, SchDlHqProcCb *hqP) { uint8_t ueId=0; - uint8_t cwCount = 0; + uint8_t cwCount = 0, rbgCount = 0, pdcchStartSymbol = 0; PdcchCfg *pdcch = NULLP; PdschCfg *pdsch = NULLP; BwpCfg *bwp = NULLP; SchUeCb ueCb; SchControlRsrcSet coreset1; + SchSearchSpace searchSpace; SchPdschConfig pdschCfg; uint8_t dmrsStartSymbol, startSymbol, numSymbol; @@ -825,6 +841,7 @@ uint8_t schDlRsrcAllocDlMsg(SchCellCb *cell, SlotTimingInfo slotTime, uint16_t c GET_UE_ID(crnti, ueId); ueCb = cell->ueCb[ueId-1]; coreset1 = ueCb.ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0]; + searchSpace = ueCb.ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.searchSpcToAddModList[0]; pdschCfg = ueCb.ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg; /* fill BWP */ @@ -834,22 +851,44 @@ uint8_t schDlRsrcAllocDlMsg(SchCellCb *cell, SlotTimingInfo slotTime, uint16_t c bwp->cyclicPrefix = cell->sib1SchCfg.bwp.cyclicPrefix; /* fill the PDCCH PDU */ - //Considering coreset1 also starts from same symbol as coreset0 - pdcch->coresetCfg.startSymbolIndex = coresetIdxTable[0][3]; + /*StartSymbol of PDCCH*/ + pdcchStartSymbol = findSsStartSymbol(searchSpace.mSymbolsWithinSlot); + if(pdcchStartSymbol < MAX_SYMB_PER_SLOT) + pdcch->coresetCfg.startSymbolIndex = pdcchStartSymbol; + else + { + DU_LOG("\nERROR --> SCH : Invalid SymbolIndex in schDlRsrcAllocDlMsg"); + return RFAILED; + } pdcch->coresetCfg.durationSymbols = coreset1.duration; memcpy(pdcch->coresetCfg.freqDomainResource, coreset1.freqDomainRsrc, FREQ_DOM_RSRC_SIZE); pdcch->coresetCfg.cceRegMappingType = coreset1.cceRegMappingType; /* non-interleaved */ pdcch->coresetCfg.regBundleSize = 6; /* must be 6 for non-interleaved */ pdcch->coresetCfg.interleaverSize = 0; /* NA for non-interleaved */ pdcch->coresetCfg.coreSetType = 1; /* non PBCH coreset */ - //Considering number of RBs in coreset1 is same as coreset0 - pdcch->coresetCfg.coreSetSize = coresetIdxTable[0][1]; + + /*Size of coreset: Number of PRBs in a coreset*/ + rbgCount = countRBGFrmCoresetFreqRsrc(coreset1.freqDomainRsrc); + if(rbgCount) + { + pdcch->coresetCfg.coreSetSize = ((rbgCount) * NUM_PRBS_PER_RBG); + } + else + { + DU_LOG("\nERROR --> SCH : CORESETSize is zero in schDlRsrcAllocDlMsg"); + return RFAILED; + } + pdcch->coresetCfg.shiftIndex = cell->cellCfg.phyCellId; pdcch->coresetCfg.precoderGranularity = coreset1.precoderGranularity; pdcch->numDlDci = 1; pdcch->dci.rnti = ueCb.crnti; pdcch->dci.scramblingId = cell->cellCfg.phyCellId; pdcch->dci.scramblingRnti = 0; + + /*TODO below assumptions of CCE Index is wrong: + * Range 0 to 135 as per ORAN.WG8.AAD Table 9-35 CORESET configuration and + * it has to be calculated using the formula given in 3GPP TS 38.213, Sec 10.1 */ pdcch->dci.cceIndex = 0; /* 0-3 for UL and 4-7 for DL */ pdcch->dci.aggregLevel = 4; pdcch->dci.beamPdcchInfo.numPrgs = 1; @@ -1092,7 +1131,7 @@ SchPdschConfig pdschDedCfg, uint8_t ulAckListCount, uint8_t *UlAckTbl) /* Initialization the K0K1 structure, total num of slot and calculating the slot pattern length. */ memset(k0K1InfoTbl, 0, sizeof(SchK0K1TimingInfoTbl)); k0K1InfoTbl->tblSize = cell->numSlots; - totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod); + totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.ssbScs, cell->cellCfg.tddCfg.tddPeriod); /* Storing time domain resource allocation list based on common or * dedicated configuration availability. */ @@ -1322,7 +1361,7 @@ SchK2TimingInfoTbl *msg3K2InfoTbl, SchK2TimingInfoTbl *k2InfoTbl) k2InfoTbl->tblSize = cell->numSlots; if(msg3K2InfoTbl) msg3K2InfoTbl->tblSize = cell->numSlots; - totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod); + totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.ssbScs, cell->cellCfg.tddCfg.tddPeriod); /* Checking all possible indexes for K2. */ for(slotIdx = 0; slotIdx < cell->numSlots; slotIdx++) @@ -1340,7 +1379,7 @@ SchK2TimingInfoTbl *msg3K2InfoTbl, SchK2TimingInfoTbl *k2InfoTbl) k2Val = timeDomRsrcAllocList[k2Index].k2; if(!k2Val) { - switch(cell->cellCfg.scsCommon) + switch(cell->cellCfg.ssbScs) { case SCS_15KHZ: k2Val = DEFAULT_K2_VALUE_FOR_SCS15; @@ -1390,7 +1429,7 @@ SchK2TimingInfoTbl *msg3K2InfoTbl, SchK2TimingInfoTbl *k2InfoTbl) if(msg3K2InfoTbl) { - msg3Delta = puschDeltaTable[cell->cellCfg.numerology]; + msg3Delta = puschDeltaTable[cell->numerology]; /* Check for K2 for MSG3 */ /* Current slot + k2 should be either UL or FLEXI slot. @@ -1514,7 +1553,7 @@ void prbAllocUsingRRMPolicy(CmLListCp *lcLL, bool isDedicatedPRB, uint16_t mcsId /*[Exit1]: All LCs are allocated(allocBO = 0 for fully unallocated LC)*/ if(lcNode->allocBO != 0) { - DU_LOG("\nDEBUG --> SCH: All LC are allocated [SharedPRB:%d]",*sharedPRB); + DU_LOG("\nDEBUG --> SCH: All LC are allocated [SharedPRB:%d]",*sharedPRB); return; } @@ -1533,7 +1572,7 @@ void prbAllocUsingRRMPolicy(CmLListCp *lcLL, bool isDedicatedPRB, uint16_t mcsId /*Loop Exit: All resources exhausted*/ if(*sharedPRB == 0) { - DU_LOG("\nDEBUG --> SCH: Default resources exhausted for LC:%d",lcNode->lcId); + DU_LOG("\nDEBUG --> SCH: Default resources exhausted for LC:%d",lcNode->lcId); return; } } @@ -1544,7 +1583,7 @@ void prbAllocUsingRRMPolicy(CmLListCp *lcLL, bool isDedicatedPRB, uint16_t mcsId /*[Step4]*/ if((isTxPayloadLenAdded != NULLP) && (*isTxPayloadLenAdded == FALSE)) { - DU_LOG("\nDEBUG --> SCH: LC:%d is the First node to be allocated which includes TX_PAYLOAD_HDR_LEN",\ + DU_LOG("\nDEBUG --> SCH: LC:%d is the First node to be allocated which includes TX_PAYLOAD_HDR_LEN",\ lcNode->lcId); *isTxPayloadLenAdded = TRUE; lcNode->allocBO = calculateEstimateTBSize((lcNode->reqBO + TX_PAYLOAD_HDR_LEN),\ @@ -1576,7 +1615,7 @@ void prbAllocUsingRRMPolicy(CmLListCp *lcLL, bool isDedicatedPRB, uint16_t mcsId { if(*sharedPRB <= (estPrb - remReservedPRB)) { - DU_LOG("\nDEBUG --> SCH: SharedPRB is less"); + DU_LOG("\nDEBUG --> SCH: SharedPRB is less"); *sharedPRB = 0; } else @@ -1648,7 +1687,7 @@ void updateGrantSizeForBoRpt(CmLListCp *lcLL, DlMsgSchInfo *dlMsgAlloc,\ lcNode = (LcInfo *)node->node; if(lcNode != NULLP) { - DU_LOG("\nINFO --> SCH : LcID:%d, [reqBO, allocBO, allocPRB]:[%d,%d,%d]",\ + DU_LOG("\nINFO --> SCH : LcID:%d, [reqBO, allocBO, allocPRB]:[%d,%d,%d]",\ lcNode->lcId, lcNode->reqBO, lcNode->allocBO, lcNode->allocPRB); if(dlMsgAlloc != NULLP) { @@ -1662,7 +1701,7 @@ void updateGrantSizeForBoRpt(CmLListCp *lcLL, DlMsgSchInfo *dlMsgAlloc,\ /*Calculate the Total Payload/BO size allocated*/ *accumalatedBOSize += dlMsgAlloc->transportBlock[0].lcSchInfo[dlMsgAlloc->transportBlock[0].numLc].schBytes; - DU_LOG("\nINFO --> SCH: Added in MAC BO report: LCID:%d,reqBO:%d,Idx:%d, TotalBO Size:%d",\ + DU_LOG("\nINFO --> SCH: Added in MAC BO report: LCID:%d,reqBO:%d,Idx:%d, TotalBO Size:%d",\ lcNode->lcId,lcNode->reqBO, dlMsgAlloc->transportBlock[0].numLc, *accumalatedBOSize); dlMsgAlloc->transportBlock[0].numLc++; @@ -1691,12 +1730,12 @@ void updateGrantSizeForBoRpt(CmLListCp *lcLL, DlMsgSchInfo *dlMsgAlloc,\ * Functionality: * fill DL message information for MSG4 and Dedicated DL Msg * -* @params[in] DlMsgInfo *dlMsgInfo, uint8_t crnti +* @params[in] DlMsgInfo *dlMsgInfo, uint16_t crnti * @params[in] bool isRetx, SchDlHqProcCb *hqP * @return void * *******************************************************************/ -void fillDlMsgInfo(DlMsgSchInfo *dlMsgSchInfo, uint8_t crnti, bool isRetx, SchDlHqProcCb *hqP) +void fillDlMsgInfo(DlMsgSchInfo *dlMsgSchInfo, uint16_t crnti, bool isRetx, SchDlHqProcCb *hqP) { hqP->tbInfo[0].isEnabled = TRUE; hqP->tbInfo[0].state = HQ_TB_WAITING; @@ -1983,8 +2022,8 @@ bool schProcessSrOrBsrReq(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId if(schGetSlotSymbFrmt(dciTime.slot, cell->slotFrmtBitMap) == DL_SLOT) #endif { - if(ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.k2TblPrsnt) - k2InfoTbl = &ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.k2InfoTbl; + if(ueCb->k2TblPrsnt) + k2InfoTbl = &ueCb->k2InfoTbl; else k2InfoTbl = &cell->k2InfoTbl; @@ -1992,7 +2031,7 @@ bool schProcessSrOrBsrReq(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId { k2Index = k2InfoTbl->k2TimingInfo[dciTime.slot].k2Indexes[k2TblIdx]; - if(!ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.k2TblPrsnt) + if(!ueCb->k2TblPrsnt) { k2Val = cell->cellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2; startSymb = cell->cellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].startSymbol; @@ -2031,7 +2070,7 @@ bool schProcessSrOrBsrReq(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId } else { - DU_LOG("\nERROR --> SCH : schProcessSrOrBsrReq(): K2 value is not found"); + DU_LOG("\nDEBUG --> SCH : schProcessSrOrBsrReq(): K2 value is not found"); return false; } return true; @@ -2225,7 +2264,7 @@ bool schGetMsg3K2(SchCellCb *cell, SchUlHqProcCb* msg3HqProc, uint16_t dlTime, S SchK2TimingInfoTbl *msg3K2InfoTbl=NULLP; SlotTimingInfo currTime, msg3TempTime; currTime = cell->slotInfo; - puschMu = cell->cellCfg.numerology; + puschMu = cell->numerology; if (isRetx) { @@ -2241,7 +2280,7 @@ bool schGetMsg3K2(SchCellCb *cell, SchUlHqProcCb* msg3HqProc, uint16_t dlTime, S { numK2 = cell->msg3K2InfoTbl.k2TimingInfo[dlTime].numK2; msg3K2InfoTbl = &cell->k2InfoTbl; - msg3MinSchTime = minMsg3SchTime[cell->cellCfg.numerology]; + msg3MinSchTime = minMsg3SchTime[cell->numerology]; msg3Delta = puschDeltaTable[puschMu]; }