[Epic-ID: ODUHIGH-406][Task-ID: ODUHIGH-423]Fix for incorrect access of schCb instance
[o-du/l2.git] / src / 5gnrsch / sch_rach.c
index 050752c..28517e8 100644 (file)
@@ -109,7 +109,7 @@ bool schCheckPrachOcc(SchCellCb *cell, SlotTimingInfo prachOccasionTimingInfo)
 uint8_t schCalcPrachNumRb(SchCellCb *cell)
 {
    uint8_t tableIdx = 0;
-   uint16_t puschScs = fetchScsValue(cell->cellCfg.schInitialUlBwp.bwp.scs);
+   uint16_t puschScs = convertScsEnumValToScsVal(cell->cellCfg.schInitialUlBwp.bwp.scs);
 
    for(tableIdx=0; tableIdx < MAX_RACH_NUM_RB_IDX; tableIdx++)
    {
@@ -148,6 +148,12 @@ void schPrachResAlloc(SchCellCb *cell, UlSchedInfo *ulSchedInfo, SlotTimingInfo
    uint8_t  dataType = 0;
    uint16_t freqStart = 0;
 
+   if(cell == NULLP)
+   {
+      DU_LOG("\nERROR  --> SCH : schPrachResAlloc(): Received cellCb is null");
+      return;
+   }
+
    /* If this slot is not a PRACH occassion, return */
    if(!schCheckPrachOcc(cell, prachOccasionTimingInfo))
       return;
@@ -217,11 +223,11 @@ uint16_t calculateRaRnti(uint8_t symbolIdx, uint8_t slotIdx, uint8_t freqIdx)
  **/
 void createSchRaCb(uint16_t tcrnti, Inst schInst)
 {
-   uint8_t ueIdx = 0;
+   uint8_t ueId = 0;
 
-   GET_UE_IDX(tcrnti, ueIdx);
-   schCb[schInst].cells[schInst]->raCb[ueIdx -1].tcrnti = tcrnti;
-   schCb[schInst].cells[schInst]->raCb[ueIdx -1].msg4recvd = FALSE;
+   GET_UE_ID(tcrnti, ueId);
+   schCb[schInst].cells[schInst]->raCb[ueId -1].tcrnti = tcrnti;
+   schCb[schInst].cells[schInst]->raCb[ueId -1].msg4recvd = FALSE;
 }
 
 /**
@@ -344,10 +350,10 @@ RaRspWindowStatus isInRaRspWindow(SchRaReq *raReq, SlotTimingInfo frameToCheck,
  *  @param[in]  Current timing of the cell
  *  @return  ROK
  **/
-void schProcessRaReq(SlotTimingInfo currTime, SchCellCb *cell)
+bool schProcessRaReq(Inst schInst, SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId)
 {
    bool      k2Found = false;
-   uint8_t   ueIdx = 0, k0TblIdx = 0, k2TblIdx = 0;
+   uint8_t   k0TblIdx = 0, k2TblIdx = 0;
    uint8_t   k0Index = 0, k2Index = 0;
    uint8_t   k0 = 0, k2 = 0;
    uint8_t   puschMu = 0;
@@ -364,162 +370,168 @@ void schProcessRaReq(SlotTimingInfo currTime, SchCellCb *cell)
    SchK2TimingInfoTbl   *msg3K2InfoTbl=NULLP;
    RaRspWindowStatus    windowStatus=0;
 
-   while(ueIdx < MAX_NUM_UE)
-   {
-      if(cell->raReq[ueIdx] == NULLP)
-      {
-         ueIdx++;
-         continue;
-      }
-
 #ifdef NR_TDD
-      totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.ssbSchCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod);
+   totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.ssbSchCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod);
 #endif
-      k0K1InfoTbl = &cell->cellCfg.schInitialDlBwp.k0K1InfoTbl;
-      msg3K2InfoTbl = &cell->cellCfg.schInitialUlBwp.msg3K2InfoTbl;
-      puschMu = cell->cellCfg.numerology;
-      msg3Delta = puschDeltaTable[puschMu];
-      msg3MinSchTime = minMsg3SchTime[cell->cellCfg.numerology];
-
-      /* Calculating time frame to send DCI for RAR */
-      ADD_DELTA_TO_TIME(currTime, dciTime, PHY_DELTA_DL + SCHED_DELTA);
-      dciSlot = dciTime.slot;
+   k0K1InfoTbl = &cell->cellCfg.schInitialDlBwp.k0K1InfoTbl;
+   msg3K2InfoTbl = &cell->cellCfg.schInitialUlBwp.msg3K2InfoTbl;
+   puschMu = cell->cellCfg.numerology;
+   msg3Delta = puschDeltaTable[puschMu];
+   msg3MinSchTime = minMsg3SchTime[cell->cellCfg.numerology];
+
+   /* Calculating time frame to send DCI for RAR */
+   ADD_DELTA_TO_TIME(currTime, dciTime, PHY_DELTA_DL + SCHED_DELTA);
+   dciSlot = dciTime.slot;
 #ifdef NR_TDD
-      /* Consider this slot for sending DCI, only if it is a DL slot */
-      if(schGetSlotSymbFrmt(dciSlot, cell->slotFrmtBitMap) == DL_SLOT)
+   /* Consider this slot for sending DCI, only if it is a DL slot */
+   if(schGetSlotSymbFrmt(dciSlot, cell->slotFrmtBitMap) == DL_SLOT)
 #endif
+   {
+      /* If PDCCH is already scheduled on this slot, cannot schedule PDSCH for another UE here. */
+      if(cell->schDlSlotInfo[dciSlot]->pdcchUe != 0)
+         return false;
+
+      /* Check if this slot is within RA response window */
+      windowStatus = isInRaRspWindow(cell->raReq[ueId-1], dciTime, cell->numSlots);
+      if(windowStatus == WITHIN_WINDOW)
       {
-         
-         /* Check if this slot is within RA response window */
-         windowStatus = isInRaRspWindow(cell->raReq[ueIdx], dciTime, cell->numSlots);
-         if(windowStatus == WITHIN_WINDOW)
+         /* For all k0 values, search for a suitable k2 value to schedule MSG3.
+          * RAR DCI, RAR PDSCH and MSG3 is scheduled only if one such k0-k2 combination
+          * is found. Else no scheduling happens. 
+          */
+         for(k0TblIdx = 0; k0TblIdx < k0K1InfoTbl->k0k1TimingInfo[dciSlot].numK0; k0TblIdx++)
          {
-            /* For all k0 values, search for a suitable k2 value to schedule MSG3.
-             * RAR DCI, RAR PDSCH and MSG3 is scheduled only if one such k0-k2 combination
-             * is found. Else no scheduling happens. 
-             */
-            for(k0TblIdx = 0; k0TblIdx < k0K1InfoTbl->k0k1TimingInfo[dciSlot].numK0; k0TblIdx++)
+            k0Index = k0K1InfoTbl->k0k1TimingInfo[dciSlot].k0Indexes[k0TblIdx].k0Index;
+            k0 = cell->cellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].k0;
+
+            /* Calculating time frame to send RAR PDSCH */
+            ADD_DELTA_TO_TIME(dciTime, rarTime, k0);
+            rarSlot = rarTime.slot;
+            
+            /* If PDSCH is already scheduled on this slot, cannot schedule PDSCH for another UE here. */
+            if(cell->schDlSlotInfo[rarSlot]->pdschUe != 0)
+               continue;
+
+            for(k2TblIdx = 0; k2TblIdx < msg3K2InfoTbl->k2TimingInfo[rarSlot].numK2; k2TblIdx++)
             {
-               k0Index = k0K1InfoTbl->k0k1TimingInfo[dciSlot].k0Indexes[k0TblIdx].k0Index;
-               k0 = cell->cellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].k0;
+               k2Index = msg3K2InfoTbl->k2TimingInfo[rarSlot].k2Indexes[k2TblIdx];
+               k2 = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2;
 
-               /* Calculating time frame to send RAR PDSCH */
-               ADD_DELTA_TO_TIME(dciTime, rarTime, k0);
-               rarSlot = rarTime.slot;
-
-               for(k2TblIdx = 0; k2TblIdx < msg3K2InfoTbl->k2TimingInfo[rarSlot].numK2; k2TblIdx++)
+               /* Delta is added to the slot allocation for msg3 based on 38.214 section 6.1.2.1 */
+               k2 = k2 + msg3Delta;
+               if(k2 >= msg3MinSchTime)
                {
-                  k2Index = msg3K2InfoTbl->k2TimingInfo[rarSlot].k2Indexes[k2TblIdx];
-                  k2 = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2;
-
-                  /* Delta is added to the slot allocation for msg3 based on 38.214 section 6.1.2.1 */
-                  k2 = k2 + msg3Delta;
-                  if(k2 >= msg3MinSchTime)
-                  {
-                     ADD_DELTA_TO_TIME(rarTime, msg3Time, k2);
+                  ADD_DELTA_TO_TIME(rarTime, msg3Time, k2);
 #ifdef NR_TDD
-                     if(schGetSlotSymbFrmt(msg3Time.slot % totalCfgSlot, cell->slotFrmtBitMap) == DL_SLOT)
-                        continue;
+                  if(schGetSlotSymbFrmt(msg3Time.slot % totalCfgSlot, cell->slotFrmtBitMap) == DL_SLOT)
+                     continue;
 #endif
-                     k2Found = true;
-                     break;
-                  }
-               }
-               if(k2Found)
+                  /* If PUSCH is already scheduled on this slot, another PUSCH
+                   * pdu cannot be scheduled here */
+                  if(cell->schUlSlotInfo[msg3Time.slot]->puschUe != 0)
+                     continue;
+
+                  k2Found = true;
                   break;
+               }
             }
+            if(k2Found)
+               break;
          }
-         else if(windowStatus == WINDOW_EXPIRED)
-         {
-            SCH_FREE(cell->raReq[ueIdx]->rachInd, sizeof(RachIndInfo));
-            SCH_FREE(cell->raReq[ueIdx], sizeof(SchRaReq));
-            ueIdx++;
-            continue;
-         }
+      }
+      else if(windowStatus == WINDOW_EXPIRED)
+      {
+         SCH_FREE(cell->raReq[ueId-1]->rachInd, sizeof(RachIndInfo));
+         SCH_FREE(cell->raReq[ueId-1], sizeof(SchRaReq));
+         return false;
+      }
 
-         /* If K0-K2 combination not found, no scheduling happens */
-         if(!k2Found)
-         {
-            ueIdx++;
-            continue;
-         }
+      /* If K0-K2 combination not found, no scheduling happens */
+      if(!k2Found)
+         return false;
 
-         /* Allocate memory for RAR PDCCH slot, pointer will be checked at schProcessSlotInd() */
-         SCH_ALLOC(dciSlotAlloc, sizeof(RarAlloc));
-         if(dciSlotAlloc == NULLP)
-         {
-            DU_LOG("\nERROR  -->  SCH : Memory Allocation failed for dciSlotAlloc");
-            return;
-         }
-         cell->schDlSlotInfo[dciSlot]->rarAlloc = dciSlotAlloc;
+      /* Allocate memory for RAR PDCCH slot, pointer will be checked at schProcessSlotInd() */
+      SCH_ALLOC(dciSlotAlloc, sizeof(RarAlloc));
+      if(dciSlotAlloc == NULLP)
+      {
+         DU_LOG("\nERROR  -->  SCH : Memory Allocation failed for dciSlotAlloc");
+         return false;
+      }
+      cell->schDlSlotInfo[dciSlot]->rarAlloc[ueId-1] = dciSlotAlloc;
 
-         /* Fill PDCCH and PDSCH scheduling information for RAR */
-         if((schFillRar(cell, rarTime, ueIdx, dciSlotAlloc, k0Index)) != ROK)
-         {
-            DU_LOG("\nERROR  -->  SCH: Scheduling of RAR failed in slot [%d]", rarSlot);
-            SCH_FREE(dciSlotAlloc, sizeof(RarAlloc));
-            cell->schDlSlotInfo[dciSlot]->rarAlloc = NULLP;
-            return;
-         }
+      /* Fill PDCCH and PDSCH scheduling information for RAR */
+      if((schFillRar(cell, rarTime, ueId, dciSlotAlloc, k0Index)) != ROK)
+      {
+         DU_LOG("\nERROR  -->  SCH: Scheduling of RAR failed in slot [%d]", rarSlot);
+         SCH_FREE(dciSlotAlloc, sizeof(RarAlloc));
+         cell->schDlSlotInfo[dciSlot]->rarAlloc[ueId-1] = NULLP;
+         return false;
+      }
+
+      /* Allocate resources for msg3 */
+      msg3PuschInfo = schAllocMsg3Pusch(schInst, cell->raReq[ueId-1]->rachInd->crnti, k2Index, msg3Time);
+      if(msg3PuschInfo)
+      {
+         /* Fill RAR info */
+         dciSlotAlloc->rarInfo.raRnti = cell->raReq[ueId-1]->raRnti;
+         dciSlotAlloc->rarInfo.tcrnti = cell->raReq[ueId-1]->rachInd->crnti;
+         dciSlotAlloc->rarInfo.RAPID = cell->raReq[ueId-1]->rachInd->preambleIdx;
+         dciSlotAlloc->rarInfo.ta = cell->raReq[ueId-1]->rachInd->timingAdv;
+         dciSlotAlloc->rarInfo.ulGrant.bwpSize = cell->cellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb;
+         /* Spec 38.213, section 8.2, 0 : MSG3 PUSCH will be transmitted without frequency hopping */
+         dciSlotAlloc->rarInfo.ulGrant.freqHopFlag = 0;
+         dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.startPrb = msg3PuschInfo->fdAlloc.startPrb;
+         dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.numPrb = msg3PuschInfo->fdAlloc.numPrb;
+         dciSlotAlloc->rarInfo.ulGrant.k2Index = k2Index;
+         dciSlotAlloc->rarInfo.ulGrant.mcs = msg3PuschInfo->tbInfo.mcs;
+         dciSlotAlloc->rarInfo.ulGrant.tpc = 3;  /* TODO : Check appropriate value to be filled */
+         /* Spec 38.213, section 8.2 : In a contention based random access
+          * procedure, the CSI request field is reserved. */
+         dciSlotAlloc->rarInfo.ulGrant.csiReq = 0;
+      }
 
-         /* Allocate resources for msg3 */
-         msg3PuschInfo = schAllocMsg3Pusch(cell->instIdx, cell->raReq[ueIdx]->rachInd->crnti, k2Index, msg3Time);
-         if(msg3PuschInfo)
+      /* Check if both DCI and RAR are sent in the same slot.
+       * If not, allocate memory RAR PDSCH slot to store RAR info
+       */
+      if(dciSlot == rarSlot)
+         dciSlotAlloc->pduPres = BOTH;
+      else
+      {
+         /* Allocate memory to schedule rarSlot to send RAR, pointer will be checked at schProcessSlotInd() */
+         SCH_ALLOC(rarSlotAlloc, sizeof(RarAlloc));
+         if(rarSlotAlloc == NULLP)
          {
-            /* Fill RAR info */
-            dciSlotAlloc->rarInfo.raRnti = cell->raReq[ueIdx]->raRnti;
-            dciSlotAlloc->rarInfo.tcrnti = cell->raReq[ueIdx]->rachInd->crnti;
-            dciSlotAlloc->rarInfo.RAPID = cell->raReq[ueIdx]->rachInd->preambleIdx;
-            dciSlotAlloc->rarInfo.ta = cell->raReq[ueIdx]->rachInd->timingAdv;
-            dciSlotAlloc->rarInfo.ulGrant.bwpSize = cell->cellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb;
-            /* Spec 38.213, section 8.2, 0 : MSG3 PUSCH will be transmitted without frequency hopping */
-            dciSlotAlloc->rarInfo.ulGrant.freqHopFlag = 0;
-            dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.startPrb = msg3PuschInfo->fdAlloc.startPrb;
-            dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.numPrb = msg3PuschInfo->fdAlloc.numPrb;
-            dciSlotAlloc->rarInfo.ulGrant.k2Index = k2Index;
-            dciSlotAlloc->rarInfo.ulGrant.mcs = msg3PuschInfo->tbInfo.mcs;
-            dciSlotAlloc->rarInfo.ulGrant.tpc = 3;  /* TODO : Check appropriate value to be filled */
-            /* Spec 38.213, section 8.2 : In a contention based random access
-             * procedure, the CSI request field is reserved. */
-            dciSlotAlloc->rarInfo.ulGrant.csiReq = 0;
+            DU_LOG("\nERROR  -->  SCH : Memory Allocation failed for rarSlotAlloc");
+            SCH_FREE(dciSlotAlloc, sizeof(RarAlloc));
+            cell->schDlSlotInfo[dciSlot]->rarAlloc[ueId-1] = NULLP;
+            return false;
          }
+         cell->schDlSlotInfo[rarSlot]->rarAlloc[ueId-1] = rarSlotAlloc;
 
-         /* Check if both DCI and RAR are sent in the same slot.
-          * If not, allocate memory RAR PDSCH slot to store RAR info
-          */
-         if(dciSlot == rarSlot)
-            dciSlotAlloc->pduPres = BOTH;
-         else
-         {
-            /* Allocate memory to schedule rarSlot to send RAR, pointer will be checked at schProcessSlotInd() */
-            SCH_ALLOC(rarSlotAlloc, sizeof(RarAlloc));
-            if(rarSlotAlloc == NULLP)
-            {
-               DU_LOG("\nERROR  -->  SCH : Memory Allocation failed for rarSlotAlloc");
-               SCH_FREE(dciSlotAlloc, sizeof(RarAlloc));
-               cell->schDlSlotInfo[dciSlot]->rarAlloc = NULLP;
-               return;
-            }
-            cell->schDlSlotInfo[rarSlot]->rarAlloc = rarSlotAlloc;
+         /* Copy all RAR info */
+         memcpy(rarSlotAlloc, dciSlotAlloc, sizeof(RarAlloc));
+         rarSlotAlloc->rarPdcchCfg.dci.pdschCfg = &rarSlotAlloc->rarPdschCfg;
 
-            /* Copy all RAR info */
-            memcpy(rarSlotAlloc, dciSlotAlloc, sizeof(RarAlloc));
-            rarSlotAlloc->rarPdcchCfg.dci.pdschCfg = &rarSlotAlloc->rarPdschCfg;
+         /* Assign correct PDU types in corresponding slots */
+         rarSlotAlloc->pduPres = PDSCH_PDU;
+         dciSlotAlloc->pduPres = PDCCH_PDU;
+         dciSlotAlloc->pdschSlot = rarSlot;  
+      }
 
-            /* Assign correct PDU types in corresponding slots */
-            rarSlotAlloc->pduPres = PDSCH_PDU;
-            dciSlotAlloc->pduPres = PDCCH_PDU;
-            dciSlotAlloc->pdschSlot = rarSlot;  
-         }
+      cell->schDlSlotInfo[dciSlot]->pdcchUe = ueId;
+      cell->schDlSlotInfo[rarSlot]->pdschUe = ueId;
+      cell->schUlSlotInfo[msg3Time.slot]->puschUe = ueId;
 
-         /* Create raCb at SCH */
-         createSchRaCb(cell->raReq[ueIdx]->rachInd->crnti, cell->instIdx);
+      /* Create raCb at SCH */
+      createSchRaCb(cell->raReq[ueId-1]->rachInd->crnti, schInst);
 
-         SCH_FREE(cell->raReq[ueIdx]->rachInd, sizeof(RachIndInfo));
-         SCH_FREE(cell->raReq[ueIdx], sizeof(SchRaReq));
-      }
-      ueIdx++;
-   } /* End of while(ueIdx < MAX_NUM_UE) */
+      /* Remove RachInd from pending RA request list */
+      SCH_FREE(cell->raReq[ueId-1]->rachInd, sizeof(RachIndInfo));
+      SCH_FREE(cell->raReq[ueId-1], sizeof(SchRaReq));
+      
+      return true;
+   }
+   return false;
 }
 
 /**
@@ -541,7 +553,7 @@ uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst)
    SchRaReq  *raReq = NULLP;
    float    slotDuration;
    uint8_t  winNumSlots;
-   uint8_t  ueIdx;
+   uint8_t  ueId;
 
    if(cell == NULLP)
    {
@@ -550,8 +562,8 @@ uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst)
    }
 
    /* Storing RA request in cellCb */
