[Epic-ID: ODUHIGH-556][Task-ID: ODUHIGH-558] Introduction of PUCCH allocation for... 04/12504/3
authorpborla <pborla@radisys.com>
Tue, 6 Feb 2024 08:59:21 +0000 (14:29 +0530)
committerSangeeta Vaidhyanathan <svaidhya@radisys.com>
Mon, 12 Feb 2024 09:01:25 +0000 (09:01 +0000)
Change-Id: Ic158d5bb1369813071dfda9752d388bd153624ac
Signed-off-by: svaidhya <svaidhya@radisys.com>
src/5gnrsch/sch.h
src/5gnrsch/sch_common.c
src/5gnrsch/sch_harq_dl.c
src/5gnrsch/sch_rach.c
src/5gnrsch/sch_slot_ind.c
src/5gnrsch/sch_ue_mgr.c

index 199e8fe..044619f 100644 (file)
@@ -250,7 +250,7 @@ struct schDlHqProcCb
    SchDlHqEnt        *hqEnt;
    uint8_t           maxHqTxPerHqP;
    CmLList           dlHqEntLnk;
-   CmLList           ulSlotLnk;
+   CmLList           dlSlotLnk;
    SchDlHqTbCb       tbInfo[2];
    uint8_t           k1;
    void              *schSpcDlHqProcCb;  /*!< Scheduler specific HARQ Proc CB */
@@ -796,7 +796,7 @@ uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst);
 bool schCheckPrachOcc(SchCellCb *cell, SlotTimingInfo prachOccasionTimingInfo);
 uint8_t schCalcPrachNumRb(SchCellCb *cell);
 void schPrachResAlloc(SchCellCb *cell, UlSchedInfo *ulSchedInfo, SlotTimingInfo prachOccasionTimingInfo);
-uint16_t schAllocPucchResource(SchCellCb *cell, SlotTimingInfo pucchTime, uint16_t crnti,SchUeCb *ueCb, bool isRetx, SchDlHqProcCb *hqP);
+uint8_t schAllocPucchResource(SchCellCb *cell, SlotTimingInfo pucchTime, SchUeCb *ueCb, bool isRetx, SchDlHqProcCb *hqP);
 uint8_t schFillUlDci(SchUeCb *ueCb, SchPuschInfo *puschInfo, DciInfo *dciInfo, bool isRetx, SchUlHqProcCb *hqP);
 uint8_t schFillPuschAlloc(SchUeCb *ueCb, SlotTimingInfo puschTime, uint32_t tbSize,
                             uint8_t startSymb, uint8_t symbLen, uint16_t startPrb, bool isRetx, SchUlHqProcCb *hqP);
index 177e2df..8978755 100644 (file)
@@ -407,10 +407,9 @@ uint8_t fillUlSchedPucchDedicatedCfg(SchCellCb *cell, SchPucchCfg *pucchDedCfg,\
  *  @return  ROK/RFAILED
  **/
 
-uint16_t fillPucchResourceInfo(uint8_t ueId, SchPucchInfo *schPucchInfo, Inst inst, SlotTimingInfo slotInfo)
+uint16_t fillPucchResourceInfo(SchCellCb *cell, uint8_t ueId, SchPucchInfo *schPucchInfo, SlotTimingInfo slotInfo)
 {
-   uint8_t ret = ROK,  ueIdx = 0, pucchIdx = 0;
-   SchCellCb  *cell = schCb[inst].cells[inst];
+   uint8_t ret = RFAILED,  ueIdx = 0, pucchIdx = 0;
    SchPucchCfgCmn *pucchCfg = NULLP;
    SchBwpParams *ulBwp = NULLP;
 #ifdef NR_DRX 
@@ -431,12 +430,12 @@ uint16_t fillPucchResourceInfo(uint8_t ueId, SchPucchInfo *schPucchInfo, Inst in
    {
       /* fill pucch dedicated cfg */
       ret = fillUlSchedPucchDedicatedCfg(cell,\
-       &cell->ueCb[ueIdx].ueCfg.spCellCfg.servCellRecfg.initUlBwp.pucchCfg, &slotInfo, schPucchInfo);
+            &cell->ueCb[ueIdx].ueCfg.spCellCfg.servCellRecfg.initUlBwp.pucchCfg, &slotInfo, schPucchInfo);
       if(ret == RFAILED)
       {
          memset(schPucchInfo, 0, sizeof(SchPucchInfo));
          DU_LOG("\nERROR  --> SCH : Filling PUCCH dedicated cfg failed at fillPucchResourceInfo()");
-        return ret;
+         return ret;
       }
    }
    else
@@ -461,7 +460,7 @@ uint16_t fillPucchResourceInfo(uint8_t ueId, SchPucchInfo *schPucchInfo, Inst in
          schPucchInfo->srFlag  = true;
       }
    }
-   return ROK;
+   return ret;
 }
 
 /**
@@ -500,7 +499,7 @@ uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst)
 
    /* Schedule resources for PRACH */
    if(cell->firstSib1Transmitted)
