[Epic-ID: ODUHIGH-517][Task-ID: ODUHIGH-539][SubTask-Id: ODUHIGH-545] Multi UE| DL... 26/12226/5
authorsvaidhya <svaidhya@radisys.com>
Mon, 11 Dec 2023 11:09:43 +0000 (16:39 +0530)
committersvaidhya <svaidhya@radisys.com>
Mon, 11 Dec 2023 16:36:55 +0000 (22:06 +0530)
Change-Id: Iee745d4005369630295479a731c167c40b9f7d6e
Signed-off-by: svaidhya <svaidhya@radisys.com>
src/5gnrsch/sch.h
src/5gnrsch/sch_common.c
src/5gnrsch/sch_ue_mgr.c
src/5gnrsch/sch_utils.c
src/5gnrsch/sch_utils.h

index b5e1f93..6f8672d 100644 (file)
@@ -326,6 +326,9 @@ typedef struct schDlSlotInfo
    SsbInfo      ssbInfo[MAX_SSB_IDX];     /*!< SSB info */
    bool         sib1Pres;                 /*!< Flag to determine if SIB1 is present in this slot */
    uint8_t      pdcchUe;                  /*!< UE for which PDCCH is scheduled in this slot */
+   /*TODO: will remove the above parameter which is stopping multiUE allocation
+    * for PDCCH*/
+   uint32_t     usedRbgForPdcch[FREQ_DOM_RSRC_SIZE]; /*Bitmap for used RBG during PDCCH allocation in this slot.*/
    uint8_t      pdschUe;                  /*!< UE for which PDSCH is scheduled in this slot */
    RarAlloc     *rarAlloc[MAX_NUM_UE];    /*!< RAR allocation per UE*/
    DciInfo      *ulGrant;
@@ -803,6 +806,7 @@ LcInfo* handleLcLList(CmLListCp *lcLL, uint8_t lcId, ActionTypeLL action);
 void prbAllocUsingRRMPolicy(CmLListCp *lcLL, bool dedicatedPRB, uint16_t mcsIdx,uint8_t numSymbols,\
                       uint16_t *sharedPRB, uint16_t *reservedPRB, bool *isTxPayloadLenAdded, bool *srRcvd);
 void updateBsrAndLcList(CmLListCp *lcLL, BsrInfo *bsrInfo, uint8_t status);
+uint8_t fillUeCoresetAndSsInfo(SchUeCb *ue);
 
 /*Paging Functions*/
 void schProcPagingCfg(SchCellCb *cell);
index 4869129..6a10e8b 100644 (file)
@@ -2323,6 +2323,77 @@ bool schGetMsg3K2(SchCellCb *cell, SchUlHqProcCb* msg3HqProc, uint16_t dlTime, S
    return k2Found;
 }
 