-   GET_UE_IDX(rachInd->crnti, ueIdx);
-   if(ueIdx <= 0)
+   GET_UE_ID(rachInd->crnti, ueId);
+   if(ueId <= 0)
    {
       DU_LOG("\nERROR  -->  SCH: Invalid CRNTI [%d]", rachInd->crnti);
       return RFAILED;
@@ -577,8 +589,10 @@ uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst)
    
    /* Adding window size to window start time to get window end time */
    ADD_DELTA_TO_TIME(raReq->winStartTime, raReq->winEndTime, winNumSlots);
+   cell->raReq[ueId -1] = raReq;
 
-   cell->raReq[ueIdx -1] = raReq;
+   /* Adding UE Id to list of pending UEs to be scheduled */
+   addUeToBeScheduled(cell, ueId);
 
    return ROK;
 }
@@ -598,7 +612,7 @@ uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst)
  *  @param[in]  offset to pointA to determine freq alloc
  *  @return  ROK
  **/
-uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueIdx, RarAlloc *rarAlloc, uint8_t k0Index)
+uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueId, RarAlloc *rarAlloc, uint8_t k0Index)
 {
    uint8_t  coreset0Idx = 0;
    uint8_t  firstSymbol = 0, numSymbols = 0;
@@ -648,7 +662,7 @@ uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueIdx, RarA
    pdcch->coresetCfg.shiftIndex = cell->cellCfg.phyCellId;
    pdcch->coresetCfg.precoderGranularity = 0; /* sameAsRegBundle */
    pdcch->numDlDci = 1;
-   pdcch->dci.rnti = cell->raReq[ueIdx]->raRnti; /* RA-RNTI */
+   pdcch->dci.rnti = cell->raReq[ueId-1]->raRnti; /* RA-RNTI */
    pdcch->dci.scramblingId = cell->cellCfg.phyCellId;
    pdcch->dci.scramblingRnti = 0;
    pdcch->dci.cceIndex = 4; /* considering SIB1 is sent at cce 0-1-2-3 */
@@ -665,7 +679,7 @@ uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueIdx, RarA
    /* fill the PDSCH PDU */
    uint8_t cwCount = 0;
    pdsch->pduBitmap = 0; /* PTRS and CBG params are excluded */
-   pdsch->rnti = cell->raReq[ueIdx]->raRnti; /* RA-RNTI */
+   pdsch->rnti = cell->raReq[ueId-1]->raRnti; /* RA-RNTI */
    pdsch->pduIndex = 0;
    pdsch->numCodewords = 1;
    for(cwCount = 0; cwCount < pdsch->numCodewords; cwCount++)
@@ -693,6 +707,7 @@ uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueIdx, RarA
    pdsch->dmrs.nrOfDmrsSymbols  = NUM_DMRS_SYMBOLS;
    pdsch->dmrs.dmrsAddPos       = DMRS_ADDITIONAL_POS;
 
+   pdsch->pdschTimeAlloc.rowIndex = k0Index;
    pdsch->pdschTimeAlloc.timeAlloc.startSymb = initialBwp->pdschCommon.timeDomRsrcAllocList[k0Index].startSymbol;
    pdsch->pdschTimeAlloc.timeAlloc.numSymb = initialBwp->pdschCommon.timeDomRsrcAllocList[k0Index].lengthSymbol;