-    schPrachResAlloc(cell, &ulSchedInfo, ulTimingInfo);
+      schPrachResAlloc(cell, &ulSchedInfo, ulTimingInfo);
 
    schUlSlotInfo = cell->schUlSlotInfo[ulTimingInfo.slot]; 
    if(schUlSlotInfo->schPuschInfo)
@@ -517,25 +516,17 @@ uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst)
 #endif
       ulSchedInfo.dataType |= SCH_DATATYPE_PUSCH;
       memcpy(&ulSchedInfo.schPuschInfo, schUlSlotInfo->schPuschInfo,
-           sizeof(SchPuschInfo));
+            sizeof(SchPuschInfo));
       SCH_FREE(schUlSlotInfo->schPuschInfo, sizeof(SchPuschInfo));
       schUlSlotInfo->schPuschInfo = NULL;
    }
 
    if(schUlSlotInfo->pucchPres)
    {
-      GET_CRNTI(ulSchedInfo.crnti, schUlSlotInfo->pucchUe);
-      ret = fillPucchResourceInfo(schUlSlotInfo->pucchUe, &schUlSlotInfo->schPucchInfo, schInst, ulTimingInfo);
-      if (ret == ROK)
-      {
-         ulSchedInfo.dataType |= SCH_DATATYPE_UCI;
-         memcpy(&ulSchedInfo.schPucchInfo, &schUlSlotInfo->schPucchInfo,
-               sizeof(SchPucchInfo));
-      }
-      else
-      {
-         return RFAILED;
-      }
+      GET_CRNTI(ulSchedInfo.crnti, schUlSlotInfo->pucchUe); 
+      ulSchedInfo.dataType |= SCH_DATATYPE_UCI;
+      memcpy(&ulSchedInfo.schPucchInfo, &schUlSlotInfo->schPucchInfo,
+            sizeof(SchPucchInfo));
       memset(&schUlSlotInfo->schPucchInfo, 0, sizeof(SchPucchInfo));
    }
 