+/*
+ *  * @brief : This Function fills the Coreset and SS info based on PDCCH Cfg received for a UE
+ *
+ *     Function : fillUeCoresetAndSsInfo
+ *
+ * For a Coreset, capture the following details which will be used during pdcch allocation
+ *   [Step 1]: Count number of RBG and calculate TotalPRBs which can be used 
+ *   [Step 2]: Get the reference pointer for Coreset and Its SearchSpace.
+ *   [Step 3]: A CCE will have 6 RBs in TOTAL. If duration increases, CCE will
+ *             occupy less number of PRBs(1RB x 1 OFDM Symbol). Eg. If duration = 2, then
+ *             instead of 6 PRBs, CCE will only occupy 3 PRBs and 2 OFDM symbols.
+ *   [Step 4]: Based on CoresetSize, fill AggLvl-CQI mapping by calculating the dciSize.
+ *   [Step 5]: Calculate Y value for this coreset and UE
+ *
+ *   @Params[in]: UeCb,
+ *  [return]: ROK, RFAILED : Memory allocation failure.
+ **/
+uint8_t fillUeCoresetAndSsInfo(SchUeCb *ue)
+{
+   uint8_t  cRSetIdx = 0,ssIdx = 0; 
+   uint16_t rbgCount = 0;
+   SchPdcchConfig *pdcchCfg = NULLP;
+
+   pdcchCfg =  &ue->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg;
+   if(pdcchCfg == NULLP)
+   {
+     DU_LOG("\nERROR  --> SCH: PDCCH Cfg is not received thus skip filling of Coreset & SS info");
+     return RFAILED;
+   }
+   for(cRSetIdx = 0; cRSetIdx < pdcchCfg->numCRsetToAddMod; cRSetIdx++ )
+   {
+      /*[Step 1]: *//*Size of coreset: Number of PRBs in a coreset*/
+      rbgCount = countRBGFrmCoresetFreqRsrc(pdcchCfg->cRSetToAddModList[cRSetIdx].freqDomainRsrc);
+      if(rbgCount)
+      {
+         ue->pdcchInfo[cRSetIdx].totalPrbs = ((rbgCount) * NUM_PRBS_PER_RBG);
+      }
+      else
+      {
+         DU_LOG("\nERROR  -->  SCH : CORESETSize is zero in fillCoresetAndSsConfg");
+         continue;
+      }
+      /*[Step 2]:*/
+      ue->pdcchInfo[cRSetIdx].cRSetRef = &pdcchCfg->cRSetToAddModList[cRSetIdx];
+      for(ssIdx = 0; ssIdx < pdcchCfg->numSearchSpcToAddMod; ssIdx++)
+      {
+         if(pdcchCfg->searchSpcToAddModList[ssIdx].cRSetId == pdcchCfg->cRSetToAddModList[cRSetIdx].cRSetId)
+         {
+            ue->pdcchInfo[cRSetIdx].ssRef = &pdcchCfg->searchSpcToAddModList[ssIdx];
+            break;
+         }
+      }
+
+      /*[Step 3]:*/
+      /*nrOfPRBPerCce is Number of PRBs occupied by a CCE based on Duration*/
+      ue->pdcchInfo[cRSetIdx].nrOfPRBPerCce = NUM_PRBS_PER_RBG/pdcchCfg->cRSetToAddModList[cRSetIdx].duration;
+      ue->pdcchInfo[cRSetIdx].totalCceCount = rbgCount * pdcchCfg->cRSetToAddModList[cRSetIdx].duration;
+
+      /*[Step 4]:*/
+      fillCqiAggLvlMapping(&ue->pdcchInfo[cRSetIdx]);
+
+      /*[Step 5]:*/
+      if(RFAILED == schUpdValY(ue, &ue->pdcchInfo[cRSetIdx]))
+      {
+         return RFAILED;
+      }
+   }
+   return ROK;
+}
+
+
 /**********************************************************************
   End of file
  **********************************************************************/
index 23d3638..81e7309 100644 (file)
@@ -793,7 +793,12 @@ uint8_t SchAddUeConfigReq(Pst *pst, SchUeCfgReq *ueCfg)
       cmLListInit(&ueCb->hqUlmap[idx]->hqList);
    }
    ret = fillSchUeCbFrmCfgReq(inst, ueCb, ueCfg);
