[Epic-ID: ODUHIGH-556][Task-ID: ODUHIGH-559]Correction in PUCCH allocation
[o-du/l2.git] / src / 5gnrsch / sch_slot_ind.c
index 0e2c7f1..8b423b2 100644 (file)
@@ -242,9 +242,6 @@ bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t
       }
    }
 
-   schAllocPucchResource(cell, pucchTime, crnti, ueCb, isRetx, *hqP);
-
-   cell->schDlSlotInfo[pdschTime.slot]->pdschUe = ueId;
    cell->schUlSlotInfo[pucchTime.slot]->pucchUe = ueId;
 
    /*Re-setting the BO's of all DL LCs in this UE*/
@@ -423,6 +420,7 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId,
 {
    uint8_t numK0 = 0, k0TblIdx = 0, k0Val = 0, k0Index =0 ;
    uint8_t k1TblIdx = 0, k1Index = 0, k1Val = 0, numK1 = 0;
+   uint8_t ret = RFAILED;
    SchUeCb *ueCb = NULLP;
    SchK0K1TimingInfoTbl *k0K1InfoTbl;
 
@@ -435,14 +433,14 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId,
    }
 #endif
 
+   ueCb = &cell->ueCb[ueId-1];
    if(dedMsg == true)
    {
-      ueCb = &cell->ueCb[ueId-1];
       k0K1InfoTbl = &ueCb->k0K1InfoTbl;
       if(schDlCandidateSelection(ueCb, *pdcchTime, pdcchAllocInfo) == false)
       {
-        DU_LOG("\nDEBUG  --> SCH: DL candidate Selection failed bcz PDCCH is unavailable for this slot");
-        return false;     
+         DU_LOG("\nDEBUG  --> SCH: DL candidate Selection failed bcz PDCCH is unavailable for this slot");
+         return false;     
       }
    }
    else
@@ -483,10 +481,6 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId,
          continue;
       }
 #endif
-      if(cell->schDlSlotInfo[pdschTime->slot]->pdschUe != 0)
-      {
-         continue; 
-      }
 
       numK1 = k0K1InfoTbl->k0k1TimingInfo[pdcchTime->slot].k0Indexes[k0TblIdx].k1TimingInfo.numK1;
       for(k1TblIdx = 0; k1TblIdx < numK1; k1TblIdx++)
@@ -525,9 +519,20 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId,
          pdcchTime->cellId = cell->cellId;
          pdschTime->cellId = cell->cellId;
 
+         cell->schUlSlotInfo[pucchTime->slot]->pucchUe = ueId;
+
+         /*Availability of PUCCH for HARQ resources*/
+         ret = schAllocPucchResource(cell, *pucchTime, ueCb, hqP, pdcchAllocInfo);
+         if(ret == RFAILED)
+         {
+            /*DL allocation can't go through as PUCCH is unavailable*/
+            return false;
+         }
          return true;
       }
    }
+
+
    /*
     * Number of symbols in case of retransmisson should be same as it was in
     * original transmisson. Symbol availablity checks need to be added.