[Epic-ID: ODUHIGH-488][Task-ID: ODUHIGH-498] Fix in DL data flow and trace alignment
[o-du/l2.git] / src / 5gnrsch / sch_utils.c
index b960586..9d65480 100644 (file)
@@ -773,6 +773,7 @@ uint8_t minMsg3SchTime[MAX_NUM_MU] = {6, 6, 6, 6};
 
 uint8_t defaultUlAckTbl[DEFAULT_UL_ACK_LIST_COUNT]= {1, 2, 3 , 4, 5, 6, 7, 8};
 
+uint8_t schCmnDlRvTbl[4] = {0, 2, 3, 1};
 /**
  * @brief Function to find first DMRS symbol in PDSCH
  *
@@ -892,8 +893,12 @@ CmLList* isPrbAvailable(CmLListCp *freePrbBlockList, uint16_t startPrb, uint16_t
 
       /* Check if requested number of blocks can be allocated from the current block */
       if(freeBlock->numFreePrb < numPrb)
+      {
+         DU_LOG("\nINFO   --> SCH: In isPrbAvailable, numFreePrb:%d is less than reqPrb:%d", freeBlock->numFreePrb, numPrb);
+         node = node->next;
          continue;
-
+      }
+      
       /* Check if requested PRBs belong within the range of current free block */
       if(((startPrb >= freeBlock->startPrb) && (startPrb <= freeBlock->endPrb)) && \
          ((endPrb >= freeBlock->startPrb) && (endPrb <= freeBlock->endPrb)))
@@ -1340,7 +1345,7 @@ bool fillPrbBitmap(uint64_t *prbBitMap, uint16_t startPrb, uint16_t numPrb)
  *         If NULLP, FATAL FAILURE
  *
  * ***********************************************************************/
-LcInfo* handleLcLList(CmLListCp *lcLL, uint8_t lcId, ActionTypeLcLL action)
+LcInfo* handleLcLList(CmLListCp *lcLL, uint8_t lcId, ActionTypeLL action)
 {
    CmLList  *node = NULLP;
    LcInfo *lcNode = NULLP;
@@ -1429,6 +1434,11 @@ LcInfo* handleLcLList(CmLListCp *lcLL, uint8_t lcId, ActionTypeLcLL action)
             }
             return NULLP; 
          }
+      case PRINT:
+      case TRAVERSE_ALL:
+        {
+           break;
+        }
       default:
          {
             DU_LOG("\nERROR  -->  SCH: Action type wrong: %d",action);
@@ -1460,7 +1470,6 @@ LcInfo* handleLcLList(CmLListCp *lcLL, uint8_t lcId, ActionTypeLcLL action)
 uint8_t updateLcListReqPRB(CmLListCp *lcLL, uint8_t lcId, uint32_t payloadSize)
 {
    LcInfo    *lcNode = NULLP;
-
    lcNode = handleLcLList(lcLL, lcId, CREATE);
 
    if(lcNode == NULLP)
@@ -1468,8 +1477,9 @@ uint8_t updateLcListReqPRB(CmLListCp *lcLL, uint8_t lcId, uint32_t payloadSize)
       DU_LOG("\nERROR  -->  SCH : LC is neither present nor able to create in List lcId:%d",lcId);
       return RFAILED;
    }
+
    lcNode->reqBO = payloadSize;
-   lcNode->allocBO = 0; 
+   lcNode->allocBO = 0;
    lcNode->allocPRB = 0; /*Re-Initializing the AllocPRB*/
    return ROK;
 }
@@ -1534,7 +1544,7 @@ void deleteLcLL(CmLListCp *lcLL)
  *        
  *
  *************************************************************************/
-uint32_t calculateEstimateTBSize(uint32_t reqBO, uint16_t mcsIdx,uint8_t numSymbols,\
+uint32_t calculateEstimateTBSize(uint32_t reqBO, uint16_t mcsIdx, uint8_t numSymbols,\
                                    uint16_t maxPRB, uint16_t *estPrb)
 {
    uint32_t tbs = 0, effecBO = 0;
@@ -1559,6 +1569,76 @@ uint32_t calculateEstimateTBSize(uint32_t reqBO, uint16_t mcsIdx,uint8_t numSymb
    effecBO = MIN(tbs,reqBO);
    return (effecBO);
 }
+
+
+/*******************************************************************
+*
+* @brief deleting Page Info node from PageInfo List
+*
+* @details
+*
+*    Function : schDeleteFromPageInfoList
+*
+*    Functionality: deleting page Info node from Page Info List
+*
+* @params[in] CmLListCp *list, CmLList *node 
+*
+* @return void 
+*
+* ****************************************************************/
+void schDeleteFromPageInfoList(CmLListCp *list, CmLList *node)
+{
+   SchPageInfo *pageInfo;
+
+   if(node != NULLP)
+   {
+      pageInfo = (SchPageInfo *)node->node;
+      if(deleteNodeFromLList(list, node) == ROK)
+         SCH_FREE(pageInfo, sizeof(SchPageInfo));
+   }
+}
+
+/*******************************************************************
+*
+* @brief searching for Page at a particular SFN 
+*
+* @details
+*
+*    Function : schPageInfoSearchFromPageList
+*
+*    Functionality: searching for Page at a particular SFN 
+*
+* @params[in] SlotTimingInfo slotInfo, CmLListCp *storedPageList
+*
+* @return pointer to SchPageInfo
+*
+* ****************************************************************/
+CmLList *schPageInfoSearchFromPageList(SlotTimingInfo slotInfo, CmLListCp *storedPageList)
+{
+   CmLList         *node = NULLP;
+   SchPageInfo     *pageInfo = NULLP;
+
+   if(storedPageList->count)
+   {
+      CM_LLIST_FIRST_NODE(storedPageList, node);
+      while(node)
+      {
+         pageInfo = (SchPageInfo*)node->node;
+         if(pageInfo == NULLP)
+         {
+            DU_LOG("\nERROR  --> SCH: PageInfo empty");
+         }
+         else if(pageInfo->pageTxTime.sfn == slotInfo.sfn && 
+               (pageInfo->pageTxTime.slot == slotInfo.slot))
+         {
+            return node;
+         }
+         node = node->next;
+      }
+   }
+   return NULLP;
+}
+
 /*Below function for printing will be used in future so disabling it for now*/
 #if 0
 /****************************************************************************