-
+   
+   if(fillUeCoresetAndSsInfo(ueCb) == RFAILED)
+   {
+       DU_LOG("\nERROR  -->  SCH : Memory Allocation Failed");
+       return RFAILED;
+   }
    if(ret == ROK)
    {
       /* If UE has initiated RACH and then UE context is created, it means UE is
@@ -1152,7 +1157,7 @@ uint8_t SchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfg)
    SchUeRecfgRsp  recfgRsp;
    Inst         inst = pst->dstInst - SCH_INST_START;
    memset(&recfgRsp, 0, sizeof(SchUeRecfgRsp));
-  
+
    if(!ueRecfg)
    {
       DU_LOG("\nERROR  -->  SCH : Modifying Ue Config request failed at SchModUeConfigReq()");
@@ -1170,7 +1175,7 @@ uint8_t SchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfg)
    /* Search if UE already configured */
    GET_UE_ID(ueRecfg->crnti, ueId);
    ueCb = &cellCb->ueCb[ueId -1];
-   
+
    if(!ueCb)
    {
       DU_LOG("\nERROR  -->  SCH : SchUeCb not found at SchModUeConfigReq() ");
@@ -1181,6 +1186,11 @@ uint8_t SchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfg)
    {
       /* Found the UeCb to Reconfig */
       ret = fillSchUeCbFrmRecfgReq(inst, ueCb, ueRecfg);
+      if(fillUeCoresetAndSsInfo(ueCb) == RFAILED)
+      {
+         DU_LOG("\nERROR  -->  SCH : Memory Allocation Failed");
+         return RFAILED;
+      }
       if(ret == ROK)
       {
          ueCb->cellCb = cellCb;
@@ -1292,7 +1302,7 @@ void deleteSchPdschServCellCfg(SchPdschServCellCfg *pdschServCellCfg)
 * ****************************************************************/
 void deleteSchUeCb(SchUeCb *ueCb) 
 {
-   uint8_t timeDomRsrcIdx = 0, ueLcIdx = 0, idx =0;
+   uint8_t timeDomRsrcIdx = 0, ueLcIdx = 0, slotIdx =0, cRSetIdx = 0;
    SchPucchCfg *pucchCfg = NULLP;
    SchPdschConfig *pdschCfg = NULLP;
 
@@ -1300,12 +1310,12 @@ void deleteSchUeCb(SchUeCb *ueCb)
    {
       if(ueCb->hqDlmap)
       {
-         for (idx = 0; idx<ueCb->cellCb->numSlots; idx++)
+         for (slotIdx = 0; slotIdx<ueCb->cellCb->numSlots; slotIdx++)
          {
-            if(ueCb->hqDlmap[idx])
+            if(ueCb->hqDlmap[slotIdx])
             {
-               cmLListDeleteLList(&ueCb->hqDlmap[idx]->hqList);
-               SCH_FREE(ueCb->hqDlmap[idx], sizeof(SchHqDlMap));
+               cmLListDeleteLList(&ueCb->hqDlmap[slotIdx]->hqList);
+               SCH_FREE(ueCb->hqDlmap[slotIdx], sizeof(SchHqDlMap));
             }
          }
          SCH_FREE(ueCb->hqDlmap, sizeof(SchHqDlMap*)*(ueCb->cellCb->numSlots));
@@ -1313,12 +1323,12 @@ void deleteSchUeCb(SchUeCb *ueCb)
 
       if(ueCb->hqUlmap)
       {
-         for (idx = 0; idx<ueCb->cellCb->numSlots; idx++)
+         for (slotIdx = 0; slotIdx<ueCb->cellCb->numSlots; slotIdx++)
          {
-            if(ueCb->hqUlmap[idx])
+            if(ueCb->hqUlmap[slotIdx])
             {
-               cmLListDeleteLList(&ueCb->hqUlmap[idx]->hqList);
-               SCH_FREE(ueCb->hqUlmap[idx], sizeof(SchHqUlMap));
+               cmLListDeleteLList(&ueCb->hqUlmap[slotIdx]->hqList);
+               SCH_FREE(ueCb->hqUlmap[slotIdx], sizeof(SchHqUlMap));
             }
          }
          SCH_FREE(ueCb->hqUlmap, sizeof(SchHqUlMap*)*(ueCb->cellCb->numSlots));
@@ -1373,6 +1383,11 @@ void deleteSchUeCb(SchUeCb *ueCb)
          ueCb->ueDrxInfoPres = false;
       }
 #endif
+      for(cRSetIdx=0; cRSetIdx < MAX_NUM_CRSET; cRSetIdx++)
+      {
+         SCH_FREE(ueCb->pdcchInfo[cRSetIdx].y, (sizeof(uint32_t) * ueCb->cellCb->numSlots));
+      }
       memset(ueCb, 0, sizeof(SchUeCb));
    }
 }
index 84a2e7e..42cf6a0 100644 (file)
@@ -771,7 +771,7 @@ uint8_t pucchResourceSet[MAX_PUCCH_RES_SET_IDX][4] = {
  * Modulation Scheme is numbered based on bit rate as follows
  * QPSK = 2, 16QAM = 4, 64QAM = 6
  * */
-unsigned long cqiTable1[MAX_NUM_CQI_IDX][3] = {
+float cqiTable1[MAX_NUM_CQI_IDX][3] = {
 { 0, 0, 0},        /*index 0*/
 { 2, 78, 0.1523},  /*index 1*/
 { 2, 120, 0.2344}, /*index 2*/
@@ -1271,6 +1271,7 @@ void schInitDlSlot(SchDlSlotInfo *schDlSlotInfo)
       freeBlock->endPrb = MAX_NUM_RB-1;
       addNodeToLList(&schDlSlotInfo->prbAlloc.freePrbBlockList, freeBlock, NULL);
    }
+   memset(schDlSlotInfo->usedRbgForPdcch, 0, (sizeof(uint32_t) * FREQ_DOM_RSRC_SIZE));
 }
 
 /**
@@ -1985,7 +1986,7 @@ void fillCqiAggLvlMapping(SchPdcchInfo *pdcchInfo)
       /*CQI table number 1 is used Spec 38.214 Table 5.2.2.1-2 by default.
        *TODO: cqi-table param in CSI-RepotConfig(3gpp 38.331) will report
        * which table to be used*/
-      pdcchBits = dciSize / cqiTable1[cqiIdx][2];
+      pdcchBits = ceil(dciSize / cqiTable1[cqiIdx][2]);
       for(aggLvlIdx = 0; (aggLvlIdx < MAX_NUM_AGG_LVL) && (pdcchBits != 0); aggLvlIdx++)
       {
          numOfBitsAvailForAggLevel = (totalRE_PerAggLevel[aggLvlIdx] * cqiTable1[cqiIdx][0]);
@@ -2053,13 +2054,19 @@ uint32_t schCalY(uint8_t csId, uint32_t prevY)
  *   in pdcch allocation
  *
  * @params[in] : SchUeCb, PdcchInfo
+ *    [return] : uint8_t ROK, RFAILED : Memory allocation status
  *
  * */
-void schUpdValY(SchUeCb *ueCb, SchPdcchInfo *pdcchInfo)
+uint8_t schUpdValY(SchUeCb *ueCb, SchPdcchInfo *pdcchInfo)
 {
    uint8_t slotIdx = 0;
 
    SCH_ALLOC(pdcchInfo->y, (sizeof(uint32_t) *  ueCb->cellCb->numSlots));
+   if(pdcchInfo->y == NULLP)
+   {
+      DU_LOG("\nERROR  --> SCH: Memory Allocation of Y failed");
+      return RFAILED;
+   }
 
    for(slotIdx= 0 ; slotIdx < ueCb->cellCb->numSlots; slotIdx++)
    {
@@ -2072,6 +2079,7 @@ void schUpdValY(SchUeCb *ueCb, SchPdcchInfo *pdcchInfo)
          pdcchInfo->y[slotIdx] = schCalY(pdcchInfo->cRSetRef->cRSetId, pdcchInfo->y[slotIdx - 1]);
       }
    }
+   return ROK;
 }
 /**********************************************************************
          End of file
index b562f12..c0ae4c0 100644 (file)
@@ -139,7 +139,7 @@ void schDeleteFromPageInfoList(CmLListCp *list, CmLList *node);
 uint8_t countRBGFrmCoresetFreqRsrc(uint8_t *freqDomainRsrc);
 uint8_t findSsStartSymbol(uint8_t *mSymbolsWithinSlot);
 void fillCqiAggLvlMapping(SchPdcchInfo *pdcchInfo);
-void schUpdValY(SchUeCb *ueCb, SchPdcchInfo *pdcchInfo);
+uint8_t schUpdValY(SchUeCb *ueCb, SchPdcchInfo *pdcchInfo);
 #if 0
 /*Will be enabled for debugging*/
 void printLcLL(CmLListCp *lcLL);