X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2F5gnrsch%2Fsch_slot_ind.c;h=06826958ce21a34db533910fe77ff2195d25f0de;hb=aee73991f728cc127d1ed76d5a52571d916235a4;hp=5ad429c505660ed42ff679e62e005f944f06971a;hpb=a5530e70a9d414952dadd1688aa9b4280c0dbb5a;p=o-du%2Fl2.git diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 5ad429c50..06826958c 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -69,7 +69,7 @@ extern int schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t * RFAILED - failure * * ****************************************************************/ -int sendDlAllocToMac(DlSchedInfo *dlSchedInfo, Inst inst) +uint8_t sendDlAllocToMac(DlSchedInfo *dlSchedInfo, Inst inst) { Pst pst; @@ -139,13 +139,13 @@ void schCalcSlotValues(SlotIndInfo slotInd, SchSlotValue *schSlotValue) uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) { int ret = ROK; - uint8_t ssb_rep; + uint8_t ssb_rep, ueIdx, lcgIdx; uint16_t slot, sfnSlot = 0; DlSchedInfo dlSchedInfo; memset(&dlSchedInfo,0,sizeof(DlSchedInfo)); DlBrdcstAlloc *dlBrdcstAlloc = &dlSchedInfo.brdcstAlloc; - RarAlloc *rarAlloc; - Msg4Alloc *msg4Alloc; + RarAlloc *rarAlloc = NULLP; + Msg4Alloc *msg4Alloc = NULLP; dlBrdcstAlloc->ssbTrans = NO_SSB; dlBrdcstAlloc->sib1Trans = NO_SIB1; @@ -200,7 +200,7 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) if(ret != ROK) { DU_LOG("\nschBroadcastAlloc failed"); - RETVALUE(ret); + return (ret); } } @@ -256,19 +256,61 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info, sizeof(Msg4Info)); cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info = NULL; } - + /* 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 */ + 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("\nMAC: Memory Allocation failed for dciInfo alloc"); + return RFAILED; + } + memset(dciInfo,0,sizeof(DciInfo)); + /* update the SFN and SLOT */ + memcpy(&dlSchedInfo.schSlotValue.ulDciTime, slotInd, sizeof(SlotIndInfo)); + slot = dlSchedInfo.schSlotValue.ulDciTime.slot; + /* Update PUSCH allocation */ + schFillPuschAlloc(ueCb, slot, totDataReq, &schPuschInfo); + /* Fill DCI for UL grant */ + schFillUlDci(ueCb, schPuschInfo, dciInfo); + memcpy(&dciInfo->slotIndInfo, &dlSchedInfo.schSlotValue.ulDciTime, sizeof(SlotIndInfo)); + dlSchedInfo.ulGrant = dciInfo; + } + } /* send msg to MAC */ ret = sendDlAllocToMac(&dlSchedInfo, schInst); if(ret != ROK) { DU_LOG("\nSending DL Broadcast allocation from SCH to MAC failed"); - RETVALUE(ret); + return (ret); } + schInitDlSlot(cell->schDlSlotInfo[slot]); schUlResAlloc(cell, schInst); - memset(cell->schDlSlotInfo[slot], 0, sizeof(SchDlSlotInfo)); return ret; }