@@ -773,9 +764,10 @@ uint8_t schDlRsrcAllocMsg4(SchCellCb *cell, SlotTimingInfo msg4Time, uint8_t ueI
  *
  *******************************************************************/
 
-uint16_t schAllocPucchResource(SchCellCb *cell, SlotTimingInfo pucchTime, uint16_t crnti,
+uint8_t schAllocPucchResource(SchCellCb *cell, SlotTimingInfo pucchTime,
                                SchUeCb *ueCb, bool isRetx, SchDlHqProcCb *hqP)
 {
+   uint8_t ret = RFAILED;
    uint16_t pucchSlot = 0;
    SchUlSlotInfo  *schUlSlotInfo = NULLP;
 
@@ -783,13 +775,20 @@ uint16_t schAllocPucchResource(SchCellCb *cell, SlotTimingInfo pucchTime, uint16
    schUlSlotInfo = cell->schUlSlotInfo[pucchSlot];
    memset(&schUlSlotInfo->schPucchInfo, 0, sizeof(SchPucchInfo));
 
+   ret = fillPucchResourceInfo(cell, schUlSlotInfo->pucchUe, &schUlSlotInfo->schPucchInfo, pucchTime);
+   if(ret != ROK)
+   {
+      return ret;  
+   }
+   
    schUlSlotInfo->pucchPres = true;
+
    if(ueCb != NULLP)
    {
       /* set HARQ flag to true */
       schUlSlotInfo->schPucchInfo.harqInfo.harqBitLength = 1; /* 1 bit for HARQ */
       ADD_DELTA_TO_TIME(pucchTime, pucchTime, 3, cell->numSlots); /* SLOT_DELAY=3 */
-      cmLListAdd2Tail(&(ueCb->hqDlmap[pucchTime.slot]->hqList), &hqP->ulSlotLnk);
+      cmLListAdd2Tail(&(ueCb->hqDlmap[pucchTime.slot]->hqList), &hqP->dlSlotLnk);
    }
    return ROK;
 }
@@ -1915,11 +1914,9 @@ uint8_t schProcessMsg4Req(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId
       }
    }
 
-   /* PUCCH resource */
-   schAllocPucchResource(cell, pucchTime, cell->raCb[ueId-1].tcrnti, &cell->ueCb[ueId-1], isRetxMsg4, *msg4HqProc);
-
    cell->schDlSlotInfo[pdcchTime.slot]->pdcchUe = ueId;
    cell->schUlSlotInfo[pucchTime.slot]->pucchUe = ueId;
+   
    cell->raCb[ueId-1].msg4recvd = FALSE;
    if(isRetxMsg4)
    {
index f058cdc..043e392 100644 (file)
@@ -88,7 +88,7 @@ void schDlHqEntReset(SchCellCb *cellCb, SchUeCb *ueCb, SchDlHqEnt *hqE)
       hqP->maxHqTxPerHqP = hqE->maxHqTx;
       hqP->dlHqEntLnk.node = (PTR)hqP;
       hqP->dlHqProcLink.node = (PTR)hqP;
-      hqP->ulSlotLnk.node = (PTR)hqP;
+      hqP->dlSlotLnk.node = (PTR)hqP;
       cellCb->api->SchInitDlHqProcCb(hqP);
       schDlHqAddToFreeList(hqP);
    }
index def46dd..8872f8a 100644 (file)
@@ -540,7 +540,7 @@ bool schProcessRaReq(Inst schInst, SchCellCb *cell, SlotTimingInfo currTime, uin
    uint8_t   k0TblIdx = 0, k1TblIdx = 0, k2TblIdx = 0;
    uint8_t   k0Index = 0, k1Index = 0, k2Index = 0;
    uint8_t   k0 = 0, k1 = 0, k2 = 0;
-   uint8_t   numK1 = 0;
+   uint8_t   numK1 = 0, ret = OK;
    uint8_t   puschMu = 0;
    uint8_t   msg3Delta = 0, msg3MinSchTime = 0;
 #ifdef NR_TDD
@@ -697,10 +697,20 @@ bool schProcessRaReq(Inst schInst, SchCellCb *cell, SlotTimingInfo currTime, uin
       if(cell->raReq[ueId-1]->isCFRA)
       {
          /* Allocate resources for PUCCH */
-         schAllocPucchResource(cell, pucchTime, cell->raReq[ueId-1]->rachInd->crnti,NULLP, FALSE, NULLP);
+         cell->schUlSlotInfo[pucchTime.slot]->pucchUe = ueId;
+         ret = schAllocPucchResource(cell, pucchTime, NULLP, FALSE, NULLP);
+         if(ret == RFAILED)
+         {
+            SCH_FREE(dciSlotAlloc, sizeof(RarAlloc));
+            cell->schDlSlotInfo[dciSlot]->rarAlloc[ueId-1] = NULLP;
+            DU_LOG("\nERROR  -->  SCH : Resource allocation for PUCCH failed for CFRA!");
+            return false;
+            
+         }
       }
       else
       {
+         cell->schUlSlotInfo[msg3Time.slot]->puschUe = ueId;
          /* Allocate resources for msg3 */
          msg3PuschInfo = schAllocMsg3Pusch(schInst, cell->raReq[ueId-1]->rachInd->crnti, k2Index, msg3Time, &(cell->raCb[ueId-1].msg3HqProc), FALSE);
          if(msg3PuschInfo)
@@ -780,10 +790,6 @@ bool schProcessRaReq(Inst schInst, SchCellCb *cell, SlotTimingInfo currTime, uin
       }
 
       cell->schDlSlotInfo[dciSlot]->pdcchUe = ueId;
-      if(cell->raReq[ueId-1]->isCFRA)
-         cell->schUlSlotInfo[pucchTime.slot]->pucchUe = ueId;
-      else
-         cell->schUlSlotInfo[msg3Time.slot]->puschUe = ueId;
 
       /* Create raCb at SCH */
       createSchRaCb(ueId, cell->raReq[ueId-1], schInst);
index 62c1bbb..5ac9129 100644 (file)
@@ -242,8 +242,6 @@ bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t
       }
    }
 
-   schAllocPucchResource(cell, pucchTime, crnti, ueCb, isRetx, *hqP);
-
    cell->schUlSlotInfo[pucchTime.slot]->pucchUe = ueId;
 
    /*Re-setting the BO's of all DL LCs in this UE*/
@@ -422,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;
 
@@ -434,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
@@ -520,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, isRetx, hqP);
+         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.
index ddb8b3d..fcc671e 100644 (file)
@@ -1518,7 +1518,7 @@ void schUpdateHarqFdbk(SchUeCb *ueCb, uint8_t numHarq, uint8_t *harqPayload, Slo
 {
    SchDlHqProcCb *hqP;
    SchHqDlMap *hqDlMap;
-   CmLList  *node;
+   CmLList  *node = NULLP;
    uint8_t fdbkPos = 0;
 
    hqDlMap = ueCb->hqDlmap[slotInd->slot];
@@ -1527,29 +1527,37 @@ void schUpdateHarqFdbk(SchUeCb *ueCb, uint8_t numHarq, uint8_t *harqPayload, Slo
    {
       return;
    }
-   if (ueCb->cellCb->raCb[ueCb->ueId-1].raState != SCH_RA_STATE_MSG4_PENDING)
+
+   while(fdbkPos < numHarq)
    {
       node = hqDlMap->hqList.first;
-      while(node)
+      if(node == NULLP)
+      {
+         DU_LOG("\nERROR :  SCH --> DL HARQ list is empty thus no need to process the dl harq feedback!");
+         return;
+      }
+      if (ueCb->cellCb->raCb[ueCb->ueId-1].raState != SCH_RA_STATE_MSG4_PENDING)
+      {
+         while(node)
+         {
+            hqP = (SchDlHqProcCb*)node->node;
+            node = node->next;
+            cmLListDelFrm(&hqDlMap->hqList, &hqP->dlSlotLnk);
+            /* 
+               Decode harq feedback if needed post FAPI message decoding also or check how to decode this FAPI msg.
+               case 1 semi static harq Ack/Nack codebook //Supported
+               case 2 dynamic harq ACK/NACK codebook //Not supported
+               */
+            schDlHqFeedbackUpdate(hqP, harqPayload[fdbkPos++], HQ_TB_ACKED);//Marking 2nd TB as ACKED for now as only one TB to be used
+         }
+      }
+      else
       {
          hqP = (SchDlHqProcCb*)node->node;
-         node = node->next;
-         cmLListDelFrm(&hqDlMap->hqList, &hqP->ulSlotLnk);
-         /* 
-            Decode harq feedback if needed post FAPI message decoding also or check how to decode this FAPI msg.
-            case 1 semi static harq Ack/Nack codebook //Supported
-            case 2 dynamic harq ACK/NACK codebook //Not supported
-         */
-         schDlHqFeedbackUpdate(hqP, harqPayload[fdbkPos++], HQ_TB_ACKED);//Marking 2nd TB as ACKED for now as only one TB to be used
+         cmLListDelFrm(&hqDlMap->hqList, &hqP->dlSlotLnk);
+         schMsg4FeedbackUpdate(hqP, harqPayload[fdbkPos++]);
       }
    }
-   else
-   {
-      node = hqDlMap->hqList.first;
-      hqP = (SchDlHqProcCb*)node->node;
-      cmLListDelFrm(&hqDlMap->hqList, &hqP->ulSlotLnk);
-      schMsg4FeedbackUpdate(hqP, harqPayload[fdbkPos++]);
-   }
 }
 /**********************************************************************
   End of file