X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrsch%2Fsch_slot_ind.c;h=97ea00a7dac21e1352eeed852a48c11b3566a60f;hb=9edb21c45713c87a3434d4511ef7c340de8567ea;hp=3542bd0181ffc4f0bdc9dd496ac9bda5e5c6363e;hpb=7fb274708be5434e1573315b106c554d5562ac42;p=o-du%2Fl2.git diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 3542bd018..97ea00a7d 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -132,7 +132,7 @@ void schCalcSlotValues(SlotTimingInfo slotInd, SchSlotValue *schSlotValue) * @return Pdu transmission * * ****************************************************************/ -PduTxOccsaion schCheckSsbOcc(SlotTimingInfo slotTime, SchCellCb *cell) +PduTxOccsaion schCheckSsbOcc(SchCellCb *cell, SlotTimingInfo slotTime) { uint8_t ssb_rep; @@ -170,7 +170,7 @@ PduTxOccsaion schCheckSsbOcc(SlotTimingInfo slotTime, SchCellCb *cell) * @return Pdu transmission * * ****************************************************************/ -PduTxOccsaion schCheckSib1Occ(SlotTimingInfo slotTime, SchCellCb *cell) +PduTxOccsaion schCheckSib1Occ(SchCellCb *cell, SlotTimingInfo slotTime) { /* Identify SIB1 occasions */ if((slotTime.sfn % SCH_SIB1_TRANS == 0) && (slotTime.slot ==0)) @@ -255,27 +255,37 @@ uint8_t schFillBoGrantDlSchedInfo(SchCellCb *cell, DlSchedInfo *dlSchedInfo, DlM if (!dlMsgAlloc->numLc) { - DU_LOG("\nDEBUG --> SCH : No bo for any lcid\n"); + DU_LOG("\nDEBUG --> SCH : No pending BO for any LC id\n"); + /* Free the dl ded msg info allocated in macSchDlRlcBoInfo */ + SCH_FREE(dlMsgAlloc, sizeof(DlMsgAlloc)); + dlSchedInfo->dlMsgAlloc = NULLP; return ROK; } /* pdcch and pdsch data is filled */ - schDlRsrcAllocDlMsg(dlMsgAlloc, cell, crnti, &accumalatedSize, slot); - /* Calculated TB size could be less than the total size requested. - * Hence, updated the scheduled bytes report. Following is valid only for - * one LC. - * TODO : Update the scheduling byte report for multiple LC based on QCI + if((schDlRsrcAllocDlMsg(cell, dlSchedInfo->schSlotValue.dlMsgTime, crnti, &accumalatedSize, dlMsgAlloc)) != ROK) + { + DU_LOG("\nERROR --> SCH : Scheduling of DL dedicated message failed"); + /* Free the dl ded msg info allocated in macSchDlRlcBoInfo */ + SCH_FREE(dlMsgAlloc, sizeof(DlMsgAlloc)); + dlSchedInfo->dlMsgAlloc = NULLP; + return RFAILED; + + } + + /* TODO : Update the scheduling byte report for multiple LC based on QCI * and Priority */ - dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc -1].schBytes = accumalatedSize; + /* As of now, the total number of bytes scheduled for a slot is divided + * equally amongst all LC with pending data. This is avoid starving of any + * LC + * */ + accumalatedSize = accumalatedSize/dlMsgAlloc->numLc; + for(lcIdx = 0; lcIdx < dlMsgAlloc->numLc; lcIdx ++) + dlMsgAlloc->lcSchInfo[lcIdx].schBytes = accumalatedSize; /* PUCCH resource */ schAllocPucchResource(cell, dlMsgAlloc->crnti, slot); - /* Free the dl ded msg info allocated in macSchDlRlcBoInfo */ - SCH_FREE(cell->schDlSlotInfo[dlSchedInfo->schSlotValue.dlMsgTime.slot]->dlMsgInfo, \ - sizeof(DlMsgInfo)); - cell->schDlSlotInfo[dlSchedInfo->schSlotValue.dlMsgTime.slot]->dlMsgInfo = NULL; - /* after allocation is done, unset the bo bit for that ue */ UNSET_ONE_BIT(ueIdx, cell->boIndBitMap); } @@ -325,36 +335,48 @@ uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst) memcpy(&cell->slotInfo, slotInd, sizeof(SlotTimingInfo)); dlBrdcstAlloc->ssbIdxSupported = SSB_IDX_SUPPORTED; - slot = dlSchedInfo.schSlotValue.currentTime.slot; - dlSchedInfo.cellId = cell->cellId; - /* Check if this slot is SSB occassion */ - dlBrdcstAlloc->ssbTrans = schCheckSsbOcc(dlSchedInfo.schSlotValue.broadcastTime, cell); - if((dlBrdcstAlloc->ssbTrans == NEW_TRANSMISSION) && (!cell->firstSsbTransmitted)) - cell->firstSsbTransmitted = true; + slot = dlSchedInfo.schSlotValue.broadcastTime.slot; - /* Check if this slot is SIB1 occassion */ - dlBrdcstAlloc->sib1Trans = schCheckSib1Occ(dlSchedInfo.schSlotValue.broadcastTime, cell); - if((dlBrdcstAlloc->sib1Trans == NEW_TRANSMISSION) && (!cell->firstSib1Transmitted)) - cell->firstSib1Transmitted = true; + /* Check for SSB occassion */ + dlBrdcstAlloc->ssbTrans = schCheckSsbOcc(cell, dlSchedInfo.schSlotValue.broadcastTime); + if(dlBrdcstAlloc->ssbTrans) + { + if(schBroadcastSsbAlloc(cell, dlSchedInfo.schSlotValue.broadcastTime, dlBrdcstAlloc) != ROK) + { + DU_LOG("\nERROR --> SCH : schBroadcastSsbAlloc failed"); + dlBrdcstAlloc->ssbTrans = NO_TRANSMISSION; + } + else + { + dlSchedInfo.isBroadcastPres = true; + if((dlBrdcstAlloc->ssbTrans == NEW_TRANSMISSION) && (!cell->firstSsbTransmitted)) + cell->firstSsbTransmitted = true; + } + } - if(dlBrdcstAlloc->ssbTrans || dlBrdcstAlloc->sib1Trans) + /* Check for SIB1 occassion */ + dlBrdcstAlloc->sib1Trans = schCheckSib1Occ(cell, dlSchedInfo.schSlotValue.broadcastTime); + if(dlBrdcstAlloc->sib1Trans) { - dlSchedInfo.isBroadcastPres = true; - slot = dlSchedInfo.schSlotValue.broadcastTime.slot; - ret = schBroadcastAlloc(cell,dlBrdcstAlloc,slot); - if(ret != ROK) + if(schBroadcastSib1Alloc(cell, dlSchedInfo.schSlotValue.broadcastTime, dlBrdcstAlloc) != ROK) + { + DU_LOG("\nERROR --> SCH : schBroadcastSib1Alloc failed"); + dlBrdcstAlloc->sib1Trans = NO_TRANSMISSION; + } + else { - DU_LOG("\nERROR --> SCH : schBroadcastAlloc failed"); - return ret; + dlSchedInfo.isBroadcastPres = true; + if((dlBrdcstAlloc->sib1Trans == NEW_TRANSMISSION) && (!cell->firstSib1Transmitted)) + cell->firstSib1Transmitted = true; } } /* Check for Pending RA Requests */ schProcessRaReq(*slotInd, cell); - /* check for RAR */ + /* Check for RAR */ if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarAlloc != NULLP) { slot = dlSchedInfo.schSlotValue.rarTime.slot; @@ -362,7 +384,7 @@ uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst) cell->schDlSlotInfo[slot]->rarAlloc = NULLP; } - /* check for MSG4 */ + /* Check for MSG4 */ if((cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dlMsgInfo != NULLP) && (cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dlMsgInfo->isMsg4Pdu)) { @@ -382,16 +404,22 @@ uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst) sizeof(DlMsgInfo)); /* pdcch and pdsch data is filled */ - schDlRsrcAllocMsg4(msg4Alloc, cell, dlSchedInfo.schSlotValue.dlMsgTime.slot, dlBrdcstAlloc->ssbTrans, dlBrdcstAlloc->sib1Trans); + if((schDlRsrcAllocMsg4(cell, dlSchedInfo.schSlotValue.dlMsgTime, msg4Alloc)) != ROK) + { + DU_LOG("\nERROR --> SCH : MSG4 scheduling failed"); + SCH_FREE(msg4Alloc, sizeof(DlMsgAlloc)); + dlSchedInfo.dlMsgAlloc = NULLP; + SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dlMsgInfo, sizeof(DlMsgInfo)); + return RFAILED; + } /* PUCCH resource */ schAllocPucchResource(cell, msg4Alloc->dlMsgInfo.crnti, dlSchedInfo.schSlotValue.dlMsgTime.slot); SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dlMsgInfo, sizeof(DlMsgInfo)); - cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dlMsgInfo = NULL; } - /* check if UL grant must be sent in this slot for a SR/BSR that had been received */ + /* Check if UL grant must be sent in this slot for a SR/BSR that had been received */ for(ueIdx=0; ueIdxnumActvUe; ueIdx++) { uint32_t totDataReq = 0; /* in bytes */ @@ -439,10 +467,18 @@ uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst) if((cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dlMsgInfo != NULLP) && (!cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dlMsgInfo->isMsg4Pdu)) { - schFillBoGrantDlSchedInfo(cell, &dlSchedInfo, dlMsgAlloc); + if((schFillBoGrantDlSchedInfo(cell, &dlSchedInfo, dlMsgAlloc)) != ROK) + { + DU_LOG("\nERROR --> SCH : DL MSG scheduling failed"); + SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dlMsgInfo, sizeof(DlMsgInfo)); + return RFAILED; + } + + /* Free the dl ded msg info allocated in macSchDlRlcBoInfo */ + SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dlMsgInfo, sizeof(DlMsgInfo)); } - /* send msg to MAC */ + /* Send msg to MAC */ ret = sendDlAllocToMac(&dlSchedInfo, schInst); if(ret != ROK) {